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 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u32Z_ref_from_ptr(uint32_t ptr) {
283 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
285 case LDKCOption_u32Z_Some: {
286 return 0 /* LDKCOption_u32Z - Some */; (void) obj->some;
288 case LDKCOption_u32Z_None: {
289 return 0 /* LDKCOption_u32Z - None */;
294 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(uint32_t arg) {
295 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
297 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint32_t arg) {
298 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
299 CHECK(val->result_ok);
300 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
301 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
302 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
303 long res_ref = (long)res_var.inner & ~1;
306 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint32_t arg) {
307 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
308 CHECK(!val->result_ok);
309 LDKDecodeError err_var = (*val->contents.err);
310 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
311 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
312 long err_ref = (long)err_var.inner & ~1;
315 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
316 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
318 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
319 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
320 CHECK(val->result_ok);
321 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
322 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
323 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
324 long res_ref = (long)res_var.inner & ~1;
327 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
328 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
329 CHECK(!val->result_ok);
330 LDKDecodeError err_var = (*val->contents.err);
331 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
332 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
333 long err_ref = (long)err_var.inner & ~1;
336 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(uint32_t arg) {
337 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
339 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint32_t arg) {
340 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
341 CHECK(val->result_ok);
342 LDKChannelTransactionParameters res_var = (*val->contents.result);
343 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
344 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
345 long res_ref = (long)res_var.inner & ~1;
348 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint32_t arg) {
349 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
350 CHECK(!val->result_ok);
351 LDKDecodeError err_var = (*val->contents.err);
352 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
353 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
354 long err_ref = (long)err_var.inner & ~1;
357 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
358 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
360 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
361 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
362 CHECK(val->result_ok);
363 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
364 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
365 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
366 long res_ref = (long)res_var.inner & ~1;
369 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
370 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
371 CHECK(!val->result_ok);
372 LDKDecodeError err_var = (*val->contents.err);
373 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
374 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
375 long err_ref = (long)err_var.inner & ~1;
378 jboolean __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
379 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
381 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
382 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
383 CHECK(val->result_ok);
384 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
385 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
386 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
387 long res_ref = (long)res_var.inner & ~1;
390 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
391 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
392 CHECK(!val->result_ok);
393 LDKDecodeError err_var = (*val->contents.err);
394 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
395 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
396 long err_ref = (long)err_var.inner & ~1;
399 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
400 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
402 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(uint32_t arg) {
403 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
404 CHECK(val->result_ok);
405 LDKCommitmentTransaction res_var = (*val->contents.result);
406 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
407 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
408 long res_ref = (long)res_var.inner & ~1;
411 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(uint32_t arg) {
412 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
413 CHECK(!val->result_ok);
414 LDKDecodeError err_var = (*val->contents.err);
415 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
416 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
417 long err_ref = (long)err_var.inner & ~1;
420 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(uint32_t arg) {
421 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
423 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(uint32_t arg) {
424 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
425 CHECK(val->result_ok);
426 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
427 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
428 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
429 long res_ref = (long)res_var.inner & ~1;
432 void __attribute__((visibility("default"))) TS_LDKCResult_TrustedCommitmentTransactionNoneZ_get_err(uint32_t arg) {
433 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
434 CHECK(!val->result_ok);
435 return *val->contents.err;
437 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_result_ok(uint32_t arg) {
438 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
440 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_ok(uint32_t arg) {
441 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
442 CHECK(val->result_ok);
443 LDKCVec_SignatureZ res_var = (*val->contents.result);
444 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
445 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
446 for (size_t m = 0; m < res_var.datalen; m++) {
447 int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
448 memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64);
449 res_arr_ptr[m] = res_conv_12_arr;
453 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_get_err(uint32_t arg) {
454 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
455 CHECK(!val->result_ok);
456 return *val->contents.err;
458 uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(uint32_t ptr) {
459 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
461 case LDKErrorAction_DisconnectPeer: {
462 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
463 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
464 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
465 long msg_ref = (long)msg_var.inner & ~1;
466 return 0 /* LDKErrorAction - DisconnectPeer */; (void) msg_ref;
468 case LDKErrorAction_IgnoreError: {
469 return 0 /* LDKErrorAction - IgnoreError */;
471 case LDKErrorAction_SendErrorMessage: {
472 LDKErrorMessage msg_var = obj->send_error_message.msg;
473 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
474 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
475 long msg_ref = (long)msg_var.inner & ~1;
476 return 0 /* LDKErrorAction - SendErrorMessage */; (void) msg_ref;
481 uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
482 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
484 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
485 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
486 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
487 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
488 long msg_ref = (long)msg_var.inner & ~1;
489 return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
491 case LDKHTLCFailChannelUpdate_ChannelClosed: {
492 return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
494 case LDKHTLCFailChannelUpdate_NodeFailure: {
495 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
496 memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
497 return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
502 uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
503 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
505 case LDKMessageSendEvent_SendAcceptChannel: {
506 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
507 memcpy((uint8_t*)(node_id_arr + 4), obj->send_accept_channel.node_id.compressed_form, 33);
508 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
509 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
510 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
511 long msg_ref = (long)msg_var.inner & ~1;
512 return 0 /* LDKMessageSendEvent - SendAcceptChannel */; (void) node_id_arr; (void) msg_ref;
514 case LDKMessageSendEvent_SendOpenChannel: {
515 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
516 memcpy((uint8_t*)(node_id_arr + 4), obj->send_open_channel.node_id.compressed_form, 33);
517 LDKOpenChannel msg_var = obj->send_open_channel.msg;
518 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
519 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
520 long msg_ref = (long)msg_var.inner & ~1;
521 return 0 /* LDKMessageSendEvent - SendOpenChannel */; (void) node_id_arr; (void) msg_ref;
523 case LDKMessageSendEvent_SendFundingCreated: {
524 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
525 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_created.node_id.compressed_form, 33);
526 LDKFundingCreated msg_var = obj->send_funding_created.msg;
527 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
528 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
529 long msg_ref = (long)msg_var.inner & ~1;
530 return 0 /* LDKMessageSendEvent - SendFundingCreated */; (void) node_id_arr; (void) msg_ref;
532 case LDKMessageSendEvent_SendFundingSigned: {
533 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
534 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_signed.node_id.compressed_form, 33);
535 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
536 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
537 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
538 long msg_ref = (long)msg_var.inner & ~1;
539 return 0 /* LDKMessageSendEvent - SendFundingSigned */; (void) node_id_arr; (void) msg_ref;
541 case LDKMessageSendEvent_SendFundingLocked: {
542 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
543 memcpy((uint8_t*)(node_id_arr + 4), obj->send_funding_locked.node_id.compressed_form, 33);
544 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
545 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
546 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
547 long msg_ref = (long)msg_var.inner & ~1;
548 return 0 /* LDKMessageSendEvent - SendFundingLocked */; (void) node_id_arr; (void) msg_ref;
550 case LDKMessageSendEvent_SendAnnouncementSignatures: {
551 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
552 memcpy((uint8_t*)(node_id_arr + 4), obj->send_announcement_signatures.node_id.compressed_form, 33);
553 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
554 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
555 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
556 long msg_ref = (long)msg_var.inner & ~1;
557 return 0 /* LDKMessageSendEvent - SendAnnouncementSignatures */; (void) node_id_arr; (void) msg_ref;
559 case LDKMessageSendEvent_UpdateHTLCs: {
560 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
561 memcpy((uint8_t*)(node_id_arr + 4), obj->update_htl_cs.node_id.compressed_form, 33);
562 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
563 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
564 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
565 long updates_ref = (long)updates_var.inner & ~1;
566 return 0 /* LDKMessageSendEvent - UpdateHTLCs */; (void) node_id_arr; (void) updates_ref;
568 case LDKMessageSendEvent_SendRevokeAndACK: {
569 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
570 memcpy((uint8_t*)(node_id_arr + 4), obj->send_revoke_and_ack.node_id.compressed_form, 33);
571 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
572 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
573 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
574 long msg_ref = (long)msg_var.inner & ~1;
575 return 0 /* LDKMessageSendEvent - SendRevokeAndACK */; (void) node_id_arr; (void) msg_ref;
577 case LDKMessageSendEvent_SendClosingSigned: {
578 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
579 memcpy((uint8_t*)(node_id_arr + 4), obj->send_closing_signed.node_id.compressed_form, 33);
580 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
581 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
582 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
583 long msg_ref = (long)msg_var.inner & ~1;
584 return 0 /* LDKMessageSendEvent - SendClosingSigned */; (void) node_id_arr; (void) msg_ref;
586 case LDKMessageSendEvent_SendShutdown: {
587 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
588 memcpy((uint8_t*)(node_id_arr + 4), obj->send_shutdown.node_id.compressed_form, 33);
589 LDKShutdown msg_var = obj->send_shutdown.msg;
590 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
591 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
592 long msg_ref = (long)msg_var.inner & ~1;
593 return 0 /* LDKMessageSendEvent - SendShutdown */; (void) node_id_arr; (void) msg_ref;
595 case LDKMessageSendEvent_SendChannelReestablish: {
596 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
597 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_reestablish.node_id.compressed_form, 33);
598 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
599 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
600 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
601 long msg_ref = (long)msg_var.inner & ~1;
602 return 0 /* LDKMessageSendEvent - SendChannelReestablish */; (void) node_id_arr; (void) msg_ref;
604 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
605 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
606 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
607 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
608 long msg_ref = (long)msg_var.inner & ~1;
609 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
610 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
611 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
612 long update_msg_ref = (long)update_msg_var.inner & ~1;
613 return 0 /* LDKMessageSendEvent - BroadcastChannelAnnouncement */; (void) msg_ref; (void) update_msg_ref;
615 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
616 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
617 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
618 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
619 long msg_ref = (long)msg_var.inner & ~1;
620 return 0 /* LDKMessageSendEvent - BroadcastNodeAnnouncement */; (void) msg_ref;
622 case LDKMessageSendEvent_BroadcastChannelUpdate: {
623 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
624 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
625 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
626 long msg_ref = (long)msg_var.inner & ~1;
627 return 0 /* LDKMessageSendEvent - BroadcastChannelUpdate */; (void) msg_ref;
629 case LDKMessageSendEvent_HandleError: {
630 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
631 memcpy((uint8_t*)(node_id_arr + 4), obj->handle_error.node_id.compressed_form, 33);
632 long action_ref = ((long)&obj->handle_error.action) | 1;
633 return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
635 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
636 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
637 return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
639 case LDKMessageSendEvent_SendChannelRangeQuery: {
640 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
641 memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
642 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
643 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
644 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
645 long msg_ref = (long)msg_var.inner & ~1;
646 return 0 /* LDKMessageSendEvent - SendChannelRangeQuery */; (void) node_id_arr; (void) msg_ref;
648 case LDKMessageSendEvent_SendShortIdsQuery: {
649 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
650 memcpy((uint8_t*)(node_id_arr + 4), obj->send_short_ids_query.node_id.compressed_form, 33);
651 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
652 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
653 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
654 long msg_ref = (long)msg_var.inner & ~1;
655 return 0 /* LDKMessageSendEvent - SendShortIdsQuery */; (void) node_id_arr; (void) msg_ref;
657 case LDKMessageSendEvent_SendReplyChannelRange: {
658 int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
659 memcpy((uint8_t*)(node_id_arr + 4), obj->send_reply_channel_range.node_id.compressed_form, 33);
660 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
661 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
662 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
663 long msg_ref = (long)msg_var.inner & ~1;
664 return 0 /* LDKMessageSendEvent - SendReplyChannelRange */; (void) node_id_arr; (void) msg_ref;
669 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MessageSendEventZ_new(uint32_tArray elems) {
670 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
671 ret->datalen = *((uint32_t*)elems);
672 if (ret->datalen == 0) {
675 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
676 uint32_t *java_elems = (uint32_t*)(elems + 4);
677 for (size_t i = 0; i < ret->datalen; i++) {
678 uint32_t arr_elem = java_elems[i];
679 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
680 FREE((void*)arr_elem);
681 ret->data[i] = arr_elem_conv;
686 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
687 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
688 for (size_t i = 0; i < ret.datalen; i++) {
689 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
693 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
694 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
696 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_ok(uint32_t arg) {
697 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
698 CHECK(val->result_ok);
699 return *val->contents.result;
701 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_get_err(uint32_t arg) {
702 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
703 CHECK(!val->result_ok);
704 LDKLightningError err_var = (*val->contents.err);
705 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
706 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
707 long err_ref = (long)err_var.inner & ~1;
710 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
711 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
712 LDKChannelAnnouncement a_conv;
713 a_conv.inner = (void*)(a & (~1));
714 a_conv.is_owned = (a & 1) || (a == 0);
715 a_conv = ChannelAnnouncement_clone(&a_conv);
717 LDKChannelUpdate b_conv;
718 b_conv.inner = (void*)(b & (~1));
719 b_conv.is_owned = (b & 1) || (b == 0);
720 b_conv = ChannelUpdate_clone(&b_conv);
722 LDKChannelUpdate c_conv;
723 c_conv.inner = (void*)(c & (~1));
724 c_conv.is_owned = (c & 1) || (c == 0);
725 c_conv = ChannelUpdate_clone(&c_conv);
729 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint32_t ptr) {
730 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
731 LDKChannelAnnouncement a_var = tuple->a;
732 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
733 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
734 long a_ref = (long)a_var.inner & ~1;
737 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint32_t ptr) {
738 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
739 LDKChannelUpdate b_var = tuple->b;
740 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
741 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
742 long b_ref = (long)b_var.inner & ~1;
745 uint32_t __attribute__((visibility("default"))) TS_LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint32_t ptr) {
746 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
747 LDKChannelUpdate c_var = tuple->c;
748 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
749 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
750 long c_ref = (long)c_var.inner & ~1;
753 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(uint32_tArray elems) {
754 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
755 ret->datalen = *((uint32_t*)elems);
756 if (ret->datalen == 0) {
759 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
760 uint32_t *java_elems = (uint32_t*)(elems + 4);
761 for (size_t i = 0; i < ret->datalen; i++) {
762 uint32_t arr_elem = java_elems[i];
763 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
764 FREE((void*)arr_elem);
765 ret->data[i] = arr_elem_conv;
770 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
771 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
772 for (size_t i = 0; i < ret.datalen; i++) {
773 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
777 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NodeAnnouncementZ_new(uint32_tArray elems) {
778 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
779 ret->datalen = *((uint32_t*)elems);
780 if (ret->datalen == 0) {
783 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
784 uint32_t *java_elems = (uint32_t*)(elems + 4);
785 for (size_t i = 0; i < ret->datalen; i++) {
786 uint32_t arr_elem = java_elems[i];
787 LDKNodeAnnouncement arr_elem_conv;
788 arr_elem_conv.inner = (void*)(arr_elem & (~1));
789 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
790 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
791 ret->data[i] = arr_elem_conv;
796 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
797 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
798 for (size_t i = 0; i < ret.datalen; i++) {
799 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
803 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
804 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
806 void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
807 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
808 CHECK(val->result_ok);
809 return *val->contents.result;
811 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
812 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
813 CHECK(!val->result_ok);
814 LDKLightningError err_var = (*val->contents.err);
815 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
816 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
817 long err_ref = (long)err_var.inner & ~1;
820 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
821 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
823 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint32_t arg) {
824 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
825 CHECK(val->result_ok);
826 LDKCVec_u8Z res_var = (*val->contents.result);
827 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
828 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
831 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(uint32_t arg) {
832 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
833 CHECK(!val->result_ok);
834 LDKPeerHandleError err_var = (*val->contents.err);
835 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
836 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
837 long err_ref = (long)err_var.inner & ~1;
840 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_result_ok(uint32_t arg) {
841 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
843 void __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_ok(uint32_t arg) {
844 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
845 CHECK(val->result_ok);
846 return *val->contents.result;
848 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePeerHandleErrorZ_get_err(uint32_t arg) {
849 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
850 CHECK(!val->result_ok);
851 LDKPeerHandleError err_var = (*val->contents.err);
852 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
853 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
854 long err_ref = (long)err_var.inner & ~1;
857 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_result_ok(uint32_t arg) {
858 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
860 jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_ok(uint32_t arg) {
861 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
862 CHECK(val->result_ok);
863 return *val->contents.result;
865 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErrorZ_get_err(uint32_t arg) {
866 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
867 CHECK(!val->result_ok);
868 LDKPeerHandleError 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_InitFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
875 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
877 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
878 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
879 CHECK(val->result_ok);
880 LDKInitFeatures 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_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) {
887 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(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_NodeFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
896 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
898 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
899 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
900 CHECK(val->result_ok);
901 LDKNodeFeatures 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_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) {
908 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(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_ChannelFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
917 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
919 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
920 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
921 CHECK(val->result_ok);
922 LDKChannelFeatures 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_ChannelFeaturesDecodeErrorZ_get_err(uint32_t arg) {
929 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(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_InvoiceFeaturesDecodeErrorZ_result_ok(uint32_t arg) {
938 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
940 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) {
941 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
942 CHECK(val->result_ok);
943 LDKInvoiceFeatures 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_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) {
950 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(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_ChannelConfigDecodeErrorZ_result_ok(uint32_t arg) {
959 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
961 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelConfigDecodeErrorZ_get_ok(uint32_t arg) {
962 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
963 CHECK(val->result_ok);
964 LDKChannelConfig 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_ChannelConfigDecodeErrorZ_get_err(uint32_t arg) {
971 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(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 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u64Z_ref_from_ptr(uint32_t ptr) {
980 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
982 case LDKCOption_u64Z_Some: {
983 return 0 /* LDKCOption_u64Z - Some */; (void) obj->some;
985 case LDKCOption_u64Z_None: {
986 return 0 /* LDKCOption_u64Z - None */;
991 jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
992 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
994 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
995 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
996 CHECK(val->result_ok);
997 LDKDirectionalChannelInfo res_var = (*val->contents.result);
998 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
999 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1000 long res_ref = (long)res_var.inner & ~1;
1003 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
1004 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
1005 CHECK(!val->result_ok);
1006 LDKDecodeError err_var = (*val->contents.err);
1007 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1008 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1009 long err_ref = (long)err_var.inner & ~1;
1012 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
1013 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
1015 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
1016 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1017 CHECK(val->result_ok);
1018 LDKChannelInfo res_var = (*val->contents.result);
1019 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1020 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1021 long res_ref = (long)res_var.inner & ~1;
1024 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
1025 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
1026 CHECK(!val->result_ok);
1027 LDKDecodeError err_var = (*val->contents.err);
1028 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1029 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1030 long err_ref = (long)err_var.inner & ~1;
1033 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_result_ok(uint32_t arg) {
1034 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
1036 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_ok(uint32_t arg) {
1037 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1038 CHECK(val->result_ok);
1039 LDKRoutingFees res_var = (*val->contents.result);
1040 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1041 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1042 long res_ref = (long)res_var.inner & ~1;
1045 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RoutingFeesDecodeErrorZ_get_err(uint32_t arg) {
1046 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
1047 CHECK(!val->result_ok);
1048 LDKDecodeError err_var = (*val->contents.err);
1049 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1050 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1051 long err_ref = (long)err_var.inner & ~1;
1054 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
1055 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
1057 case LDKNetAddress_IPv4: {
1058 int8_tArray addr_arr = init_arr(4, sizeof(uint8_t), "Native int8_tArray Bytes");
1059 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv4.addr.data, 4);
1060 return 0 /* LDKNetAddress - IPv4 */; (void) addr_arr; (void) obj->i_pv4.port;
1062 case LDKNetAddress_IPv6: {
1063 int8_tArray addr_arr = init_arr(16, sizeof(uint8_t), "Native int8_tArray Bytes");
1064 memcpy((uint8_t*)(addr_arr + 4), obj->i_pv6.addr.data, 16);
1065 return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port;
1067 case LDKNetAddress_OnionV2: {
1068 int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes");
1069 memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10);
1070 return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port;
1072 case LDKNetAddress_OnionV3: {
1073 int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1074 memcpy((uint8_t*)(ed25519_pubkey_arr + 4), obj->onion_v3.ed25519_pubkey.data, 32);
1075 return 0 /* LDKNetAddress - OnionV3 */; (void) ed25519_pubkey_arr; (void) obj->onion_v3.checksum; (void) obj->onion_v3.version; (void) obj->onion_v3.port;
1080 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_NetAddressZ_new(uint32_tArray elems) {
1081 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
1082 ret->datalen = *((uint32_t*)elems);
1083 if (ret->datalen == 0) {
1086 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
1087 uint32_t *java_elems = (uint32_t*)(elems + 4);
1088 for (size_t i = 0; i < ret->datalen; i++) {
1089 uint32_t arr_elem = java_elems[i];
1090 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
1091 FREE((void*)arr_elem);
1092 ret->data[i] = arr_elem_conv;
1097 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
1098 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
1099 for (size_t i = 0; i < ret.datalen; i++) {
1100 ret.data[i] = NetAddress_clone(&orig->data[i]);
1104 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_result_ok(uint32_t arg) {
1105 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
1107 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint32_t arg) {
1108 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1109 CHECK(val->result_ok);
1110 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
1111 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1112 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1113 long res_ref = (long)res_var.inner & ~1;
1116 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint32_t arg) {
1117 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
1118 CHECK(!val->result_ok);
1119 LDKDecodeError err_var = (*val->contents.err);
1120 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1121 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1122 long err_ref = (long)err_var.inner & ~1;
1125 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_u64Z_new(int64_tArray elems) {
1126 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
1127 ret->datalen = *((uint32_t*)elems);
1128 if (ret->datalen == 0) {
1131 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
1132 int64_t *java_elems = (int64_t*)(elems + 4);
1133 for (size_t i = 0; i < ret->datalen; i++) {
1134 ret->data[i] = java_elems[i];
1139 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1140 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1141 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1144 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_result_ok(uint32_t arg) {
1145 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
1147 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_ok(uint32_t arg) {
1148 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1149 CHECK(val->result_ok);
1150 LDKNodeInfo res_var = (*val->contents.result);
1151 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1152 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1153 long res_ref = (long)res_var.inner & ~1;
1156 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeInfoDecodeErrorZ_get_err(uint32_t arg) {
1157 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
1158 CHECK(!val->result_ok);
1159 LDKDecodeError err_var = (*val->contents.err);
1160 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1161 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1162 long err_ref = (long)err_var.inner & ~1;
1165 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_result_ok(uint32_t arg) {
1166 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
1168 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_ok(uint32_t arg) {
1169 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1170 CHECK(val->result_ok);
1171 LDKNetworkGraph res_var = (*val->contents.result);
1172 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1173 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1174 long res_ref = (long)res_var.inner & ~1;
1177 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecodeErrorZ_get_err(uint32_t arg) {
1178 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
1179 CHECK(!val->result_ok);
1180 LDKDecodeError err_var = (*val->contents.err);
1181 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1182 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1183 long err_ref = (long)err_var.inner & ~1;
1186 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
1187 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1189 LDKTransaction b_ref;
1190 b_ref.datalen = *((uint32_t*)b);
1191 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1192 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1193 b_ref.data_is_owned = false;
1197 int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_a(uint32_t ptr) {
1198 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1201 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_usizeTransactionZ_get_b(uint32_t ptr) {
1202 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1203 LDKTransaction b_var = tuple->b;
1204 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1205 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1208 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_usizeTransactionZZ_new(uint32_tArray elems) {
1209 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1210 ret->datalen = *((uint32_t*)elems);
1211 if (ret->datalen == 0) {
1214 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1215 uint32_t *java_elems = (uint32_t*)(elems + 4);
1216 for (size_t i = 0; i < ret->datalen; i++) {
1217 uint32_t arr_elem = java_elems[i];
1218 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1219 FREE((void*)arr_elem);
1220 ret->data[i] = arr_elem_conv;
1225 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(uint32_t arg) {
1226 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1228 void __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(uint32_t arg) {
1229 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1230 CHECK(val->result_ok);
1231 return *val->contents.result;
1233 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(uint32_t arg) {
1234 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1235 CHECK(!val->result_ok);
1236 uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err));
1239 uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) {
1240 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1242 case LDKMonitorEvent_HTLCEvent: {
1243 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1244 CHECK((((long)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1245 CHECK((((long)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1246 long htlc_event_ref = (long)htlc_event_var.inner & ~1;
1247 return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
1249 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1250 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1251 CHECK((((long)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1252 CHECK((((long)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1253 long commitment_tx_broadcasted_ref = (long)commitment_tx_broadcasted_var.inner & ~1;
1254 return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
1259 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) {
1260 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1261 ret->datalen = *((uint32_t*)elems);
1262 if (ret->datalen == 0) {
1265 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1266 uint32_t *java_elems = (uint32_t*)(elems + 4);
1267 for (size_t i = 0; i < ret->datalen; i++) {
1268 uint32_t arr_elem = java_elems[i];
1269 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1270 FREE((void*)arr_elem);
1271 ret->data[i] = arr_elem_conv;
1276 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1277 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1278 for (size_t i = 0; i < ret.datalen; i++) {
1279 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1283 uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
1284 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1286 case LDKSpendableOutputDescriptor_StaticOutput: {
1287 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1288 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1290 long outpoint_ref = (long)outpoint_var.inner & ~1;
1291 long output_ref = ((long)&obj->static_output.output) | 1;
1292 return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref;
1294 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1295 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1296 CHECK((((long)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1297 CHECK((((long)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1298 long delayed_payment_output_ref = (long)delayed_payment_output_var.inner & ~1;
1299 return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; (void) delayed_payment_output_ref;
1301 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1302 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1303 CHECK((((long)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1304 CHECK((((long)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1305 long static_payment_output_ref = (long)static_payment_output_var.inner & ~1;
1306 return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; (void) static_payment_output_ref;
1311 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_SpendableOutputDescriptorZ_new(uint32_tArray elems) {
1312 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1313 ret->datalen = *((uint32_t*)elems);
1314 if (ret->datalen == 0) {
1317 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1318 uint32_t *java_elems = (uint32_t*)(elems + 4);
1319 for (size_t i = 0; i < ret->datalen; i++) {
1320 uint32_t arr_elem = java_elems[i];
1321 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1322 FREE((void*)arr_elem);
1323 ret->data[i] = arr_elem_conv;
1328 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1329 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1330 for (size_t i = 0; i < ret.datalen; i++) {
1331 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1335 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
1336 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
1338 case LDKEvent_FundingGenerationReady: {
1339 int8_tArray temporary_channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1340 memcpy((uint8_t*)(temporary_channel_id_arr + 4), obj->funding_generation_ready.temporary_channel_id.data, 32);
1341 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1342 int8_tArray output_script_arr = init_arr(output_script_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1343 memcpy((uint8_t*)(output_script_arr + 4), output_script_var.data, output_script_var.datalen);
1344 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;
1346 case LDKEvent_FundingBroadcastSafe: {
1347 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1348 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1349 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1350 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1351 return 0 /* LDKEvent - FundingBroadcastSafe */; (void) funding_txo_ref; (void) obj->funding_broadcast_safe.user_channel_id;
1353 case LDKEvent_PaymentReceived: {
1354 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1355 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
1356 int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1357 memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
1358 return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_secret_arr; (void) obj->payment_received.amt;
1360 case LDKEvent_PaymentSent: {
1361 int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1362 memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
1363 return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
1365 case LDKEvent_PaymentFailed: {
1366 int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1367 memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
1368 return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
1370 case LDKEvent_PendingHTLCsForwardable: {
1371 return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
1373 case LDKEvent_SpendableOutputs: {
1374 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1375 uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1376 uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4);
1377 for (size_t b = 0; b < outputs_var.datalen; b++) {
1378 long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1379 outputs_arr_ptr[b] = outputs_conv_27_ref;
1381 return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
1386 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_EventZ_new(uint32_tArray elems) {
1387 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1388 ret->datalen = *((uint32_t*)elems);
1389 if (ret->datalen == 0) {
1392 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1393 uint32_t *java_elems = (uint32_t*)(elems + 4);
1394 for (size_t i = 0; i < ret->datalen; i++) {
1395 uint32_t arr_elem = java_elems[i];
1396 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1397 FREE((void*)arr_elem);
1398 ret->data[i] = arr_elem_conv;
1403 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1404 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1405 for (size_t i = 0; i < ret.datalen; i++) {
1406 ret.data[i] = Event_clone(&orig->data[i]);
1410 jboolean __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_result_ok(uint32_t arg) {
1411 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
1413 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_ok(uint32_t arg) {
1414 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1415 CHECK(val->result_ok);
1416 LDKOutPoint res_var = (*val->contents.result);
1417 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 long res_ref = (long)res_var.inner & ~1;
1422 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OutPointDecodeErrorZ_get_err(uint32_t arg) {
1423 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
1424 CHECK(!val->result_ok);
1425 LDKDecodeError err_var = (*val->contents.err);
1426 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1427 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1428 long err_ref = (long)err_var.inner & ~1;
1431 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1432 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1434 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1435 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1436 CHECK(val->result_ok);
1437 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1438 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1439 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1440 long res_ref = (long)res_var.inner & ~1;
1443 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint32_t arg) {
1444 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1445 CHECK(!val->result_ok);
1446 LDKDecodeError err_var = (*val->contents.err);
1447 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1448 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1449 long err_ref = (long)err_var.inner & ~1;
1452 jboolean __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(uint32_t arg) {
1453 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
1455 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(uint32_t arg) {
1456 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1457 CHECK(val->result_ok);
1458 LDKHTLCUpdate res_var = (*val->contents.result);
1459 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1460 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1461 long res_ref = (long)res_var.inner & ~1;
1464 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeErrorZ_get_err(uint32_t arg) {
1465 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
1466 CHECK(!val->result_ok);
1467 LDKDecodeError err_var = (*val->contents.err);
1468 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1469 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1470 long err_ref = (long)err_var.inner & ~1;
1473 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_result_ok(uint32_t arg) {
1474 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1476 void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) {
1477 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1478 CHECK(val->result_ok);
1479 return *val->contents.result;
1481 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) {
1482 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1483 CHECK(!val->result_ok);
1484 LDKMonitorUpdateError err_var = (*val->contents.err);
1485 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1486 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1487 long err_ref = (long)err_var.inner & ~1;
1490 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
1491 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1493 a_conv.inner = (void*)(a & (~1));
1494 a_conv.is_owned = (a & 1) || (a == 0);
1495 a_conv = OutPoint_clone(&a_conv);
1498 b_ref.datalen = *((uint32_t*)b);
1499 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1500 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1504 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_a(uint32_t ptr) {
1505 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1506 LDKOutPoint a_var = tuple->a;
1507 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1508 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1509 long a_ref = (long)a_var.inner & ~1;
1512 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_OutPointScriptZ_get_b(uint32_t ptr) {
1513 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1514 LDKCVec_u8Z b_var = tuple->b;
1515 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1516 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1519 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
1520 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
1523 b_ref.datalen = *((uint32_t*)b);
1524 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1525 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
1529 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_a(uint32_t ptr) {
1530 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
1533 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_u32ScriptZ_get_b(uint32_t ptr) {
1534 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
1535 LDKCVec_u8Z b_var = tuple->b;
1536 int8_tArray b_arr = init_arr(b_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1537 memcpy((uint8_t*)(b_arr + 4), b_var.data, b_var.datalen);
1540 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32ScriptZZ_new(uint32_tArray elems) {
1541 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
1542 ret->datalen = *((uint32_t*)elems);
1543 if (ret->datalen == 0) {
1546 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
1547 uint32_t *java_elems = (uint32_t*)(elems + 4);
1548 for (size_t i = 0; i < ret->datalen; i++) {
1549 uint32_t arr_elem = java_elems[i];
1550 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
1551 FREE((void*)arr_elem);
1552 ret->data[i] = arr_elem_conv;
1557 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
1558 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
1559 for (size_t i = 0; i < ret.datalen; i++) {
1560 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
1564 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
1565 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
1566 LDKThirtyTwoBytes a_ref;
1567 CHECK(*((uint32_t*)a) == 32);
1568 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1570 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
1571 b_constr.datalen = *((uint32_t*)b);
1572 if (b_constr.datalen > 0)
1573 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
1575 b_constr.data = NULL;
1576 uint32_t* b_vals = (uint32_t*)(b + 4);
1577 for (size_t e = 0; e < b_constr.datalen; e++) {
1578 uint32_t b_conv_30 = b_vals[e];
1579 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
1580 FREE((void*)b_conv_30);
1581 b_constr.data[e] = b_conv_30_conv;
1586 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint32_t ptr) {
1587 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
1588 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1589 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1592 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint32_t ptr) {
1593 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
1594 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
1595 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1596 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1597 for (size_t e = 0; e < b_var.datalen; e++) {
1598 long b_conv_30_ref = (long)(&b_var.data[e]) | 1;
1599 b_arr_ptr[e] = b_conv_30_ref;
1603 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(uint32_tArray elems) {
1604 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
1605 ret->datalen = *((uint32_t*)elems);
1606 if (ret->datalen == 0) {
1609 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
1610 uint32_t *java_elems = (uint32_t*)(elems + 4);
1611 for (size_t i = 0; i < ret->datalen; i++) {
1612 uint32_t arr_elem = java_elems[i];
1613 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
1614 FREE((void*)arr_elem);
1615 ret->data[i] = arr_elem_conv;
1620 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
1621 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1623 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1628 int32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_a(uint32_t ptr) {
1629 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1632 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u32TxOutZ_get_b(uint32_t ptr) {
1633 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1634 long b_ref = ((long)&tuple->b) | 1;
1637 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_u32TxOutZZ_new(uint32_tArray elems) {
1638 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1639 ret->datalen = *((uint32_t*)elems);
1640 if (ret->datalen == 0) {
1643 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1644 uint32_t *java_elems = (uint32_t*)(elems + 4);
1645 for (size_t i = 0; i < ret->datalen; i++) {
1646 uint32_t arr_elem = java_elems[i];
1647 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1648 FREE((void*)arr_elem);
1649 ret->data[i] = arr_elem_conv;
1654 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1655 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1656 for (size_t i = 0; i < ret.datalen; i++) {
1657 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1661 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
1662 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1663 LDKThirtyTwoBytes a_ref;
1664 CHECK(*((uint32_t*)a) == 32);
1665 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
1667 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1668 b_constr.datalen = *((uint32_t*)b);
1669 if (b_constr.datalen > 0)
1670 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1672 b_constr.data = NULL;
1673 uint32_t* b_vals = (uint32_t*)(b + 4);
1674 for (size_t z = 0; z < b_constr.datalen; z++) {
1675 uint32_t b_conv_25 = b_vals[z];
1676 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
1677 FREE((void*)b_conv_25);
1678 b_constr.data[z] = b_conv_25_conv;
1683 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint32_t ptr) {
1684 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1685 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1686 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
1689 uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint32_t ptr) {
1690 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1691 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1692 uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
1693 uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4);
1694 for (size_t z = 0; z < b_var.datalen; z++) {
1695 long b_conv_25_ref = (long)(&b_var.data[z]) | 1;
1696 b_arr_ptr[z] = b_conv_25_ref;
1700 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(uint32_tArray elems) {
1701 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1702 ret->datalen = *((uint32_t*)elems);
1703 if (ret->datalen == 0) {
1706 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1707 uint32_t *java_elems = (uint32_t*)(elems + 4);
1708 for (size_t i = 0; i < ret->datalen; i++) {
1709 uint32_t arr_elem = java_elems[i];
1710 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1711 FREE((void*)arr_elem);
1712 ret->data[i] = arr_elem_conv;
1717 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
1718 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1720 CHECK(*((uint32_t*)a) == 64);
1721 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
1723 LDKCVec_SignatureZ b_constr;
1724 b_constr.datalen = *((uint32_t*)b);
1725 if (b_constr.datalen > 0)
1726 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1728 b_constr.data = NULL;
1729 int8_tArray* b_vals = (int8_tArray*)(b + 4);
1730 for (size_t m = 0; m < b_constr.datalen; m++) {
1731 int8_tArray b_conv_12 = b_vals[m];
1732 LDKSignature b_conv_12_ref;
1733 CHECK(*((uint32_t*)b_conv_12) == 64);
1734 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
1735 b_constr.data[m] = b_conv_12_ref;
1740 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(uint32_t ptr) {
1741 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1742 int8_tArray a_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1743 memcpy((uint8_t*)(a_arr + 4), tuple->a.compact_form, 64);
1746 ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(uint32_t ptr) {
1747 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1748 LDKCVec_SignatureZ b_var = tuple->b;
1749 ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
1750 int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4);
1751 for (size_t m = 0; m < b_var.datalen; m++) {
1752 int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1753 memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64);
1754 b_arr_ptr[m] = b_conv_12_arr;
1758 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(uint32_t arg) {
1759 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1761 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint32_t arg) {
1762 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1763 CHECK(val->result_ok);
1764 long res_ref = (long)(&(*val->contents.result)) | 1;
1767 void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint32_t arg) {
1768 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1769 CHECK(!val->result_ok);
1770 return *val->contents.err;
1772 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_result_ok(uint32_t arg) {
1773 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1775 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_ok(uint32_t arg) {
1776 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1777 CHECK(val->result_ok);
1778 int8_tArray res_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
1779 memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).compact_form, 64);
1782 void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_err(uint32_t arg) {
1783 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1784 CHECK(!val->result_ok);
1785 return *val->contents.err;
1787 typedef struct LDKSign_JCalls {
1788 atomic_size_t refcnt;
1789 uint32_t get_per_commitment_point_meth;
1790 uint32_t release_commitment_secret_meth;
1791 uint32_t channel_keys_id_meth;
1792 uint32_t sign_counterparty_commitment_meth;
1793 uint32_t sign_holder_commitment_and_htlcs_meth;
1794 uint32_t sign_justice_transaction_meth;
1795 uint32_t sign_counterparty_htlc_transaction_meth;
1796 uint32_t sign_closing_transaction_meth;
1797 uint32_t sign_channel_announcement_meth;
1798 uint32_t ready_channel_meth;
1799 uint32_t write_meth;
1801 static void LDKSign_JCalls_free(void* this_arg) {
1802 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1803 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1804 js_free(j_calls->get_per_commitment_point_meth);
1805 js_free(j_calls->release_commitment_secret_meth);
1806 js_free(j_calls->channel_keys_id_meth);
1807 js_free(j_calls->sign_counterparty_commitment_meth);
1808 js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
1809 js_free(j_calls->sign_justice_transaction_meth);
1810 js_free(j_calls->sign_counterparty_htlc_transaction_meth);
1811 js_free(j_calls->sign_closing_transaction_meth);
1812 js_free(j_calls->sign_channel_announcement_meth);
1813 js_free(j_calls->ready_channel_meth);
1814 js_free(j_calls->write_meth);
1818 LDKPublicKey get_per_commitment_point_LDKSign_jcall(const void* this_arg, uint64_t idx) {
1819 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1820 int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx);
1821 LDKPublicKey ret_ref;
1822 CHECK(*((uint32_t*)ret) == 33);
1823 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
1826 LDKThirtyTwoBytes release_commitment_secret_LDKSign_jcall(const void* this_arg, uint64_t idx) {
1827 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1828 int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx);
1829 LDKThirtyTwoBytes ret_ref;
1830 CHECK(*((uint32_t*)ret) == 32);
1831 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1834 LDKThirtyTwoBytes channel_keys_id_LDKSign_jcall(const void* this_arg) {
1835 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1836 int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
1837 LDKThirtyTwoBytes ret_ref;
1838 CHECK(*((uint32_t*)ret) == 32);
1839 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
1842 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1843 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1844 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1845 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1846 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1847 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1848 long commitment_tx_ref = (long)commitment_tx_var.inner;
1849 if (commitment_tx_var.is_owned) {
1850 commitment_tx_ref |= 1;
1852 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1853 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1854 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1857 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1858 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1859 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1860 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1861 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1862 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1863 long commitment_tx_ref = (long)commitment_tx_var.inner;
1864 if (commitment_tx_var.is_owned) {
1865 commitment_tx_ref |= 1;
1867 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1868 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1869 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1872 LDKCResult_SignatureNoneZ sign_justice_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1873 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1874 LDKTransaction justice_tx_var = justice_tx;
1875 int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1876 memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen);
1877 Transaction_free(justice_tx_var);
1878 int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
1879 memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
1880 LDKHTLCOutputInCommitment htlc_var = *htlc;
1881 htlc_var = HTLCOutputInCommitment_clone(htlc);
1882 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1883 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1884 long htlc_ref = (long)htlc_var.inner;
1885 if (htlc_var.is_owned) {
1888 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);
1889 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1890 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1893 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1894 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1895 LDKTransaction htlc_tx_var = htlc_tx;
1896 int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1897 memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen);
1898 Transaction_free(htlc_tx_var);
1899 int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
1900 memcpy((uint8_t*)(per_commitment_point_arr + 4), per_commitment_point.compressed_form, 33);
1901 LDKHTLCOutputInCommitment htlc_var = *htlc;
1902 htlc_var = HTLCOutputInCommitment_clone(htlc);
1903 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1904 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1905 long htlc_ref = (long)htlc_var.inner;
1906 if (htlc_var.is_owned) {
1909 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);
1910 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1911 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1914 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
1915 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1916 LDKTransaction closing_tx_var = closing_tx;
1917 int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
1918 memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
1919 Transaction_free(closing_tx_var);
1920 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
1921 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1922 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1925 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1926 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1927 LDKUnsignedChannelAnnouncement msg_var = *msg;
1928 msg_var = UnsignedChannelAnnouncement_clone(msg);
1929 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1930 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1931 long msg_ref = (long)msg_var.inner;
1932 if (msg_var.is_owned) {
1935 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
1936 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1937 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1940 void ready_channel_LDKSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1941 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1942 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1943 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1944 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1945 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1946 long channel_parameters_ref = (long)channel_parameters_var.inner;
1947 if (channel_parameters_var.is_owned) {
1948 channel_parameters_ref |= 1;
1950 js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref);
1952 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
1953 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1954 int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
1955 LDKCVec_u8Z ret_ref;
1956 ret_ref.datalen = *((uint32_t*)ret);
1957 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
1958 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
1961 static void* LDKSign_JCalls_clone(const void* this_arg) {
1962 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
1963 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1964 return (void*) this_arg;
1966 static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1967 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
1968 atomic_init(&calls->refcnt, 1);
1969 //TODO: Assign calls->o from o
1971 LDKChannelPublicKeys pubkeys_conv;
1972 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1973 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1974 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1977 .this_arg = (void*) calls,
1978 .get_per_commitment_point = get_per_commitment_point_LDKSign_jcall,
1979 .release_commitment_secret = release_commitment_secret_LDKSign_jcall,
1980 .channel_keys_id = channel_keys_id_LDKSign_jcall,
1981 .sign_counterparty_commitment = sign_counterparty_commitment_LDKSign_jcall,
1982 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKSign_jcall,
1983 .sign_justice_transaction = sign_justice_transaction_LDKSign_jcall,
1984 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKSign_jcall,
1985 .sign_closing_transaction = sign_closing_transaction_LDKSign_jcall,
1986 .sign_channel_announcement = sign_channel_announcement_LDKSign_jcall,
1987 .ready_channel = ready_channel_LDKSign_jcall,
1988 .clone = LDKSign_JCalls_clone,
1989 .write = write_LDKSign_jcall,
1990 .free = LDKSign_JCalls_free,
1991 .pubkeys = pubkeys_conv,
1992 .set_pubkeys = NULL,
1996 long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) {
1997 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
1998 *res_ptr = LDKSign_init(o, pubkeys);
1999 return (long)res_ptr;
2001 int8_tArray __attribute__((visibility("default"))) TS_Sign_get_per_commitment_point(uint32_t this_arg, int64_t idx) {
2002 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2003 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2004 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
2008 int8_tArray __attribute__((visibility("default"))) TS_Sign_release_commitment_secret(uint32_t this_arg, int64_t idx) {
2009 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2010 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2011 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
2015 int8_tArray __attribute__((visibility("default"))) TS_Sign_channel_keys_id(uint32_t this_arg) {
2016 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2017 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2018 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
2022 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) {
2023 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2024 LDKCommitmentTransaction commitment_tx_conv;
2025 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2026 commitment_tx_conv.is_owned = false;
2027 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2028 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2029 return (long)ret_conv;
2032 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
2033 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2034 LDKHolderCommitmentTransaction commitment_tx_conv;
2035 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2036 commitment_tx_conv.is_owned = false;
2037 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2038 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2039 return (long)ret_conv;
2042 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) {
2043 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2044 LDKTransaction justice_tx_ref;
2045 justice_tx_ref.datalen = *((uint32_t*)justice_tx);
2046 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2047 memcpy(justice_tx_ref.data, (uint8_t*)(justice_tx + 4), justice_tx_ref.datalen);
2048 justice_tx_ref.data_is_owned = true;
2049 unsigned char per_commitment_key_arr[32];
2050 CHECK(*((uint32_t*)per_commitment_key) == 32);
2051 memcpy(per_commitment_key_arr, (uint8_t*)(per_commitment_key + 4), 32);
2052 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2053 LDKHTLCOutputInCommitment htlc_conv;
2054 htlc_conv.inner = (void*)(htlc & (~1));
2055 htlc_conv.is_owned = false;
2056 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2057 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2058 return (long)ret_conv;
2061 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) {
2062 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2063 LDKTransaction htlc_tx_ref;
2064 htlc_tx_ref.datalen = *((uint32_t*)htlc_tx);
2065 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2066 memcpy(htlc_tx_ref.data, (uint8_t*)(htlc_tx + 4), htlc_tx_ref.datalen);
2067 htlc_tx_ref.data_is_owned = true;
2068 LDKPublicKey per_commitment_point_ref;
2069 CHECK(*((uint32_t*)per_commitment_point) == 33);
2070 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
2071 LDKHTLCOutputInCommitment htlc_conv;
2072 htlc_conv.inner = (void*)(htlc & (~1));
2073 htlc_conv.is_owned = false;
2074 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2075 *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);
2076 return (long)ret_conv;
2079 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
2080 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2081 LDKTransaction closing_tx_ref;
2082 closing_tx_ref.datalen = *((uint32_t*)closing_tx);
2083 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2084 memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
2085 closing_tx_ref.data_is_owned = true;
2086 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2087 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2088 return (long)ret_conv;
2091 uint32_t __attribute__((visibility("default"))) TS_Sign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) {
2092 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2093 LDKUnsignedChannelAnnouncement msg_conv;
2094 msg_conv.inner = (void*)(msg & (~1));
2095 msg_conv.is_owned = false;
2096 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2097 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2098 return (long)ret_conv;
2101 void __attribute__((visibility("default"))) TS_Sign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) {
2102 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2103 LDKChannelTransactionParameters channel_parameters_conv;
2104 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2105 channel_parameters_conv.is_owned = false;
2106 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2109 int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) {
2110 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2111 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2112 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2113 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2114 CVec_u8Z_free(ret_var);
2118 LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) {
2119 if (this_arg->set_pubkeys != NULL)
2120 this_arg->set_pubkeys(this_arg);
2121 return this_arg->pubkeys;
2123 uint32_t __attribute__((visibility("default"))) TS_Sign_get_pubkeys(uint32_t this_arg) {
2124 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2125 LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv);
2126 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2127 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2128 long ret_ref = (long)ret_var.inner;
2129 if (ret_var.is_owned) {
2135 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
2136 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2137 LDKThirtyTwoBytes a_ref;
2138 CHECK(*((uint32_t*)a) == 32);
2139 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2141 LDKChannelMonitor b_conv;
2142 b_conv.inner = (void*)(b & (~1));
2143 b_conv.is_owned = (b & 1) || (b == 0);
2144 b_conv = ChannelMonitor_clone(&b_conv);
2148 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_a(uint32_t ptr) {
2149 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2150 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2151 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2154 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelMonitorZ_get_b(uint32_t ptr) {
2155 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2156 LDKChannelMonitor b_var = tuple->b;
2157 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2158 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2159 long b_ref = (long)b_var.inner & ~1;
2162 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
2163 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
2165 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint32_t arg) {
2166 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2167 CHECK(val->result_ok);
2168 long res_ref = (long)(&(*val->contents.result)) | 1;
2171 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint32_t arg) {
2172 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
2173 CHECK(!val->result_ok);
2174 LDKDecodeError err_var = (*val->contents.err);
2175 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2176 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2177 long err_ref = (long)err_var.inner & ~1;
2180 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_result_ok(uint32_t arg) {
2181 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2183 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_ok(uint32_t arg) {
2184 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2185 CHECK(val->result_ok);
2186 long res_ref = ((long)&(*val->contents.result)) | 1;
2187 return (long)res_ref;
2189 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TxOutAccessErrorZ_get_err(uint32_t arg) {
2190 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
2191 CHECK(!val->result_ok);
2192 uint32_t err_conv = LDKAccessError_to_js((*val->contents.err));
2195 uint32_t __attribute__((visibility("default"))) TS_LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(uint32_t ptr) {
2196 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2198 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
2199 long some_ref = (long)(&obj->some) | 1;
2200 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - Some */; (void) some_ref;
2202 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
2203 return 0 /* LDKCOption_C2Tuple_usizeTransactionZZ - None */;
2208 uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint32_t ptr) {
2209 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2211 case LDKAPIError_APIMisuseError: {
2212 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2213 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2214 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2215 return 0 /* LDKAPIError - APIMisuseError */; (void) err_arr;
2217 case LDKAPIError_FeeRateTooHigh: {
2218 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2219 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2220 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2221 return 0 /* LDKAPIError - FeeRateTooHigh */; (void) err_arr; (void) obj->fee_rate_too_high.feerate;
2223 case LDKAPIError_RouteError: {
2224 LDKStr err_str = obj->route_error.err;
2225 jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
2226 return 0 /* LDKAPIError - RouteError */; (void) err_conv;
2228 case LDKAPIError_ChannelUnavailable: {
2229 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2230 int8_tArray err_arr = init_arr(err_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2231 memcpy((uint8_t*)(err_arr + 4), err_var.data, err_var.datalen);
2232 return 0 /* LDKAPIError - ChannelUnavailable */; (void) err_arr;
2234 case LDKAPIError_MonitorUpdateFailed: {
2235 return 0 /* LDKAPIError - MonitorUpdateFailed */;
2240 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_result_ok(uint32_t arg) {
2241 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2243 void __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_ok(uint32_t arg) {
2244 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2245 CHECK(val->result_ok);
2246 return *val->contents.result;
2248 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get_err(uint32_t arg) {
2249 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2250 CHECK(!val->result_ok);
2251 long err_ref = ((long)&(*val->contents.err)) | 1;
2254 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) {
2255 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2256 ret->datalen = *((uint32_t*)elems);
2257 if (ret->datalen == 0) {
2260 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2261 uint32_t *java_elems = (uint32_t*)(elems + 4);
2262 for (size_t i = 0; i < ret->datalen; i++) {
2263 uint32_t arr_elem = java_elems[i];
2264 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2265 FREE((void*)arr_elem);
2266 ret->data[i] = arr_elem_conv;
2271 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2272 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2273 for (size_t i = 0; i < ret.datalen; i++) {
2274 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2278 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) {
2279 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
2280 ret->datalen = *((uint32_t*)elems);
2281 if (ret->datalen == 0) {
2284 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
2285 uint32_t *java_elems = (uint32_t*)(elems + 4);
2286 for (size_t i = 0; i < ret->datalen; i++) {
2287 uint32_t arr_elem = java_elems[i];
2288 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
2289 FREE((void*)arr_elem);
2290 ret->data[i] = arr_elem_conv;
2295 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2296 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2297 for (size_t i = 0; i < ret.datalen; i++) {
2298 ret.data[i] = APIError_clone(&orig->data[i]);
2302 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) {
2303 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2304 ret->datalen = *((uint32_t*)elems);
2305 if (ret->datalen == 0) {
2308 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2309 uint32_t *java_elems = (uint32_t*)(elems + 4);
2310 for (size_t i = 0; i < ret->datalen; i++) {
2311 uint32_t arr_elem = java_elems[i];
2312 LDKChannelDetails arr_elem_conv;
2313 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2314 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2315 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2316 ret->data[i] = arr_elem_conv;
2321 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2322 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2323 for (size_t i = 0; i < ret.datalen; i++) {
2324 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2328 uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) {
2329 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
2331 case LDKPaymentSendFailure_ParameterError: {
2332 long parameter_error_ref = ((long)&obj->parameter_error) | 1;
2333 return 0 /* LDKPaymentSendFailure - ParameterError */; (void) parameter_error_ref;
2335 case LDKPaymentSendFailure_PathParameterError: {
2336 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
2337 uint32_tArray path_parameter_error_arr = init_arr(path_parameter_error_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2338 uint32_t *path_parameter_error_arr_ptr = (uint32_t*)(path_parameter_error_arr + 4);
2339 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
2340 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2341 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
2342 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
2343 path_parameter_error_arr_ptr[w] = (long)path_parameter_error_conv_22_conv;
2345 return 0 /* LDKPaymentSendFailure - PathParameterError */; (void) path_parameter_error_arr;
2347 case LDKPaymentSendFailure_AllFailedRetrySafe: {
2348 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
2349 uint32_tArray all_failed_retry_safe_arr = init_arr(all_failed_retry_safe_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2350 uint32_t *all_failed_retry_safe_arr_ptr = (uint32_t*)(all_failed_retry_safe_arr + 4);
2351 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
2352 long all_failed_retry_safe_conv_10_ref = ((long)&all_failed_retry_safe_var.data[k]) | 1;
2353 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
2355 return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; (void) all_failed_retry_safe_arr;
2357 case LDKPaymentSendFailure_PartialFailure: {
2358 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
2359 uint32_tArray partial_failure_arr = init_arr(partial_failure_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2360 uint32_t *partial_failure_arr_ptr = (uint32_t*)(partial_failure_arr + 4);
2361 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
2362 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2363 *partial_failure_conv_22_conv = partial_failure_var.data[w];
2364 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
2365 partial_failure_arr_ptr[w] = (long)partial_failure_conv_22_conv;
2367 return 0 /* LDKPaymentSendFailure - PartialFailure */; (void) partial_failure_arr;
2372 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) {
2373 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2375 void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_ok(uint32_t arg) {
2376 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2377 CHECK(val->result_ok);
2378 return *val->contents.result;
2380 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) {
2381 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2382 CHECK(!val->result_ok);
2383 long err_ref = ((long)&(*val->contents.err)) | 1;
2386 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) {
2387 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2388 ret->datalen = *((uint32_t*)elems);
2389 if (ret->datalen == 0) {
2392 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2393 uint32_t *java_elems = (uint32_t*)(elems + 4);
2394 for (size_t i = 0; i < ret->datalen; i++) {
2395 uint32_t arr_elem = java_elems[i];
2396 LDKChannelMonitor arr_elem_conv;
2397 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2398 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2399 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2400 ret->data[i] = arr_elem_conv;
2405 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2406 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2407 for (size_t i = 0; i < ret.datalen; i++) {
2408 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2412 typedef struct LDKWatch_JCalls {
2413 atomic_size_t refcnt;
2414 uint32_t watch_channel_meth;
2415 uint32_t update_channel_meth;
2416 uint32_t release_pending_monitor_events_meth;
2418 static void LDKWatch_JCalls_free(void* this_arg) {
2419 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2420 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2421 js_free(j_calls->watch_channel_meth);
2422 js_free(j_calls->update_channel_meth);
2423 js_free(j_calls->release_pending_monitor_events_meth);
2427 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2428 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2429 LDKOutPoint funding_txo_var = funding_txo;
2430 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2431 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2432 long funding_txo_ref = (long)funding_txo_var.inner;
2433 if (funding_txo_var.is_owned) {
2434 funding_txo_ref |= 1;
2436 LDKChannelMonitor monitor_var = monitor;
2437 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2438 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2439 long monitor_ref = (long)monitor_var.inner;
2440 if (monitor_var.is_owned) {
2443 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2444 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2445 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2448 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2449 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2450 LDKOutPoint funding_txo_var = funding_txo;
2451 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2452 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2453 long funding_txo_ref = (long)funding_txo_var.inner;
2454 if (funding_txo_var.is_owned) {
2455 funding_txo_ref |= 1;
2457 LDKChannelMonitorUpdate update_var = update;
2458 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2459 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2460 long update_ref = (long)update_var.inner;
2461 if (update_var.is_owned) {
2464 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
2465 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2466 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2469 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
2470 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2471 uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth);
2472 LDKCVec_MonitorEventZ ret_constr;
2473 ret_constr.datalen = *((uint32_t*)ret);
2474 if (ret_constr.datalen > 0)
2475 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2477 ret_constr.data = NULL;
2478 uint32_t* ret_vals = (uint32_t*)(ret + 4);
2479 for (size_t o = 0; o < ret_constr.datalen; o++) {
2480 uint32_t ret_conv_14 = ret_vals[o];
2481 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
2482 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14);
2483 ret_constr.data[o] = ret_conv_14_conv;
2487 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2488 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2489 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2490 return (void*) this_arg;
2492 static inline LDKWatch LDKWatch_init (/*TODO: JS Object Reference */void* o) {
2493 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2494 atomic_init(&calls->refcnt, 1);
2495 //TODO: Assign calls->o from o
2498 .this_arg = (void*) calls,
2499 .watch_channel = watch_channel_LDKWatch_jcall,
2500 .update_channel = update_channel_LDKWatch_jcall,
2501 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
2502 .free = LDKWatch_JCalls_free,
2506 long __attribute__((visibility("default"))) TS_LDKWatch_new(/*TODO: JS Object Reference */void* o) {
2507 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2508 *res_ptr = LDKWatch_init(o);
2509 return (long)res_ptr;
2511 uint32_t __attribute__((visibility("default"))) TS_Watch_watch_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t monitor) {
2512 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2513 LDKOutPoint funding_txo_conv;
2514 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2515 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2516 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2517 LDKChannelMonitor monitor_conv;
2518 monitor_conv.inner = (void*)(monitor & (~1));
2519 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2520 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2521 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2522 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2523 return (long)ret_conv;
2526 uint32_t __attribute__((visibility("default"))) TS_Watch_update_channel(uint32_t this_arg, uint32_t funding_txo, uint32_t update) {
2527 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2528 LDKOutPoint funding_txo_conv;
2529 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2530 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2531 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2532 LDKChannelMonitorUpdate update_conv;
2533 update_conv.inner = (void*)(update & (~1));
2534 update_conv.is_owned = (update & 1) || (update == 0);
2535 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2536 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2537 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2538 return (long)ret_conv;
2541 uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_monitor_events(uint32_t this_arg) {
2542 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
2543 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2544 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
2545 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
2546 for (size_t o = 0; o < ret_var.datalen; o++) {
2547 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2548 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
2549 long ret_conv_14_ref = (long)ret_conv_14_copy;
2550 ret_arr_ptr[o] = ret_conv_14_ref;
2556 typedef struct LDKBroadcasterInterface_JCalls {
2557 atomic_size_t refcnt;
2558 uint32_t broadcast_transaction_meth;
2559 } LDKBroadcasterInterface_JCalls;
2560 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2561 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2562 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2563 js_free(j_calls->broadcast_transaction_meth);
2567 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
2568 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2569 LDKTransaction tx_var = tx;
2570 int8_tArray tx_arr = init_arr(tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2571 memcpy((uint8_t*)(tx_arr + 4), tx_var.data, tx_var.datalen);
2572 Transaction_free(tx_var);
2573 js_invoke_function_1(j_calls->broadcast_transaction_meth, tx_arr);
2575 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2576 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2577 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2578 return (void*) this_arg;
2580 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (/*TODO: JS Object Reference */void* o) {
2581 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2582 atomic_init(&calls->refcnt, 1);
2583 //TODO: Assign calls->o from o
2585 LDKBroadcasterInterface ret = {
2586 .this_arg = (void*) calls,
2587 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
2588 .free = LDKBroadcasterInterface_JCalls_free,
2592 long __attribute__((visibility("default"))) TS_LDKBroadcasterInterface_new(/*TODO: JS Object Reference */void* o) {
2593 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2594 *res_ptr = LDKBroadcasterInterface_init(o);
2595 return (long)res_ptr;
2597 void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_transaction(uint32_t this_arg, int8_tArray tx) {
2598 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
2599 LDKTransaction tx_ref;
2600 tx_ref.datalen = *((uint32_t*)tx);
2601 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2602 memcpy(tx_ref.data, (uint8_t*)(tx + 4), tx_ref.datalen);
2603 tx_ref.data_is_owned = true;
2604 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2607 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) {
2608 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2610 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
2611 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2612 CHECK(val->result_ok);
2613 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2614 *ret = Sign_clone(&(*val->contents.result));
2617 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
2618 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2619 CHECK(!val->result_ok);
2620 LDKDecodeError err_var = (*val->contents.err);
2621 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2622 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2623 long err_ref = (long)err_var.inner & ~1;
2626 typedef struct LDKKeysInterface_JCalls {
2627 atomic_size_t refcnt;
2628 uint32_t get_node_secret_meth;
2629 uint32_t get_destination_script_meth;
2630 uint32_t get_shutdown_pubkey_meth;
2631 uint32_t get_channel_signer_meth;
2632 uint32_t get_secure_random_bytes_meth;
2633 uint32_t read_chan_signer_meth;
2634 } LDKKeysInterface_JCalls;
2635 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2636 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2637 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2638 js_free(j_calls->get_node_secret_meth);
2639 js_free(j_calls->get_destination_script_meth);
2640 js_free(j_calls->get_shutdown_pubkey_meth);
2641 js_free(j_calls->get_channel_signer_meth);
2642 js_free(j_calls->get_secure_random_bytes_meth);
2643 js_free(j_calls->read_chan_signer_meth);
2647 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
2648 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2649 int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth);
2650 LDKSecretKey ret_ref;
2651 CHECK(*((uint32_t*)ret) == 32);
2652 memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32);
2655 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
2656 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2657 int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth);
2658 LDKCVec_u8Z ret_ref;
2659 ret_ref.datalen = *((uint32_t*)ret);
2660 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2661 memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
2664 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
2665 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2666 int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth);
2667 LDKPublicKey ret_ref;
2668 CHECK(*((uint32_t*)ret) == 33);
2669 memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33);
2672 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2673 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2674 LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
2675 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
2676 ret_conv = Sign_clone(ret);
2679 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
2680 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2681 int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth);
2682 LDKThirtyTwoBytes ret_ref;
2683 CHECK(*((uint32_t*)ret) == 32);
2684 memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
2687 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
2688 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2689 LDKu8slice reader_var = reader;
2690 int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2691 memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen);
2692 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
2693 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
2694 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret);
2697 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2698 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2699 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2700 return (void*) this_arg;
2702 static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Reference */void* o) {
2703 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2704 atomic_init(&calls->refcnt, 1);
2705 //TODO: Assign calls->o from o
2707 LDKKeysInterface ret = {
2708 .this_arg = (void*) calls,
2709 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
2710 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
2711 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
2712 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
2713 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
2714 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
2715 .free = LDKKeysInterface_JCalls_free,
2719 long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS Object Reference */void* o) {
2720 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2721 *res_ptr = LDKKeysInterface_init(o);
2722 return (long)res_ptr;
2724 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) {
2725 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2726 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2727 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32);
2731 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) {
2732 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2733 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2734 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2735 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
2736 CVec_u8Z_free(ret_var);
2740 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
2741 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2742 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
2743 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33);
2747 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2748 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2749 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2750 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2754 int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
2755 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2756 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2757 memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
2761 uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) {
2762 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
2763 LDKu8slice reader_ref;
2764 reader_ref.datalen = *((uint32_t*)reader);
2765 reader_ref.data = (int8_t*)(reader + 4);
2766 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
2767 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2768 return (long)ret_conv;
2771 typedef struct LDKFeeEstimator_JCalls {
2772 atomic_size_t refcnt;
2773 uint32_t get_est_sat_per_1000_weight_meth;
2774 } LDKFeeEstimator_JCalls;
2775 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2776 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2777 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2778 js_free(j_calls->get_est_sat_per_1000_weight_meth);
2782 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2783 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2784 uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
2785 return js_invoke_function_1(j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2787 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2788 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2789 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2790 return (void*) this_arg;
2792 static inline LDKFeeEstimator LDKFeeEstimator_init (/*TODO: JS Object Reference */void* o) {
2793 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2794 atomic_init(&calls->refcnt, 1);
2795 //TODO: Assign calls->o from o
2797 LDKFeeEstimator ret = {
2798 .this_arg = (void*) calls,
2799 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
2800 .free = LDKFeeEstimator_JCalls_free,
2804 long __attribute__((visibility("default"))) TS_LDKFeeEstimator_new(/*TODO: JS Object Reference */void* o) {
2805 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2806 *res_ptr = LDKFeeEstimator_init(o);
2807 return (long)res_ptr;
2809 int32_t __attribute__((visibility("default"))) TS_FeeEstimator_get_est_sat_per_1000_weight(uint32_t this_arg, uint32_t confirmation_target) {
2810 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
2811 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
2812 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2816 typedef struct LDKLogger_JCalls {
2817 atomic_size_t refcnt;
2820 static void LDKLogger_JCalls_free(void* this_arg) {
2821 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2822 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2823 js_free(j_calls->log_meth);
2827 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
2828 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2829 const char* record_str = record;
2830 jstring record_conv = str_ref_to_ts(record_str, strlen(record_str));
2831 js_invoke_function_1(j_calls->log_meth, record_conv);
2833 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2834 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2835 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2836 return (void*) this_arg;
2838 static inline LDKLogger LDKLogger_init (/*TODO: JS Object Reference */void* o) {
2839 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2840 atomic_init(&calls->refcnt, 1);
2841 //TODO: Assign calls->o from o
2844 .this_arg = (void*) calls,
2845 .log = log_LDKLogger_jcall,
2846 .free = LDKLogger_JCalls_free,
2850 long __attribute__((visibility("default"))) TS_LDKLogger_new(/*TODO: JS Object Reference */void* o) {
2851 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2852 *res_ptr = LDKLogger_init(o);
2853 return (long)res_ptr;
2855 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
2856 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2857 LDKThirtyTwoBytes a_ref;
2858 CHECK(*((uint32_t*)a) == 32);
2859 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
2861 LDKChannelManager b_conv;
2862 b_conv.inner = (void*)(b & (~1));
2863 b_conv.is_owned = (b & 1) || (b == 0);
2864 // Warning: we need a move here but no clone is available for LDKChannelManager
2868 int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_a(uint32_t ptr) {
2869 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2870 int8_tArray a_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
2871 memcpy((uint8_t*)(a_arr + 4), tuple->a.data, 32);
2874 uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_BlockHashChannelManagerZ_get_b(uint32_t ptr) {
2875 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2876 LDKChannelManager b_var = tuple->b;
2877 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2878 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2879 long b_ref = (long)b_var.inner & ~1;
2882 jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_result_ok(uint32_t arg) {
2883 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2885 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint32_t arg) {
2886 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2887 CHECK(val->result_ok);
2888 long res_ref = (long)(&(*val->contents.result)) | 1;
2891 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint32_t arg) {
2892 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2893 CHECK(!val->result_ok);
2894 LDKDecodeError err_var = (*val->contents.err);
2895 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2896 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2897 long err_ref = (long)err_var.inner & ~1;
2900 jboolean __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(uint32_t arg) {
2901 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2903 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint32_t arg) {
2904 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2905 CHECK(val->result_ok);
2906 long res_ref = ((long)&(*val->contents.result)) | 1;
2909 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint32_t arg) {
2910 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2911 CHECK(!val->result_ok);
2912 LDKDecodeError err_var = (*val->contents.err);
2913 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2914 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2915 long err_ref = (long)err_var.inner & ~1;
2918 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2919 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2920 for (size_t i = 0; i < ret.datalen; i++) {
2921 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2925 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) {
2926 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2928 ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) {
2929 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2930 CHECK(val->result_ok);
2931 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2932 ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
2933 int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4);
2934 for (size_t m = 0; m < res_var.datalen; m++) {
2935 LDKCVec_u8Z res_conv_12_var = res_var.data[m];
2936 int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
2937 memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen);
2938 res_arr_ptr[m] = res_conv_12_arr;
2942 void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) {
2943 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2944 CHECK(!val->result_ok);
2945 return *val->contents.err;
2947 jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) {
2948 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2950 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) {
2951 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2952 CHECK(val->result_ok);
2953 LDKInMemorySigner res_var = (*val->contents.result);
2954 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2955 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2956 long res_ref = (long)res_var.inner & ~1;
2959 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) {
2960 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2961 CHECK(!val->result_ok);
2962 LDKDecodeError err_var = (*val->contents.err);
2963 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2964 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2965 long err_ref = (long)err_var.inner & ~1;
2968 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) {
2969 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2970 ret->datalen = *((uint32_t*)elems);
2971 if (ret->datalen == 0) {
2974 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2975 uint32_t *java_elems = (uint32_t*)(elems + 4);
2976 for (size_t i = 0; i < ret->datalen; i++) {
2977 uint32_t arr_elem = java_elems[i];
2978 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2979 FREE((void*)arr_elem);
2980 ret->data[i] = arr_elem_conv;
2985 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2986 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2987 for (size_t i = 0; i < ret.datalen; i++) {
2988 ret.data[i] = TxOut_clone(&orig->data[i]);
2992 jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) {
2993 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2995 int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) {
2996 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2997 CHECK(val->result_ok);
2998 LDKTransaction res_var = (*val->contents.result);
2999 int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
3000 memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen);
3003 void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) {
3004 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3005 CHECK(!val->result_ok);
3006 return *val->contents.err;
3008 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) {
3009 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3010 ret->datalen = *((uint32_t*)elems);
3011 if (ret->datalen == 0) {
3014 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3015 uint32_t *java_elems = (uint32_t*)(elems + 4);
3016 for (size_t i = 0; i < ret->datalen; i++) {
3017 uint32_t arr_elem = java_elems[i];
3018 LDKRouteHop arr_elem_conv;
3019 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3020 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3021 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3022 ret->data[i] = arr_elem_conv;
3027 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3028 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3029 for (size_t i = 0; i < ret.datalen; i++) {
3030 ret.data[i] = RouteHop_clone(&orig->data[i]);
3034 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3035 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3036 for (size_t i = 0; i < ret.datalen; i++) {
3037 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3041 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_result_ok(uint32_t arg) {
3042 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3044 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_ok(uint32_t arg) {
3045 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3046 CHECK(val->result_ok);
3047 LDKRoute res_var = (*val->contents.result);
3048 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3049 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3050 long res_ref = (long)res_var.inner & ~1;
3053 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteDecodeErrorZ_get_err(uint32_t arg) {
3054 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3055 CHECK(!val->result_ok);
3056 LDKDecodeError err_var = (*val->contents.err);
3057 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3058 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3059 long err_ref = (long)err_var.inner & ~1;
3062 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHintZ_new(uint32_tArray elems) {
3063 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3064 ret->datalen = *((uint32_t*)elems);
3065 if (ret->datalen == 0) {
3068 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3069 uint32_t *java_elems = (uint32_t*)(elems + 4);
3070 for (size_t i = 0; i < ret->datalen; i++) {
3071 uint32_t arr_elem = java_elems[i];
3072 LDKRouteHint arr_elem_conv;
3073 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3074 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3075 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3076 ret->data[i] = arr_elem_conv;
3081 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3082 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3083 for (size_t i = 0; i < ret.datalen; i++) {
3084 ret.data[i] = RouteHint_clone(&orig->data[i]);
3088 jboolean __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_result_ok(uint32_t arg) {
3089 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3091 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_ok(uint32_t arg) {
3092 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3093 CHECK(val->result_ok);
3094 LDKRoute res_var = (*val->contents.result);
3095 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3096 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3097 long res_ref = (long)res_var.inner & ~1;
3100 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RouteLightningErrorZ_get_err(uint32_t arg) {
3101 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3102 CHECK(!val->result_ok);
3103 LDKLightningError err_var = (*val->contents.err);
3104 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3105 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3106 long err_ref = (long)err_var.inner & ~1;
3109 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) {
3110 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
3112 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_ok(uint32_t arg) {
3113 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3114 CHECK(val->result_ok);
3115 long res_ref = ((long)&(*val->contents.result)) | 1;
3118 int8_t __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_get_err(uint32_t arg) {
3119 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
3120 CHECK(!val->result_ok);
3121 return *val->contents.err;
3123 jboolean __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_result_ok(uint32_t arg) {
3124 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
3126 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_ok(uint32_t arg) {
3127 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3128 CHECK(val->result_ok);
3129 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
3130 *res_conv = (*val->contents.result);
3131 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
3132 return (long)res_conv;
3134 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CResult_NetAddressu8ZDecodeErrorZ_get_err(uint32_t arg) {
3135 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
3136 CHECK(!val->result_ok);
3137 LDKDecodeError err_var = (*val->contents.err);
3138 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3139 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3140 long err_ref = (long)err_var.inner & ~1;
3143 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateAddHTLCZ_new(uint32_tArray elems) {
3144 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
3145 ret->datalen = *((uint32_t*)elems);
3146 if (ret->datalen == 0) {
3149 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
3150 uint32_t *java_elems = (uint32_t*)(elems + 4);
3151 for (size_t i = 0; i < ret->datalen; i++) {
3152 uint32_t arr_elem = java_elems[i];
3153 LDKUpdateAddHTLC arr_elem_conv;
3154 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3155 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3156 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3157 ret->data[i] = arr_elem_conv;
3162 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3163 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3164 for (size_t i = 0; i < ret.datalen; i++) {
3165 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3169 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFulfillHTLCZ_new(uint32_tArray elems) {
3170 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3171 ret->datalen = *((uint32_t*)elems);
3172 if (ret->datalen == 0) {
3175 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3176 uint32_t *java_elems = (uint32_t*)(elems + 4);
3177 for (size_t i = 0; i < ret->datalen; i++) {
3178 uint32_t arr_elem = java_elems[i];
3179 LDKUpdateFulfillHTLC arr_elem_conv;
3180 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3181 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3182 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3183 ret->data[i] = arr_elem_conv;
3188 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3189 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3190 for (size_t i = 0; i < ret.datalen; i++) {
3191 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3195 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailHTLCZ_new(uint32_tArray elems) {
3196 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3197 ret->datalen = *((uint32_t*)elems);
3198 if (ret->datalen == 0) {
3201 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3202 uint32_t *java_elems = (uint32_t*)(elems + 4);
3203 for (size_t i = 0; i < ret->datalen; i++) {
3204 uint32_t arr_elem = java_elems[i];
3205 LDKUpdateFailHTLC arr_elem_conv;
3206 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3207 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3208 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3209 ret->data[i] = arr_elem_conv;
3214 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3215 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3216 for (size_t i = 0; i < ret.datalen; i++) {
3217 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3221 uint32_t __attribute__((visibility("default"))) TS_LDKCVec_UpdateFailMalformedHTLCZ_new(uint32_tArray elems) {
3222 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3223 ret->datalen = *((uint32_t*)elems);
3224 if (ret->datalen == 0) {
3227 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3228 uint32_t *java_elems = (uint32_t*)(elems + 4);
3229 for (size_t i = 0; i < ret->datalen; i++) {
3230 uint32_t arr_elem = java_elems[i];
3231 LDKUpdateFailMalformedHTLC arr_elem_conv;
3232 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3233 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3234 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3235 ret->data[i] = arr_elem_conv;
3240 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3241 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3242 for (size_t i = 0; i < ret.datalen; i++) {
3243 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3247 jboolean __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_result_ok(uint32_t arg) {
3248 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
3250 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AcceptChannelDecodeErrorZ_get_ok(uint32_t arg) {
3251 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
3252 CHECK(val->result_ok);
3253 LDKAcceptChannel 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_AcceptChannelDecodeErrorZ_get_err(uint32_t arg) {
3260 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(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_AnnouncementSignaturesDecodeErrorZ_result_ok(uint32_t arg) {
3269 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
3271 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint32_t arg) {
3272 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
3273 CHECK(val->result_ok);
3274 LDKAnnouncementSignatures 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_AnnouncementSignaturesDecodeErrorZ_get_err(uint32_t arg) {
3281 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(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_ChannelReestablishDecodeErrorZ_result_ok(uint32_t arg) {
3290 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3292 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelReestablishDecodeErrorZ_get_ok(uint32_t arg) {
3293 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3294 CHECK(val->result_ok);
3295 LDKChannelReestablish 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_ChannelReestablishDecodeErrorZ_get_err(uint32_t arg) {
3302 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(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_ClosingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3311 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
3313 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3314 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
3315 CHECK(val->result_ok);
3316 LDKClosingSigned 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_ClosingSignedDecodeErrorZ_get_err(uint32_t arg) {
3323 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(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_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
3332 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
3334 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(uint32_t arg) {
3335 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
3336 CHECK(val->result_ok);
3337 LDKCommitmentSigned 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_CommitmentSignedDecodeErrorZ_get_err(uint32_t arg) {
3344 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(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_FundingCreatedDecodeErrorZ_result_ok(uint32_t arg) {
3353 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
3355 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingCreatedDecodeErrorZ_get_ok(uint32_t arg) {
3356 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
3357 CHECK(val->result_ok);
3358 LDKFundingCreated 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_FundingCreatedDecodeErrorZ_get_err(uint32_t arg) {
3365 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(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_FundingSignedDecodeErrorZ_result_ok(uint32_t arg) {
3374 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
3376 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingSignedDecodeErrorZ_get_ok(uint32_t arg) {
3377 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
3378 CHECK(val->result_ok);
3379 LDKFundingSigned 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_FundingSignedDecodeErrorZ_get_err(uint32_t arg) {
3386 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(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_FundingLockedDecodeErrorZ_result_ok(uint32_t arg) {
3395 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
3397 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_FundingLockedDecodeErrorZ_get_ok(uint32_t arg) {
3398 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
3399 CHECK(val->result_ok);
3400 LDKFundingLocked 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_FundingLockedDecodeErrorZ_get_err(uint32_t arg) {
3407 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(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_InitDecodeErrorZ_result_ok(uint32_t arg) {
3416 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3418 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitDecodeErrorZ_get_ok(uint32_t arg) {
3419 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3420 CHECK(val->result_ok);
3421 LDKInit 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_InitDecodeErrorZ_get_err(uint32_t arg) {
3428 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(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_OpenChannelDecodeErrorZ_result_ok(uint32_t arg) {
3437 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
3439 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_OpenChannelDecodeErrorZ_get_ok(uint32_t arg) {
3440 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
3441 CHECK(val->result_ok);
3442 LDKOpenChannel 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_OpenChannelDecodeErrorZ_get_err(uint32_t arg) {
3449 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(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_RevokeAndACKDecodeErrorZ_result_ok(uint32_t arg) {
3458 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
3460 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(uint32_t arg) {
3461 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
3462 CHECK(val->result_ok);
3463 LDKRevokeAndACK 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_RevokeAndACKDecodeErrorZ_get_err(uint32_t arg) {
3470 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(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_ShutdownDecodeErrorZ_result_ok(uint32_t arg) {
3479 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
3481 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ShutdownDecodeErrorZ_get_ok(uint32_t arg) {
3482 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
3483 CHECK(val->result_ok);
3484 LDKShutdown 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_ShutdownDecodeErrorZ_get_err(uint32_t arg) {
3491 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(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_UpdateFailHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3500 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
3502 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3503 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
3504 CHECK(val->result_ok);
3505 LDKUpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ_get_err(uint32_t arg) {
3512 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(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_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3521 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
3523 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3524 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
3525 CHECK(val->result_ok);
3526 LDKUpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint32_t arg) {
3533 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(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_UpdateFeeDecodeErrorZ_result_ok(uint32_t arg) {
3542 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
3544 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFeeDecodeErrorZ_get_ok(uint32_t arg) {
3545 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
3546 CHECK(val->result_ok);
3547 LDKUpdateFee 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_UpdateFeeDecodeErrorZ_get_err(uint32_t arg) {
3554 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(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_UpdateFulfillHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3563 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
3565 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3566 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
3567 CHECK(val->result_ok);
3568 LDKUpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ_get_err(uint32_t arg) {
3575 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(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_UpdateAddHTLCDecodeErrorZ_result_ok(uint32_t arg) {
3584 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
3586 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint32_t arg) {
3587 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
3588 CHECK(val->result_ok);
3589 LDKUpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ_get_err(uint32_t arg) {
3596 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(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_PingDecodeErrorZ_result_ok(uint32_t arg) {
3605 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3607 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PingDecodeErrorZ_get_ok(uint32_t arg) {
3608 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3609 CHECK(val->result_ok);
3610 LDKPing 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_PingDecodeErrorZ_get_err(uint32_t arg) {
3617 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(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_PongDecodeErrorZ_result_ok(uint32_t arg) {
3626 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3628 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PongDecodeErrorZ_get_ok(uint32_t arg) {
3629 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3630 CHECK(val->result_ok);
3631 LDKPong 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_PongDecodeErrorZ_get_err(uint32_t arg) {
3638 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(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_UnsignedChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3647 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3649 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3650 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3651 CHECK(val->result_ok);
3652 LDKUnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3659 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(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_ChannelAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3668 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3670 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3671 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3672 CHECK(val->result_ok);
3673 LDKChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3680 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(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 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3689 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3691 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3692 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3693 CHECK(val->result_ok);
3694 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3695 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3696 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3697 long res_ref = (long)res_var.inner & ~1;
3700 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3701 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3702 CHECK(!val->result_ok);
3703 LDKDecodeError err_var = (*val->contents.err);
3704 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3705 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3706 long err_ref = (long)err_var.inner & ~1;
3709 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(uint32_t arg) {
3710 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
3712 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(uint32_t arg) {
3713 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3714 CHECK(val->result_ok);
3715 LDKChannelUpdate res_var = (*val->contents.result);
3716 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3717 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3718 long res_ref = (long)res_var.inner & ~1;
3721 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelUpdateDecodeErrorZ_get_err(uint32_t arg) {
3722 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
3723 CHECK(!val->result_ok);
3724 LDKDecodeError err_var = (*val->contents.err);
3725 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3726 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3727 long err_ref = (long)err_var.inner & ~1;
3730 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_result_ok(uint32_t arg) {
3731 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3733 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_ok(uint32_t arg) {
3734 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3735 CHECK(val->result_ok);
3736 LDKErrorMessage res_var = (*val->contents.result);
3737 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3738 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3739 long res_ref = (long)res_var.inner & ~1;
3742 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ErrorMessageDecodeErrorZ_get_err(uint32_t arg) {
3743 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3744 CHECK(!val->result_ok);
3745 LDKDecodeError err_var = (*val->contents.err);
3746 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3747 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3748 long err_ref = (long)err_var.inner & ~1;
3751 jboolean __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3752 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3754 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3755 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3756 CHECK(val->result_ok);
3757 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3758 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3759 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3760 long res_ref = (long)res_var.inner & ~1;
3763 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3764 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3765 CHECK(!val->result_ok);
3766 LDKDecodeError err_var = (*val->contents.err);
3767 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3768 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3769 long err_ref = (long)err_var.inner & ~1;
3772 jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(uint32_t arg) {
3773 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3775 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(uint32_t arg) {
3776 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3777 CHECK(val->result_ok);
3778 LDKNodeAnnouncement res_var = (*val->contents.result);
3779 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3780 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3781 long res_ref = (long)res_var.inner & ~1;
3784 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(uint32_t arg) {
3785 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
3786 CHECK(!val->result_ok);
3787 LDKDecodeError err_var = (*val->contents.err);
3788 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3789 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3790 long err_ref = (long)err_var.inner & ~1;
3793 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_result_ok(uint32_t arg) {
3794 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3796 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint32_t arg) {
3797 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3798 CHECK(val->result_ok);
3799 LDKQueryShortChannelIds res_var = (*val->contents.result);
3800 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3801 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3802 long res_ref = (long)res_var.inner & ~1;
3805 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint32_t arg) {
3806 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3807 CHECK(!val->result_ok);
3808 LDKDecodeError err_var = (*val->contents.err);
3809 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3810 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3811 long err_ref = (long)err_var.inner & ~1;
3814 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_result_ok(uint32_t arg) {
3815 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3817 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint32_t arg) {
3818 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3819 CHECK(val->result_ok);
3820 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3821 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3822 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3823 long res_ref = (long)res_var.inner & ~1;
3826 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint32_t arg) {
3827 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3828 CHECK(!val->result_ok);
3829 LDKDecodeError err_var = (*val->contents.err);
3830 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3831 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3832 long err_ref = (long)err_var.inner & ~1;
3835 jboolean __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3836 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3838 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3839 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3840 CHECK(val->result_ok);
3841 LDKQueryChannelRange res_var = (*val->contents.result);
3842 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3843 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3844 long res_ref = (long)res_var.inner & ~1;
3847 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_QueryChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3848 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3849 CHECK(!val->result_ok);
3850 LDKDecodeError err_var = (*val->contents.err);
3851 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3852 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3853 long err_ref = (long)err_var.inner & ~1;
3856 jboolean __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_result_ok(uint32_t arg) {
3857 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3859 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint32_t arg) {
3860 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3861 CHECK(val->result_ok);
3862 LDKReplyChannelRange res_var = (*val->contents.result);
3863 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3864 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3865 long res_ref = (long)res_var.inner & ~1;
3868 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ReplyChannelRangeDecodeErrorZ_get_err(uint32_t arg) {
3869 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3870 CHECK(!val->result_ok);
3871 LDKDecodeError err_var = (*val->contents.err);
3872 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3873 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3874 long err_ref = (long)err_var.inner & ~1;
3877 jboolean __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_result_ok(uint32_t arg) {
3878 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3880 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint32_t arg) {
3881 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3882 CHECK(val->result_ok);
3883 LDKGossipTimestampFilter res_var = (*val->contents.result);
3884 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3885 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3886 long res_ref = (long)res_var.inner & ~1;
3889 uint32_t __attribute__((visibility("default"))) TS_LDKCResult_GossipTimestampFilterDecodeErrorZ_get_err(uint32_t arg) {
3890 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3891 CHECK(!val->result_ok);
3892 LDKDecodeError err_var = (*val->contents.err);
3893 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3894 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3895 long err_ref = (long)err_var.inner & ~1;
3898 typedef struct LDKMessageSendEventsProvider_JCalls {
3899 atomic_size_t refcnt;
3900 uint32_t get_and_clear_pending_msg_events_meth;
3901 } LDKMessageSendEventsProvider_JCalls;
3902 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3903 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3904 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3905 js_free(j_calls->get_and_clear_pending_msg_events_meth);
3909 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
3910 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3911 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth);
3912 LDKCVec_MessageSendEventZ ret_constr;
3913 ret_constr.datalen = *((uint32_t*)ret);
3914 if (ret_constr.datalen > 0)
3915 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3917 ret_constr.data = NULL;
3918 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3919 for (size_t s = 0; s < ret_constr.datalen; s++) {
3920 uint32_t ret_conv_18 = ret_vals[s];
3921 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
3922 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18);
3923 ret_constr.data[s] = ret_conv_18_conv;
3927 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3928 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3929 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3930 return (void*) this_arg;
3932 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3933 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3934 atomic_init(&calls->refcnt, 1);
3935 //TODO: Assign calls->o from o
3937 LDKMessageSendEventsProvider ret = {
3938 .this_arg = (void*) calls,
3939 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
3940 .free = LDKMessageSendEventsProvider_JCalls_free,
3944 long __attribute__((visibility("default"))) TS_LDKMessageSendEventsProvider_new(/*TODO: JS Object Reference */void* o) {
3945 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3946 *res_ptr = LDKMessageSendEventsProvider_init(o);
3947 return (long)res_ptr;
3949 uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvider_get_and_clear_pending_msg_events(uint32_t this_arg) {
3950 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
3951 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3952 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
3953 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
3954 for (size_t s = 0; s < ret_var.datalen; s++) {
3955 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3956 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3957 long ret_conv_18_ref = (long)ret_conv_18_copy;
3958 ret_arr_ptr[s] = ret_conv_18_ref;
3964 typedef struct LDKEventsProvider_JCalls {
3965 atomic_size_t refcnt;
3966 uint32_t get_and_clear_pending_events_meth;
3967 } LDKEventsProvider_JCalls;
3968 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3969 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3970 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3971 js_free(j_calls->get_and_clear_pending_events_meth);
3975 LDKCVec_EventZ get_and_clear_pending_events_LDKEventsProvider_jcall(const void* this_arg) {
3976 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3977 uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth);
3978 LDKCVec_EventZ ret_constr;
3979 ret_constr.datalen = *((uint32_t*)ret);
3980 if (ret_constr.datalen > 0)
3981 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3983 ret_constr.data = NULL;
3984 uint32_t* ret_vals = (uint32_t*)(ret + 4);
3985 for (size_t h = 0; h < ret_constr.datalen; h++) {
3986 uint32_t ret_conv_7 = ret_vals[h];
3987 LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1);
3988 ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7);
3989 ret_constr.data[h] = ret_conv_7_conv;
3993 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3994 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3995 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3996 return (void*) this_arg;
3998 static inline LDKEventsProvider LDKEventsProvider_init (/*TODO: JS Object Reference */void* o) {
3999 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
4000 atomic_init(&calls->refcnt, 1);
4001 //TODO: Assign calls->o from o
4003 LDKEventsProvider ret = {
4004 .this_arg = (void*) calls,
4005 .get_and_clear_pending_events = get_and_clear_pending_events_LDKEventsProvider_jcall,
4006 .free = LDKEventsProvider_JCalls_free,
4010 long __attribute__((visibility("default"))) TS_LDKEventsProvider_new(/*TODO: JS Object Reference */void* o) {
4011 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4012 *res_ptr = LDKEventsProvider_init(o);
4013 return (long)res_ptr;
4015 uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_clear_pending_events(uint32_t this_arg) {
4016 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
4017 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
4018 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
4019 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
4020 for (size_t h = 0; h < ret_var.datalen; h++) {
4021 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
4022 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
4023 long ret_conv_7_ref = (long)ret_conv_7_copy;
4024 ret_arr_ptr[h] = ret_conv_7_ref;
4030 typedef struct LDKAccess_JCalls {
4031 atomic_size_t refcnt;
4032 uint32_t get_utxo_meth;
4034 static void LDKAccess_JCalls_free(void* this_arg) {
4035 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4036 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4037 js_free(j_calls->get_utxo_meth);
4041 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
4042 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4043 int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4044 memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
4045 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4046 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
4047 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
4050 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4051 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4052 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4053 return (void*) this_arg;
4055 static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
4056 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4057 atomic_init(&calls->refcnt, 1);
4058 //TODO: Assign calls->o from o
4061 .this_arg = (void*) calls,
4062 .get_utxo = get_utxo_LDKAccess_jcall,
4063 .free = LDKAccess_JCalls_free,
4067 long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
4068 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4069 *res_ptr = LDKAccess_init(o);
4070 return (long)res_ptr;
4072 uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
4073 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
4074 unsigned char genesis_hash_arr[32];
4075 CHECK(*((uint32_t*)genesis_hash) == 32);
4076 memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
4077 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4078 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4079 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4080 return (long)ret_conv;
4083 typedef struct LDKListen_JCalls {
4084 atomic_size_t refcnt;
4085 uint32_t block_connected_meth;
4086 uint32_t block_disconnected_meth;
4088 static void LDKListen_JCalls_free(void* this_arg) {
4089 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4090 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4091 js_free(j_calls->block_connected_meth);
4092 js_free(j_calls->block_disconnected_meth);
4096 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
4097 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4098 LDKu8slice block_var = block;
4099 int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4100 memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen);
4101 js_invoke_function_2(j_calls->block_connected_meth, block_arr, height);
4103 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
4104 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4105 int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes");
4106 memcpy((uint8_t*)(header_arr + 4), *header, 80);
4107 js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height);
4109 static void* LDKListen_JCalls_clone(const void* this_arg) {
4110 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
4111 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4112 return (void*) this_arg;
4114 static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) {
4115 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
4116 atomic_init(&calls->refcnt, 1);
4117 //TODO: Assign calls->o from o
4120 .this_arg = (void*) calls,
4121 .block_connected = block_connected_LDKListen_jcall,
4122 .block_disconnected = block_disconnected_LDKListen_jcall,
4123 .free = LDKListen_JCalls_free,
4127 long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) {
4128 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
4129 *res_ptr = LDKListen_init(o);
4130 return (long)res_ptr;
4132 void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) {
4133 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4134 LDKu8slice block_ref;
4135 block_ref.datalen = *((uint32_t*)block);
4136 block_ref.data = (int8_t*)(block + 4);
4137 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
4140 void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) {
4141 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
4142 unsigned char header_arr[80];
4143 CHECK(*((uint32_t*)header) == 80);
4144 memcpy(header_arr, (uint8_t*)(header + 4), 80);
4145 unsigned char (*header_ref)[80] = &header_arr;
4146 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
4149 typedef struct LDKFilter_JCalls {
4150 atomic_size_t refcnt;
4151 uint32_t register_tx_meth;
4152 uint32_t register_output_meth;
4154 static void LDKFilter_JCalls_free(void* this_arg) {
4155 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4156 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4157 js_free(j_calls->register_tx_meth);
4158 js_free(j_calls->register_output_meth);
4162 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4163 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4164 int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
4165 memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
4166 LDKu8slice script_pubkey_var = script_pubkey;
4167 int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
4168 memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
4169 js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4171 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
4172 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4173 LDKWatchedOutput output_var = output;
4174 CHECK((((long)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4175 CHECK((((long)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4176 long output_ref = (long)output_var.inner;
4177 if (output_var.is_owned) {
4180 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)js_invoke_function_1(j_calls->register_output_meth, output_ref);
4181 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
4182 // Warning: we may need a move here but no clone is available for LDKCOption_C2Tuple_usizeTransactionZZ
4185 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4186 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4187 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4188 return (void*) this_arg;
4190 static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
4191 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4192 atomic_init(&calls->refcnt, 1);
4193 //TODO: Assign calls->o from o
4196 .this_arg = (void*) calls,
4197 .register_tx = register_tx_LDKFilter_jcall,
4198 .register_output = register_output_LDKFilter_jcall,
4199 .free = LDKFilter_JCalls_free,
4203 long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
4204 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4205 *res_ptr = LDKFilter_init(o);
4206 return (long)res_ptr;
4208 void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
4209 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4210 unsigned char txid_arr[32];
4211 CHECK(*((uint32_t*)txid) == 32);
4212 memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
4213 unsigned char (*txid_ref)[32] = &txid_arr;
4214 LDKu8slice script_pubkey_ref;
4215 script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
4216 script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
4217 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4220 uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
4221 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
4222 LDKWatchedOutput output_conv;
4223 output_conv.inner = (void*)(output & (~1));
4224 output_conv.is_owned = (output & 1) || (output == 0);
4225 // Warning: we need a move here but no clone is available for LDKWatchedOutput
4226 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
4227 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
4228 long ret_ref = (long)ret_copy;
4232 typedef struct LDKPersist_JCalls {
4233 atomic_size_t refcnt;
4234 uint32_t persist_new_channel_meth;
4235 uint32_t update_persisted_channel_meth;
4236 } LDKPersist_JCalls;
4237 static void LDKPersist_JCalls_free(void* this_arg) {
4238 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4239 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4240 js_free(j_calls->persist_new_channel_meth);
4241 js_free(j_calls->update_persisted_channel_meth);
4245 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4246 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4247 LDKOutPoint id_var = id;
4248 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4249 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4250 long id_ref = (long)id_var.inner;
4251 if (id_var.is_owned) {
4254 LDKChannelMonitor data_var = *data;
4255 data_var = ChannelMonitor_clone(data);
4256 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4257 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4258 long data_ref = (long)data_var.inner;
4259 if (data_var.is_owned) {
4262 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
4263 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4264 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4267 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4268 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4269 LDKOutPoint id_var = id;
4270 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4271 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4272 long id_ref = (long)id_var.inner;
4273 if (id_var.is_owned) {
4276 LDKChannelMonitorUpdate update_var = *update;
4277 update_var = ChannelMonitorUpdate_clone(update);
4278 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4279 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4280 long update_ref = (long)update_var.inner;
4281 if (update_var.is_owned) {
4284 LDKChannelMonitor data_var = *data;
4285 data_var = ChannelMonitor_clone(data);
4286 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4287 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4288 long data_ref = (long)data_var.inner;
4289 if (data_var.is_owned) {
4292 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4293 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4294 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4297 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4298 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4299 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4300 return (void*) this_arg;
4302 static inline LDKPersist LDKPersist_init (/*TODO: JS Object Reference */void* o) {
4303 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4304 atomic_init(&calls->refcnt, 1);
4305 //TODO: Assign calls->o from o
4308 .this_arg = (void*) calls,
4309 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
4310 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
4311 .free = LDKPersist_JCalls_free,
4315 long __attribute__((visibility("default"))) TS_LDKPersist_new(/*TODO: JS Object Reference */void* o) {
4316 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4317 *res_ptr = LDKPersist_init(o);
4318 return (long)res_ptr;
4320 uint32_t __attribute__((visibility("default"))) TS_Persist_persist_new_channel(uint32_t this_arg, uint32_t id, uint32_t data) {
4321 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4322 LDKOutPoint id_conv;
4323 id_conv.inner = (void*)(id & (~1));
4324 id_conv.is_owned = (id & 1) || (id == 0);
4325 id_conv = OutPoint_clone(&id_conv);
4326 LDKChannelMonitor data_conv;
4327 data_conv.inner = (void*)(data & (~1));
4328 data_conv.is_owned = false;
4329 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4330 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4331 return (long)ret_conv;
4334 uint32_t __attribute__((visibility("default"))) TS_Persist_update_persisted_channel(uint32_t this_arg, uint32_t id, uint32_t update, uint32_t data) {
4335 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
4336 LDKOutPoint id_conv;
4337 id_conv.inner = (void*)(id & (~1));
4338 id_conv.is_owned = (id & 1) || (id == 0);
4339 id_conv = OutPoint_clone(&id_conv);
4340 LDKChannelMonitorUpdate update_conv;
4341 update_conv.inner = (void*)(update & (~1));
4342 update_conv.is_owned = false;
4343 LDKChannelMonitor data_conv;
4344 data_conv.inner = (void*)(data & (~1));
4345 data_conv.is_owned = false;
4346 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4347 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4348 return (long)ret_conv;
4351 typedef struct LDKChannelMessageHandler_JCalls {
4352 atomic_size_t refcnt;
4353 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4354 uint32_t handle_open_channel_meth;
4355 uint32_t handle_accept_channel_meth;
4356 uint32_t handle_funding_created_meth;
4357 uint32_t handle_funding_signed_meth;
4358 uint32_t handle_funding_locked_meth;
4359 uint32_t handle_shutdown_meth;
4360 uint32_t handle_closing_signed_meth;
4361 uint32_t handle_update_add_htlc_meth;
4362 uint32_t handle_update_fulfill_htlc_meth;
4363 uint32_t handle_update_fail_htlc_meth;
4364 uint32_t handle_update_fail_malformed_htlc_meth;
4365 uint32_t handle_commitment_signed_meth;
4366 uint32_t handle_revoke_and_ack_meth;
4367 uint32_t handle_update_fee_meth;
4368 uint32_t handle_announcement_signatures_meth;
4369 uint32_t peer_disconnected_meth;
4370 uint32_t peer_connected_meth;
4371 uint32_t handle_channel_reestablish_meth;
4372 uint32_t handle_channel_update_meth;
4373 uint32_t handle_error_meth;
4374 } LDKChannelMessageHandler_JCalls;
4375 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4376 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4377 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4378 js_free(j_calls->handle_open_channel_meth);
4379 js_free(j_calls->handle_accept_channel_meth);
4380 js_free(j_calls->handle_funding_created_meth);
4381 js_free(j_calls->handle_funding_signed_meth);
4382 js_free(j_calls->handle_funding_locked_meth);
4383 js_free(j_calls->handle_shutdown_meth);
4384 js_free(j_calls->handle_closing_signed_meth);
4385 js_free(j_calls->handle_update_add_htlc_meth);
4386 js_free(j_calls->handle_update_fulfill_htlc_meth);
4387 js_free(j_calls->handle_update_fail_htlc_meth);
4388 js_free(j_calls->handle_update_fail_malformed_htlc_meth);
4389 js_free(j_calls->handle_commitment_signed_meth);
4390 js_free(j_calls->handle_revoke_and_ack_meth);
4391 js_free(j_calls->handle_update_fee_meth);
4392 js_free(j_calls->handle_announcement_signatures_meth);
4393 js_free(j_calls->peer_disconnected_meth);
4394 js_free(j_calls->peer_connected_meth);
4395 js_free(j_calls->handle_channel_reestablish_meth);
4396 js_free(j_calls->handle_channel_update_meth);
4397 js_free(j_calls->handle_error_meth);
4401 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4402 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4403 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4404 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4405 LDKInitFeatures their_features_var = their_features;
4406 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4407 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4408 long their_features_ref = (long)their_features_var.inner;
4409 if (their_features_var.is_owned) {
4410 their_features_ref |= 1;
4412 LDKOpenChannel msg_var = *msg;
4413 msg_var = OpenChannel_clone(msg);
4414 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4415 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4416 long msg_ref = (long)msg_var.inner;
4417 if (msg_var.is_owned) {
4420 js_invoke_function_3(j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4422 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4423 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4424 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4425 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4426 LDKInitFeatures their_features_var = their_features;
4427 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4428 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4429 long their_features_ref = (long)their_features_var.inner;
4430 if (their_features_var.is_owned) {
4431 their_features_ref |= 1;
4433 LDKAcceptChannel msg_var = *msg;
4434 msg_var = AcceptChannel_clone(msg);
4435 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4436 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4437 long msg_ref = (long)msg_var.inner;
4438 if (msg_var.is_owned) {
4441 js_invoke_function_3(j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4443 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4444 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4445 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4446 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4447 LDKFundingCreated msg_var = *msg;
4448 msg_var = FundingCreated_clone(msg);
4449 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4450 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4451 long msg_ref = (long)msg_var.inner;
4452 if (msg_var.is_owned) {
4455 js_invoke_function_2(j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4457 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4458 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4459 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4460 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4461 LDKFundingSigned msg_var = *msg;
4462 msg_var = FundingSigned_clone(msg);
4463 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 long msg_ref = (long)msg_var.inner;
4466 if (msg_var.is_owned) {
4469 js_invoke_function_2(j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4471 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4472 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4473 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4474 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4475 LDKFundingLocked msg_var = *msg;
4476 msg_var = FundingLocked_clone(msg);
4477 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4478 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4479 long msg_ref = (long)msg_var.inner;
4480 if (msg_var.is_owned) {
4483 js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4485 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
4486 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4487 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4488 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4489 LDKInitFeatures their_features_var = *their_features;
4490 their_features_var = InitFeatures_clone(their_features);
4491 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4492 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4493 long their_features_ref = (long)their_features_var.inner;
4494 if (their_features_var.is_owned) {
4495 their_features_ref |= 1;
4497 LDKShutdown msg_var = *msg;
4498 msg_var = Shutdown_clone(msg);
4499 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4500 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4501 long msg_ref = (long)msg_var.inner;
4502 if (msg_var.is_owned) {
4505 js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
4507 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4508 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4509 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4510 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4511 LDKClosingSigned msg_var = *msg;
4512 msg_var = ClosingSigned_clone(msg);
4513 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4514 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4515 long msg_ref = (long)msg_var.inner;
4516 if (msg_var.is_owned) {
4519 js_invoke_function_2(j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4521 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4522 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4523 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4524 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4525 LDKUpdateAddHTLC msg_var = *msg;
4526 msg_var = UpdateAddHTLC_clone(msg);
4527 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4528 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4529 long msg_ref = (long)msg_var.inner;
4530 if (msg_var.is_owned) {
4533 js_invoke_function_2(j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4535 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4536 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4537 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4538 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4539 LDKUpdateFulfillHTLC msg_var = *msg;
4540 msg_var = UpdateFulfillHTLC_clone(msg);
4541 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4542 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4543 long msg_ref = (long)msg_var.inner;
4544 if (msg_var.is_owned) {
4547 js_invoke_function_2(j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4549 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4550 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4551 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4552 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4553 LDKUpdateFailHTLC msg_var = *msg;
4554 msg_var = UpdateFailHTLC_clone(msg);
4555 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4556 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4557 long msg_ref = (long)msg_var.inner;
4558 if (msg_var.is_owned) {
4561 js_invoke_function_2(j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4563 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4564 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4565 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4566 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4567 LDKUpdateFailMalformedHTLC msg_var = *msg;
4568 msg_var = UpdateFailMalformedHTLC_clone(msg);
4569 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4570 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4571 long msg_ref = (long)msg_var.inner;
4572 if (msg_var.is_owned) {
4575 js_invoke_function_2(j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4577 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4578 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4579 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4580 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4581 LDKCommitmentSigned msg_var = *msg;
4582 msg_var = CommitmentSigned_clone(msg);
4583 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4584 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4585 long msg_ref = (long)msg_var.inner;
4586 if (msg_var.is_owned) {
4589 js_invoke_function_2(j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4591 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4592 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4593 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4594 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4595 LDKRevokeAndACK msg_var = *msg;
4596 msg_var = RevokeAndACK_clone(msg);
4597 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4598 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4599 long msg_ref = (long)msg_var.inner;
4600 if (msg_var.is_owned) {
4603 js_invoke_function_2(j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4605 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4606 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4607 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4608 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4609 LDKUpdateFee msg_var = *msg;
4610 msg_var = UpdateFee_clone(msg);
4611 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4612 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4613 long msg_ref = (long)msg_var.inner;
4614 if (msg_var.is_owned) {
4617 js_invoke_function_2(j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4619 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4620 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4621 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4622 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4623 LDKAnnouncementSignatures msg_var = *msg;
4624 msg_var = AnnouncementSignatures_clone(msg);
4625 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4626 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4627 long msg_ref = (long)msg_var.inner;
4628 if (msg_var.is_owned) {
4631 js_invoke_function_2(j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4633 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4634 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4635 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4636 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4637 js_invoke_function_2(j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4639 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4640 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4641 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4642 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4643 LDKInit msg_var = *msg;
4644 msg_var = Init_clone(msg);
4645 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4646 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4647 long msg_ref = (long)msg_var.inner;
4648 if (msg_var.is_owned) {
4651 js_invoke_function_2(j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4653 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4654 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4655 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4656 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4657 LDKChannelReestablish msg_var = *msg;
4658 msg_var = ChannelReestablish_clone(msg);
4659 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4660 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4661 long msg_ref = (long)msg_var.inner;
4662 if (msg_var.is_owned) {
4665 js_invoke_function_2(j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4667 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
4668 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4669 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4670 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4671 LDKChannelUpdate msg_var = *msg;
4672 msg_var = ChannelUpdate_clone(msg);
4673 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4674 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4675 long msg_ref = (long)msg_var.inner;
4676 if (msg_var.is_owned) {
4679 js_invoke_function_2(j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
4681 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4682 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4683 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
4684 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
4685 LDKErrorMessage msg_var = *msg;
4686 msg_var = ErrorMessage_clone(msg);
4687 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4688 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4689 long msg_ref = (long)msg_var.inner;
4690 if (msg_var.is_owned) {
4693 js_invoke_function_2(j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4695 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4696 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4697 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4698 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4699 return (void*) this_arg;
4701 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
4702 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4703 atomic_init(&calls->refcnt, 1);
4704 //TODO: Assign calls->o from o
4706 LDKChannelMessageHandler ret = {
4707 .this_arg = (void*) calls,
4708 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
4709 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
4710 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
4711 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
4712 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
4713 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
4714 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
4715 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
4716 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
4717 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
4718 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
4719 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
4720 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
4721 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
4722 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
4723 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
4724 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
4725 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
4726 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
4727 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
4728 .free = LDKChannelMessageHandler_JCalls_free,
4729 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
4731 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4734 long __attribute__((visibility("default"))) TS_LDKChannelMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
4735 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4736 *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
4737 return (long)res_ptr;
4739 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) {
4740 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4741 LDKPublicKey their_node_id_ref;
4742 CHECK(*((uint32_t*)their_node_id) == 33);
4743 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4744 LDKInitFeatures their_features_conv;
4745 their_features_conv.inner = (void*)(their_features & (~1));
4746 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4747 their_features_conv = InitFeatures_clone(&their_features_conv);
4748 LDKOpenChannel msg_conv;
4749 msg_conv.inner = (void*)(msg & (~1));
4750 msg_conv.is_owned = false;
4751 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4754 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) {
4755 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4756 LDKPublicKey their_node_id_ref;
4757 CHECK(*((uint32_t*)their_node_id) == 33);
4758 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4759 LDKInitFeatures their_features_conv;
4760 their_features_conv.inner = (void*)(their_features & (~1));
4761 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4762 their_features_conv = InitFeatures_clone(&their_features_conv);
4763 LDKAcceptChannel msg_conv;
4764 msg_conv.inner = (void*)(msg & (~1));
4765 msg_conv.is_owned = false;
4766 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4769 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_created(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4770 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4771 LDKPublicKey their_node_id_ref;
4772 CHECK(*((uint32_t*)their_node_id) == 33);
4773 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4774 LDKFundingCreated msg_conv;
4775 msg_conv.inner = (void*)(msg & (~1));
4776 msg_conv.is_owned = false;
4777 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4780 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4781 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4782 LDKPublicKey their_node_id_ref;
4783 CHECK(*((uint32_t*)their_node_id) == 33);
4784 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4785 LDKFundingSigned msg_conv;
4786 msg_conv.inner = (void*)(msg & (~1));
4787 msg_conv.is_owned = false;
4788 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4791 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_funding_locked(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4792 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4793 LDKPublicKey their_node_id_ref;
4794 CHECK(*((uint32_t*)their_node_id) == 33);
4795 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4796 LDKFundingLocked msg_conv;
4797 msg_conv.inner = (void*)(msg & (~1));
4798 msg_conv.is_owned = false;
4799 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4802 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) {
4803 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4804 LDKPublicKey their_node_id_ref;
4805 CHECK(*((uint32_t*)their_node_id) == 33);
4806 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4807 LDKInitFeatures their_features_conv;
4808 their_features_conv.inner = (void*)(their_features & (~1));
4809 their_features_conv.is_owned = false;
4810 LDKShutdown msg_conv;
4811 msg_conv.inner = (void*)(msg & (~1));
4812 msg_conv.is_owned = false;
4813 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
4816 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4817 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4818 LDKPublicKey their_node_id_ref;
4819 CHECK(*((uint32_t*)their_node_id) == 33);
4820 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4821 LDKClosingSigned msg_conv;
4822 msg_conv.inner = (void*)(msg & (~1));
4823 msg_conv.is_owned = false;
4824 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4827 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_add_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4828 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4829 LDKPublicKey their_node_id_ref;
4830 CHECK(*((uint32_t*)their_node_id) == 33);
4831 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4832 LDKUpdateAddHTLC msg_conv;
4833 msg_conv.inner = (void*)(msg & (~1));
4834 msg_conv.is_owned = false;
4835 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4838 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fulfill_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4839 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4840 LDKPublicKey their_node_id_ref;
4841 CHECK(*((uint32_t*)their_node_id) == 33);
4842 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4843 LDKUpdateFulfillHTLC msg_conv;
4844 msg_conv.inner = (void*)(msg & (~1));
4845 msg_conv.is_owned = false;
4846 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4849 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4850 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4851 LDKPublicKey their_node_id_ref;
4852 CHECK(*((uint32_t*)their_node_id) == 33);
4853 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4854 LDKUpdateFailHTLC msg_conv;
4855 msg_conv.inner = (void*)(msg & (~1));
4856 msg_conv.is_owned = false;
4857 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4860 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fail_malformed_htlc(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4861 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4862 LDKPublicKey their_node_id_ref;
4863 CHECK(*((uint32_t*)their_node_id) == 33);
4864 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4865 LDKUpdateFailMalformedHTLC msg_conv;
4866 msg_conv.inner = (void*)(msg & (~1));
4867 msg_conv.is_owned = false;
4868 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4871 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_commitment_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4872 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4873 LDKPublicKey their_node_id_ref;
4874 CHECK(*((uint32_t*)their_node_id) == 33);
4875 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4876 LDKCommitmentSigned msg_conv;
4877 msg_conv.inner = (void*)(msg & (~1));
4878 msg_conv.is_owned = false;
4879 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4882 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_revoke_and_ack(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4883 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4884 LDKPublicKey their_node_id_ref;
4885 CHECK(*((uint32_t*)their_node_id) == 33);
4886 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4887 LDKRevokeAndACK msg_conv;
4888 msg_conv.inner = (void*)(msg & (~1));
4889 msg_conv.is_owned = false;
4890 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4893 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_update_fee(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4894 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4895 LDKPublicKey their_node_id_ref;
4896 CHECK(*((uint32_t*)their_node_id) == 33);
4897 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4898 LDKUpdateFee msg_conv;
4899 msg_conv.inner = (void*)(msg & (~1));
4900 msg_conv.is_owned = false;
4901 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4904 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_announcement_signatures(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4905 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4906 LDKPublicKey their_node_id_ref;
4907 CHECK(*((uint32_t*)their_node_id) == 33);
4908 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4909 LDKAnnouncementSignatures msg_conv;
4910 msg_conv.inner = (void*)(msg & (~1));
4911 msg_conv.is_owned = false;
4912 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4915 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_disconnected(uint32_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
4916 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4917 LDKPublicKey their_node_id_ref;
4918 CHECK(*((uint32_t*)their_node_id) == 33);
4919 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4920 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4923 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_peer_connected(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4924 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4925 LDKPublicKey their_node_id_ref;
4926 CHECK(*((uint32_t*)their_node_id) == 33);
4927 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4929 msg_conv.inner = (void*)(msg & (~1));
4930 msg_conv.is_owned = false;
4931 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4934 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_reestablish(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4935 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4936 LDKPublicKey their_node_id_ref;
4937 CHECK(*((uint32_t*)their_node_id) == 33);
4938 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4939 LDKChannelReestablish msg_conv;
4940 msg_conv.inner = (void*)(msg & (~1));
4941 msg_conv.is_owned = false;
4942 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4945 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_channel_update(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4946 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4947 LDKPublicKey their_node_id_ref;
4948 CHECK(*((uint32_t*)their_node_id) == 33);
4949 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4950 LDKChannelUpdate msg_conv;
4951 msg_conv.inner = (void*)(msg & (~1));
4952 msg_conv.is_owned = false;
4953 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4956 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_error(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
4957 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
4958 LDKPublicKey their_node_id_ref;
4959 CHECK(*((uint32_t*)their_node_id) == 33);
4960 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
4961 LDKErrorMessage msg_conv;
4962 msg_conv.inner = (void*)(msg & (~1));
4963 msg_conv.is_owned = false;
4964 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4967 typedef struct LDKRoutingMessageHandler_JCalls {
4968 atomic_size_t refcnt;
4969 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4970 uint32_t handle_node_announcement_meth;
4971 uint32_t handle_channel_announcement_meth;
4972 uint32_t handle_channel_update_meth;
4973 uint32_t handle_htlc_fail_channel_update_meth;
4974 uint32_t get_next_channel_announcements_meth;
4975 uint32_t get_next_node_announcements_meth;
4976 uint32_t sync_routing_table_meth;
4977 uint32_t handle_reply_channel_range_meth;
4978 uint32_t handle_reply_short_channel_ids_end_meth;
4979 uint32_t handle_query_channel_range_meth;
4980 uint32_t handle_query_short_channel_ids_meth;
4981 } LDKRoutingMessageHandler_JCalls;
4982 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4983 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4984 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4985 js_free(j_calls->handle_node_announcement_meth);
4986 js_free(j_calls->handle_channel_announcement_meth);
4987 js_free(j_calls->handle_channel_update_meth);
4988 js_free(j_calls->handle_htlc_fail_channel_update_meth);
4989 js_free(j_calls->get_next_channel_announcements_meth);
4990 js_free(j_calls->get_next_node_announcements_meth);
4991 js_free(j_calls->sync_routing_table_meth);
4992 js_free(j_calls->handle_reply_channel_range_meth);
4993 js_free(j_calls->handle_reply_short_channel_ids_end_meth);
4994 js_free(j_calls->handle_query_channel_range_meth);
4995 js_free(j_calls->handle_query_short_channel_ids_meth);
4999 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5000 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5001 LDKNodeAnnouncement msg_var = *msg;
5002 msg_var = NodeAnnouncement_clone(msg);
5003 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5004 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5005 long msg_ref = (long)msg_var.inner;
5006 if (msg_var.is_owned) {
5009 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
5010 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5011 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5014 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5015 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5016 LDKChannelAnnouncement msg_var = *msg;
5017 msg_var = ChannelAnnouncement_clone(msg);
5018 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5019 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5020 long msg_ref = (long)msg_var.inner;
5021 if (msg_var.is_owned) {
5024 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
5025 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5026 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5029 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5030 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5031 LDKChannelUpdate msg_var = *msg;
5032 msg_var = ChannelUpdate_clone(msg);
5033 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5034 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5035 long msg_ref = (long)msg_var.inner;
5036 if (msg_var.is_owned) {
5039 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
5040 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
5041 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
5044 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5045 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5046 long ret_update = (long)update;
5047 js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5049 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5050 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5051 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5052 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
5053 ret_constr.datalen = *((uint32_t*)ret);
5054 if (ret_constr.datalen > 0)
5055 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5057 ret_constr.data = NULL;
5058 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5059 for (size_t l = 0; l < ret_constr.datalen; l++) {
5060 uint32_t ret_conv_63 = ret_vals[l];
5061 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
5062 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63);
5063 ret_constr.data[l] = ret_conv_63_conv;
5067 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5068 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5069 int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5070 memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33);
5071 uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5072 LDKCVec_NodeAnnouncementZ ret_constr;
5073 ret_constr.datalen = *((uint32_t*)ret);
5074 if (ret_constr.datalen > 0)
5075 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5077 ret_constr.data = NULL;
5078 uint32_t* ret_vals = (uint32_t*)(ret + 4);
5079 for (size_t s = 0; s < ret_constr.datalen; s++) {
5080 uint32_t ret_conv_18 = ret_vals[s];
5081 LDKNodeAnnouncement ret_conv_18_conv;
5082 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
5083 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
5084 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
5085 ret_constr.data[s] = ret_conv_18_conv;
5089 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5090 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5091 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5092 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5093 LDKInit init_var = *init;
5094 init_var = Init_clone(init);
5095 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5096 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5097 long init_ref = (long)init_var.inner;
5098 if (init_var.is_owned) {
5101 js_invoke_function_2(j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5103 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5104 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5105 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5106 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5107 LDKReplyChannelRange msg_var = msg;
5108 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5109 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5110 long msg_ref = (long)msg_var.inner;
5111 if (msg_var.is_owned) {
5114 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5115 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5116 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5119 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5120 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5121 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5122 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5123 LDKReplyShortChannelIdsEnd msg_var = msg;
5124 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5125 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5126 long msg_ref = (long)msg_var.inner;
5127 if (msg_var.is_owned) {
5130 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5131 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5132 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5135 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5136 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5137 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5138 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5139 LDKQueryChannelRange msg_var = msg;
5140 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5141 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5142 long msg_ref = (long)msg_var.inner;
5143 if (msg_var.is_owned) {
5146 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5147 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5148 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5151 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5152 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5153 int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
5154 memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33);
5155 LDKQueryShortChannelIds msg_var = msg;
5156 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5157 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5158 long msg_ref = (long)msg_var.inner;
5159 if (msg_var.is_owned) {
5162 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5163 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5164 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5167 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5168 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5169 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5170 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5171 return (void*) this_arg;
5173 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* MessageSendEventsProvider) {
5174 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5175 atomic_init(&calls->refcnt, 1);
5176 //TODO: Assign calls->o from o
5178 LDKRoutingMessageHandler ret = {
5179 .this_arg = (void*) calls,
5180 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
5181 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
5182 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
5183 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
5184 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
5185 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
5186 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
5187 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
5188 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
5189 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
5190 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
5191 .free = LDKRoutingMessageHandler_JCalls_free,
5192 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
5194 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5197 long __attribute__((visibility("default"))) TS_LDKRoutingMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* MessageSendEventsProvider) {
5198 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5199 *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
5200 return (long)res_ptr;
5202 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_node_announcement(uint32_t this_arg, uint32_t msg) {
5203 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5204 LDKNodeAnnouncement msg_conv;
5205 msg_conv.inner = (void*)(msg & (~1));
5206 msg_conv.is_owned = false;
5207 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5208 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5209 return (long)ret_conv;
5212 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_announcement(uint32_t this_arg, uint32_t msg) {
5213 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5214 LDKChannelAnnouncement msg_conv;
5215 msg_conv.inner = (void*)(msg & (~1));
5216 msg_conv.is_owned = false;
5217 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5218 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5219 return (long)ret_conv;
5222 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_channel_update(uint32_t this_arg, uint32_t msg) {
5223 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5224 LDKChannelUpdate msg_conv;
5225 msg_conv.inner = (void*)(msg & (~1));
5226 msg_conv.is_owned = false;
5227 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5228 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5229 return (long)ret_conv;
5232 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
5233 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5234 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5235 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5238 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
5239 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5240 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5241 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5242 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5243 for (size_t l = 0; l < ret_var.datalen; l++) {
5244 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5245 *ret_conv_63_ref = ret_var.data[l];
5246 ret_arr_ptr[l] = (long)ret_conv_63_ref;
5252 uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_node_announcements(uint32_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
5253 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5254 LDKPublicKey starting_point_ref;
5255 CHECK(*((uint32_t*)starting_point) == 33);
5256 memcpy(starting_point_ref.compressed_form, (uint8_t*)(starting_point + 4), 33);
5257 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5258 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
5259 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
5260 for (size_t s = 0; s < ret_var.datalen; s++) {
5261 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
5262 CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5263 CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5264 long ret_conv_18_ref = (long)ret_conv_18_var.inner;
5265 if (ret_conv_18_var.is_owned) {
5266 ret_conv_18_ref |= 1;
5268 ret_arr_ptr[s] = ret_conv_18_ref;
5274 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_sync_routing_table(uint32_t this_arg, int8_tArray their_node_id, uint32_t init) {
5275 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5276 LDKPublicKey their_node_id_ref;
5277 CHECK(*((uint32_t*)their_node_id) == 33);
5278 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5280 init_conv.inner = (void*)(init & (~1));
5281 init_conv.is_owned = false;
5282 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5285 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_reply_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5286 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5287 LDKPublicKey their_node_id_ref;
5288 CHECK(*((uint32_t*)their_node_id) == 33);
5289 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5290 LDKReplyChannelRange msg_conv;
5291 msg_conv.inner = (void*)(msg & (~1));
5292 msg_conv.is_owned = (msg & 1) || (msg == 0);
5293 msg_conv = ReplyChannelRange_clone(&msg_conv);
5294 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5295 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5296 return (long)ret_conv;
5299 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) {
5300 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5301 LDKPublicKey their_node_id_ref;
5302 CHECK(*((uint32_t*)their_node_id) == 33);
5303 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5304 LDKReplyShortChannelIdsEnd msg_conv;
5305 msg_conv.inner = (void*)(msg & (~1));
5306 msg_conv.is_owned = (msg & 1) || (msg == 0);
5307 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5308 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5309 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5310 return (long)ret_conv;
5313 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_channel_range(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5314 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5315 LDKPublicKey their_node_id_ref;
5316 CHECK(*((uint32_t*)their_node_id) == 33);
5317 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5318 LDKQueryChannelRange msg_conv;
5319 msg_conv.inner = (void*)(msg & (~1));
5320 msg_conv.is_owned = (msg & 1) || (msg == 0);
5321 msg_conv = QueryChannelRange_clone(&msg_conv);
5322 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5323 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5324 return (long)ret_conv;
5327 uint32_t __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_query_short_channel_ids(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) {
5328 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
5329 LDKPublicKey their_node_id_ref;
5330 CHECK(*((uint32_t*)their_node_id) == 33);
5331 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
5332 LDKQueryShortChannelIds msg_conv;
5333 msg_conv.inner = (void*)(msg & (~1));
5334 msg_conv.is_owned = (msg & 1) || (msg == 0);
5335 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5336 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5337 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5338 return (long)ret_conv;
5341 typedef struct LDKSocketDescriptor_JCalls {
5342 atomic_size_t refcnt;
5343 uint32_t send_data_meth;
5344 uint32_t disconnect_socket_meth;
5347 } LDKSocketDescriptor_JCalls;
5348 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5349 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5350 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5351 js_free(j_calls->send_data_meth);
5352 js_free(j_calls->disconnect_socket_meth);
5353 js_free(j_calls->eq_meth);
5354 js_free(j_calls->hash_meth);
5358 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5359 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5360 LDKu8slice data_var = data;
5361 int8_tArray data_arr = init_arr(data_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
5362 memcpy((uint8_t*)(data_arr + 4), data_var.data, data_var.datalen);
5363 return js_invoke_function_2(j_calls->send_data_meth, data_arr, resume_read);
5365 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
5366 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5367 js_invoke_function_0(j_calls->disconnect_socket_meth);
5369 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5370 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5371 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5372 *other_arg_clone = SocketDescriptor_clone(other_arg);
5373 return js_invoke_function_1(j_calls->eq_meth, (long)other_arg_clone);
5375 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
5376 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5377 return js_invoke_function_0(j_calls->hash_meth);
5379 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5380 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5381 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5382 return (void*) this_arg;
5384 static inline LDKSocketDescriptor LDKSocketDescriptor_init (/*TODO: JS Object Reference */void* o) {
5385 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5386 atomic_init(&calls->refcnt, 1);
5387 //TODO: Assign calls->o from o
5389 LDKSocketDescriptor ret = {
5390 .this_arg = (void*) calls,
5391 .send_data = send_data_LDKSocketDescriptor_jcall,
5392 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
5393 .eq = eq_LDKSocketDescriptor_jcall,
5394 .hash = hash_LDKSocketDescriptor_jcall,
5395 .clone = LDKSocketDescriptor_JCalls_clone,
5396 .free = LDKSocketDescriptor_JCalls_free,
5400 long __attribute__((visibility("default"))) TS_LDKSocketDescriptor_new(/*TODO: JS Object Reference */void* o) {
5401 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5402 *res_ptr = LDKSocketDescriptor_init(o);
5403 return (long)res_ptr;
5405 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_send_data(uint32_t this_arg, int8_tArray data, jboolean resume_read) {
5406 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5407 LDKu8slice data_ref;
5408 data_ref.datalen = *((uint32_t*)data);
5409 data_ref.data = (int8_t*)(data + 4);
5410 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5414 void __attribute__((visibility("default"))) TS_SocketDescriptor_disconnect_socket(uint32_t this_arg) {
5415 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5416 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5419 int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_t this_arg) {
5420 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
5421 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5425 void __attribute__((visibility("default"))) TS_Transaction_free(int8_tArray _res) {
5426 LDKTransaction _res_ref;
5427 _res_ref.datalen = *((uint32_t*)_res);
5428 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5429 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
5430 _res_ref.data_is_owned = true;
5431 Transaction_free(_res_ref);
5434 void __attribute__((visibility("default"))) TS_TxOut_free(uint32_t _res) {
5435 if ((_res & 1) != 0) return;
5436 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5438 TxOut_free(_res_conv);
5441 uint32_t __attribute__((visibility("default"))) TS_TxOut_clone(uint32_t orig) {
5442 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5443 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5444 *ret_ref = TxOut_clone(orig_conv);
5445 return (long)ret_ref;
5448 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
5450 CHECK(*((uint32_t*)o) == 32);
5451 memcpy(o_ref.bytes, (uint8_t*)(o + 4), 32);
5452 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5453 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
5454 return (long)ret_conv;
5457 uint32_t __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
5458 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5459 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
5460 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
5461 return (long)ret_conv;
5464 void __attribute__((visibility("default"))) TS_CResult_SecretKeyErrorZ_free(uint32_t _res) {
5465 if ((_res & 1) != 0) return;
5466 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
5468 CResult_SecretKeyErrorZ_free(_res_conv);
5471 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
5473 CHECK(*((uint32_t*)o) == 33);
5474 memcpy(o_ref.compressed_form, (uint8_t*)(o + 4), 33);
5475 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5476 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
5477 return (long)ret_conv;
5480 uint32_t __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
5481 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5482 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
5483 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
5484 return (long)ret_conv;
5487 void __attribute__((visibility("default"))) TS_CResult_PublicKeyErrorZ_free(uint32_t _res) {
5488 if ((_res & 1) != 0) return;
5489 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
5491 CResult_PublicKeyErrorZ_free(_res_conv);
5494 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint32_t o) {
5495 LDKTxCreationKeys o_conv;
5496 o_conv.inner = (void*)(o & (~1));
5497 o_conv.is_owned = (o & 1) || (o == 0);
5498 o_conv = TxCreationKeys_clone(&o_conv);
5499 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5500 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
5501 return (long)ret_conv;
5504 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint32_t e) {
5505 LDKDecodeError e_conv;
5506 e_conv.inner = (void*)(e & (~1));
5507 e_conv.is_owned = (e & 1) || (e == 0);
5508 e_conv = DecodeError_clone(&e_conv);
5509 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5510 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
5511 return (long)ret_conv;
5514 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint32_t _res) {
5515 if ((_res & 1) != 0) return;
5516 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5518 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
5521 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint32_t orig) {
5522 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
5523 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
5524 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
5525 return (long)ret_conv;
5528 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint32_t o) {
5529 LDKChannelPublicKeys o_conv;
5530 o_conv.inner = (void*)(o & (~1));
5531 o_conv.is_owned = (o & 1) || (o == 0);
5532 o_conv = ChannelPublicKeys_clone(&o_conv);
5533 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5534 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
5535 return (long)ret_conv;
5538 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint32_t e) {
5539 LDKDecodeError e_conv;
5540 e_conv.inner = (void*)(e & (~1));
5541 e_conv.is_owned = (e & 1) || (e == 0);
5542 e_conv = DecodeError_clone(&e_conv);
5543 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5544 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
5545 return (long)ret_conv;
5548 void __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint32_t _res) {
5549 if ((_res & 1) != 0) return;
5550 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5552 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
5555 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint32_t orig) {
5556 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
5557 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
5558 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
5559 return (long)ret_conv;
5562 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_ok(uint32_t o) {
5563 LDKTxCreationKeys o_conv;
5564 o_conv.inner = (void*)(o & (~1));
5565 o_conv.is_owned = (o & 1) || (o == 0);
5566 o_conv = TxCreationKeys_clone(&o_conv);
5567 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5568 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
5569 return (long)ret_conv;
5572 uint32_t __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
5573 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
5574 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
5575 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
5576 return (long)ret_conv;
5579 void __attribute__((visibility("default"))) TS_CResult_TxCreationKeysErrorZ_free(uint32_t _res) {
5580 if ((_res & 1) != 0) return;
5581 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
5583 CResult_TxCreationKeysErrorZ_free(_res_conv);
5586 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_some(int32_t o) {
5587 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5588 *ret_copy = COption_u32Z_some(o);
5589 long ret_ref = (long)ret_copy;
5593 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_none() {
5594 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5595 *ret_copy = COption_u32Z_none();
5596 long ret_ref = (long)ret_copy;
5600 void __attribute__((visibility("default"))) TS_COption_u32Z_free(uint32_t _res) {
5601 if ((_res & 1) != 0) return;
5602 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
5604 COption_u32Z_free(_res_conv);
5607 uint32_t __attribute__((visibility("default"))) TS_COption_u32Z_clone(uint32_t orig) {
5608 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
5609 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
5610 *ret_copy = COption_u32Z_clone(orig_conv);
5611 long ret_ref = (long)ret_copy;
5615 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint32_t o) {
5616 LDKHTLCOutputInCommitment o_conv;
5617 o_conv.inner = (void*)(o & (~1));
5618 o_conv.is_owned = (o & 1) || (o == 0);
5619 o_conv = HTLCOutputInCommitment_clone(&o_conv);
5620 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5621 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
5622 return (long)ret_conv;
5625 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint32_t e) {
5626 LDKDecodeError e_conv;
5627 e_conv.inner = (void*)(e & (~1));
5628 e_conv.is_owned = (e & 1) || (e == 0);
5629 e_conv = DecodeError_clone(&e_conv);
5630 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5631 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
5632 return (long)ret_conv;
5635 void __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint32_t _res) {
5636 if ((_res & 1) != 0) return;
5637 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
5639 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
5642 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint32_t orig) {
5643 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
5644 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
5645 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
5646 return (long)ret_conv;
5649 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5650 LDKCounterpartyChannelTransactionParameters o_conv;
5651 o_conv.inner = (void*)(o & (~1));
5652 o_conv.is_owned = (o & 1) || (o == 0);
5653 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
5654 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5655 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5656 return (long)ret_conv;
5659 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5660 LDKDecodeError e_conv;
5661 e_conv.inner = (void*)(e & (~1));
5662 e_conv.is_owned = (e & 1) || (e == 0);
5663 e_conv = DecodeError_clone(&e_conv);
5664 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5665 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
5666 return (long)ret_conv;
5669 void __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5670 if ((_res & 1) != 0) return;
5671 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5673 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5676 uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5677 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5678 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
5679 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5680 return (long)ret_conv;
5683 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) {
5684 LDKChannelTransactionParameters o_conv;
5685 o_conv.inner = (void*)(o & (~1));
5686 o_conv.is_owned = (o & 1) || (o == 0);
5687 o_conv = ChannelTransactionParameters_clone(&o_conv);
5688 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5689 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
5690 return (long)ret_conv;
5693 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint32_t e) {
5694 LDKDecodeError e_conv;
5695 e_conv.inner = (void*)(e & (~1));
5696 e_conv.is_owned = (e & 1) || (e == 0);
5697 e_conv = DecodeError_clone(&e_conv);
5698 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5699 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
5700 return (long)ret_conv;
5703 void __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint32_t _res) {
5704 if ((_res & 1) != 0) return;
5705 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
5707 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
5710 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint32_t orig) {
5711 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
5712 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
5713 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
5714 return (long)ret_conv;
5717 void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _res) {
5718 LDKCVec_SignatureZ _res_constr;
5719 _res_constr.datalen = *((uint32_t*)_res);
5720 if (_res_constr.datalen > 0)
5721 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5723 _res_constr.data = NULL;
5724 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
5725 for (size_t m = 0; m < _res_constr.datalen; m++) {
5726 int8_tArray _res_conv_12 = _res_vals[m];
5727 LDKSignature _res_conv_12_ref;
5728 CHECK(*((uint32_t*)_res_conv_12) == 64);
5729 memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64);
5730 _res_constr.data[m] = _res_conv_12_ref;
5732 CVec_SignatureZ_free(_res_constr);
5735 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5736 LDKHolderCommitmentTransaction o_conv;
5737 o_conv.inner = (void*)(o & (~1));
5738 o_conv.is_owned = (o & 1) || (o == 0);
5739 o_conv = HolderCommitmentTransaction_clone(&o_conv);
5740 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5741 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
5742 return (long)ret_conv;
5745 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5746 LDKDecodeError e_conv;
5747 e_conv.inner = (void*)(e & (~1));
5748 e_conv.is_owned = (e & 1) || (e == 0);
5749 e_conv = DecodeError_clone(&e_conv);
5750 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5751 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
5752 return (long)ret_conv;
5755 void __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5756 if ((_res & 1) != 0) return;
5757 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5759 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
5762 uint32_t __attribute__((visibility("default"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5763 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5764 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
5765 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5766 return (long)ret_conv;
5769 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5770 LDKBuiltCommitmentTransaction o_conv;
5771 o_conv.inner = (void*)(o & (~1));
5772 o_conv.is_owned = (o & 1) || (o == 0);
5773 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
5774 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5775 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
5776 return (long)ret_conv;
5779 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5780 LDKDecodeError e_conv;
5781 e_conv.inner = (void*)(e & (~1));
5782 e_conv.is_owned = (e & 1) || (e == 0);
5783 e_conv = DecodeError_clone(&e_conv);
5784 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5785 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
5786 return (long)ret_conv;
5789 void __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5790 if ((_res & 1) != 0) return;
5791 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5793 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
5796 uint32_t __attribute__((visibility("default"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5797 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
5798 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
5799 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
5800 return (long)ret_conv;
5803 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
5804 LDKCommitmentTransaction o_conv;
5805 o_conv.inner = (void*)(o & (~1));
5806 o_conv.is_owned = (o & 1) || (o == 0);
5807 o_conv = CommitmentTransaction_clone(&o_conv);
5808 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5809 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
5810 return (long)ret_conv;
5813 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint32_t e) {
5814 LDKDecodeError e_conv;
5815 e_conv.inner = (void*)(e & (~1));
5816 e_conv.is_owned = (e & 1) || (e == 0);
5817 e_conv = DecodeError_clone(&e_conv);
5818 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5819 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
5820 return (long)ret_conv;
5823 void __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint32_t _res) {
5824 if ((_res & 1) != 0) return;
5825 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
5827 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
5830 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint32_t orig) {
5831 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
5832 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
5833 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
5834 return (long)ret_conv;
5837 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint32_t o) {
5838 LDKTrustedCommitmentTransaction o_conv;
5839 o_conv.inner = (void*)(o & (~1));
5840 o_conv.is_owned = (o & 1) || (o == 0);
5841 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
5842 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5843 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
5844 return (long)ret_conv;
5847 uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
5848 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
5849 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
5850 return (long)ret_conv;
5853 void __attribute__((visibility("default"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint32_t _res) {
5854 if ((_res & 1) != 0) return;
5855 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
5857 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
5860 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
5861 LDKCVec_SignatureZ o_constr;
5862 o_constr.datalen = *((uint32_t*)o);
5863 if (o_constr.datalen > 0)
5864 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5866 o_constr.data = NULL;
5867 int8_tArray* o_vals = (int8_tArray*)(o + 4);
5868 for (size_t m = 0; m < o_constr.datalen; m++) {
5869 int8_tArray o_conv_12 = o_vals[m];
5870 LDKSignature o_conv_12_ref;
5871 CHECK(*((uint32_t*)o_conv_12) == 64);
5872 memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64);
5873 o_constr.data[m] = o_conv_12_ref;
5875 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5876 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
5877 return (long)ret_conv;
5880 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_err() {
5881 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5882 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5883 return (long)ret_conv;
5886 void __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_free(uint32_t _res) {
5887 if ((_res & 1) != 0) return;
5888 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
5890 CResult_CVec_SignatureZNoneZ_free(_res_conv);
5893 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint32_t orig) {
5894 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
5895 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5896 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
5897 return (long)ret_conv;
5900 void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint32_tArray _res) {
5901 LDKCVec_MessageSendEventZ _res_constr;
5902 _res_constr.datalen = *((uint32_t*)_res);
5903 if (_res_constr.datalen > 0)
5904 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5906 _res_constr.data = NULL;
5907 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5908 for (size_t s = 0; s < _res_constr.datalen; s++) {
5909 uint32_t _res_conv_18 = _res_vals[s];
5910 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
5911 FREE((void*)_res_conv_18);
5912 _res_constr.data[s] = _res_conv_18_conv;
5914 CVec_MessageSendEventZ_free(_res_constr);
5917 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
5918 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5919 *ret_conv = CResult_boolLightningErrorZ_ok(o);
5920 return (long)ret_conv;
5923 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
5924 LDKLightningError e_conv;
5925 e_conv.inner = (void*)(e & (~1));
5926 e_conv.is_owned = (e & 1) || (e == 0);
5927 e_conv = LightningError_clone(&e_conv);
5928 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5929 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
5930 return (long)ret_conv;
5933 void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
5934 if ((_res & 1) != 0) return;
5935 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
5937 CResult_boolLightningErrorZ_free(_res_conv);
5940 uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
5941 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
5942 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5943 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
5944 return (long)ret_conv;
5947 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
5948 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
5949 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5950 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
5951 return (long)ret_ref;
5954 uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
5955 LDKChannelAnnouncement a_conv;
5956 a_conv.inner = (void*)(a & (~1));
5957 a_conv.is_owned = (a & 1) || (a == 0);
5958 a_conv = ChannelAnnouncement_clone(&a_conv);
5959 LDKChannelUpdate b_conv;
5960 b_conv.inner = (void*)(b & (~1));
5961 b_conv.is_owned = (b & 1) || (b == 0);
5962 b_conv = ChannelUpdate_clone(&b_conv);
5963 LDKChannelUpdate c_conv;
5964 c_conv.inner = (void*)(c & (~1));
5965 c_conv.is_owned = (c & 1) || (c == 0);
5966 c_conv = ChannelUpdate_clone(&c_conv);
5967 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5968 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5969 return (long)ret_ref;
5972 void __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint32_t _res) {
5973 if ((_res & 1) != 0) return;
5974 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
5976 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
5979 void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint32_tArray _res) {
5980 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
5981 _res_constr.datalen = *((uint32_t*)_res);
5982 if (_res_constr.datalen > 0)
5983 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5985 _res_constr.data = NULL;
5986 uint32_t* _res_vals = (uint32_t*)(_res + 4);
5987 for (size_t l = 0; l < _res_constr.datalen; l++) {
5988 uint32_t _res_conv_63 = _res_vals[l];
5989 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
5990 FREE((void*)_res_conv_63);
5991 _res_constr.data[l] = _res_conv_63_conv;
5993 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
5996 void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint32_tArray _res) {
5997 LDKCVec_NodeAnnouncementZ _res_constr;
5998 _res_constr.datalen = *((uint32_t*)_res);
5999 if (_res_constr.datalen > 0)
6000 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6002 _res_constr.data = NULL;
6003 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6004 for (size_t s = 0; s < _res_constr.datalen; s++) {
6005 uint32_t _res_conv_18 = _res_vals[s];
6006 LDKNodeAnnouncement _res_conv_18_conv;
6007 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
6008 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
6009 _res_constr.data[s] = _res_conv_18_conv;
6011 CVec_NodeAnnouncementZ_free(_res_constr);
6014 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
6015 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6016 *ret_conv = CResult_NoneLightningErrorZ_ok();
6017 return (long)ret_conv;
6020 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
6021 LDKLightningError e_conv;
6022 e_conv.inner = (void*)(e & (~1));
6023 e_conv.is_owned = (e & 1) || (e == 0);
6024 e_conv = LightningError_clone(&e_conv);
6025 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6026 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6027 return (long)ret_conv;
6030 void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
6031 if ((_res & 1) != 0) return;
6032 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6034 CResult_NoneLightningErrorZ_free(_res_conv);
6037 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
6038 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6039 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6040 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6041 return (long)ret_conv;
6044 void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
6045 LDKCVec_PublicKeyZ _res_constr;
6046 _res_constr.datalen = *((uint32_t*)_res);
6047 if (_res_constr.datalen > 0)
6048 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6050 _res_constr.data = NULL;
6051 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6052 for (size_t m = 0; m < _res_constr.datalen; m++) {
6053 int8_tArray _res_conv_12 = _res_vals[m];
6054 LDKPublicKey _res_conv_12_ref;
6055 CHECK(*((uint32_t*)_res_conv_12) == 33);
6056 memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33);
6057 _res_constr.data[m] = _res_conv_12_ref;
6059 CVec_PublicKeyZ_free(_res_constr);
6062 void __attribute__((visibility("default"))) TS_CVec_u8Z_free(int8_tArray _res) {
6063 LDKCVec_u8Z _res_ref;
6064 _res_ref.datalen = *((uint32_t*)_res);
6065 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6066 memcpy(_res_ref.data, (uint8_t*)(_res + 4), _res_ref.datalen);
6067 CVec_u8Z_free(_res_ref);
6070 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
6072 o_ref.datalen = *((uint32_t*)o);
6073 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6074 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
6075 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6076 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6077 return (long)ret_conv;
6080 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint32_t e) {
6081 LDKPeerHandleError e_conv;
6082 e_conv.inner = (void*)(e & (~1));
6083 e_conv.is_owned = (e & 1) || (e == 0);
6084 e_conv = PeerHandleError_clone(&e_conv);
6085 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6086 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6087 return (long)ret_conv;
6090 void __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint32_t _res) {
6091 if ((_res & 1) != 0) return;
6092 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6094 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6097 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint32_t orig) {
6098 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
6099 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6100 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
6101 return (long)ret_conv;
6104 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_ok() {
6105 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6106 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6107 return (long)ret_conv;
6110 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_err(uint32_t e) {
6111 LDKPeerHandleError e_conv;
6112 e_conv.inner = (void*)(e & (~1));
6113 e_conv.is_owned = (e & 1) || (e == 0);
6114 e_conv = PeerHandleError_clone(&e_conv);
6115 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6116 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6117 return (long)ret_conv;
6120 void __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_free(uint32_t _res) {
6121 if ((_res & 1) != 0) return;
6122 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6124 CResult_NonePeerHandleErrorZ_free(_res_conv);
6127 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePeerHandleErrorZ_clone(uint32_t orig) {
6128 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6129 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6130 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6131 return (long)ret_conv;
6134 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
6135 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6136 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6137 return (long)ret_conv;
6140 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_err(uint32_t e) {
6141 LDKPeerHandleError e_conv;
6142 e_conv.inner = (void*)(e & (~1));
6143 e_conv.is_owned = (e & 1) || (e == 0);
6144 e_conv = PeerHandleError_clone(&e_conv);
6145 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6146 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6147 return (long)ret_conv;
6150 void __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_free(uint32_t _res) {
6151 if ((_res & 1) != 0) return;
6152 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6154 CResult_boolPeerHandleErrorZ_free(_res_conv);
6157 uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ_clone(uint32_t orig) {
6158 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
6159 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6160 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
6161 return (long)ret_conv;
6164 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) {
6165 LDKInitFeatures o_conv;
6166 o_conv.inner = (void*)(o & (~1));
6167 o_conv.is_owned = (o & 1) || (o == 0);
6168 o_conv = InitFeatures_clone(&o_conv);
6169 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6170 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
6171 return (long)ret_conv;
6174 uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) {
6175 LDKDecodeError e_conv;
6176 e_conv.inner = (void*)(e & (~1));
6177 e_conv.is_owned = (e & 1) || (e == 0);
6178 e_conv = DecodeError_clone(&e_conv);
6179 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
6180 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
6181 return (long)ret_conv;
6184 void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) {
6185 if ((_res & 1) != 0) return;
6186 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6188 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
6191 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) {
6192 LDKNodeFeatures o_conv;
6193 o_conv.inner = (void*)(o & (~1));
6194 o_conv.is_owned = (o & 1) || (o == 0);
6195 o_conv = NodeFeatures_clone(&o_conv);
6196 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6197 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
6198 return (long)ret_conv;
6201 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) {
6202 LDKDecodeError e_conv;
6203 e_conv.inner = (void*)(e & (~1));
6204 e_conv.is_owned = (e & 1) || (e == 0);
6205 e_conv = DecodeError_clone(&e_conv);
6206 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
6207 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
6208 return (long)ret_conv;
6211 void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) {
6212 if ((_res & 1) != 0) return;
6213 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6215 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
6218 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) {
6219 LDKChannelFeatures o_conv;
6220 o_conv.inner = (void*)(o & (~1));
6221 o_conv.is_owned = (o & 1) || (o == 0);
6222 o_conv = ChannelFeatures_clone(&o_conv);
6223 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
6224 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
6225 return (long)ret_conv;
6228 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint32_t e) {
6229 LDKDecodeError e_conv;
6230 e_conv.inner = (void*)(e & (~1));
6231 e_conv.is_owned = (e & 1) || (e == 0);
6232 e_conv = DecodeError_clone(&e_conv);
6233 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
6234 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
6235 return (long)ret_conv;
6238 void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint32_t _res) {
6239 if ((_res & 1) != 0) return;
6240 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6242 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
6245 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) {
6246 LDKInvoiceFeatures o_conv;
6247 o_conv.inner = (void*)(o & (~1));
6248 o_conv.is_owned = (o & 1) || (o == 0);
6249 o_conv = InvoiceFeatures_clone(&o_conv);
6250 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
6251 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
6252 return (long)ret_conv;
6255 uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) {
6256 LDKDecodeError e_conv;
6257 e_conv.inner = (void*)(e & (~1));
6258 e_conv.is_owned = (e & 1) || (e == 0);
6259 e_conv = DecodeError_clone(&e_conv);
6260 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
6261 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
6262 return (long)ret_conv;
6265 void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) {
6266 if ((_res & 1) != 0) return;
6267 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6269 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
6272 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint32_t o) {
6273 LDKChannelConfig o_conv;
6274 o_conv.inner = (void*)(o & (~1));
6275 o_conv.is_owned = (o & 1) || (o == 0);
6276 o_conv = ChannelConfig_clone(&o_conv);
6277 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6278 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
6279 return (long)ret_conv;
6282 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint32_t e) {
6283 LDKDecodeError e_conv;
6284 e_conv.inner = (void*)(e & (~1));
6285 e_conv.is_owned = (e & 1) || (e == 0);
6286 e_conv = DecodeError_clone(&e_conv);
6287 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6288 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
6289 return (long)ret_conv;
6292 void __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint32_t _res) {
6293 if ((_res & 1) != 0) return;
6294 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
6296 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
6299 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint32_t orig) {
6300 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
6301 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
6302 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
6303 return (long)ret_conv;
6306 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_some(int64_t o) {
6307 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6308 *ret_copy = COption_u64Z_some(o);
6309 long ret_ref = (long)ret_copy;
6313 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_none() {
6314 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6315 *ret_copy = COption_u64Z_none();
6316 long ret_ref = (long)ret_copy;
6320 void __attribute__((visibility("default"))) TS_COption_u64Z_free(uint32_t _res) {
6321 if ((_res & 1) != 0) return;
6322 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
6324 COption_u64Z_free(_res_conv);
6327 uint32_t __attribute__((visibility("default"))) TS_COption_u64Z_clone(uint32_t orig) {
6328 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
6329 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
6330 *ret_copy = COption_u64Z_clone(orig_conv);
6331 long ret_ref = (long)ret_copy;
6335 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
6336 LDKDirectionalChannelInfo o_conv;
6337 o_conv.inner = (void*)(o & (~1));
6338 o_conv.is_owned = (o & 1) || (o == 0);
6339 o_conv = DirectionalChannelInfo_clone(&o_conv);
6340 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6341 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
6342 return (long)ret_conv;
6345 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_err(uint32_t e) {
6346 LDKDecodeError e_conv;
6347 e_conv.inner = (void*)(e & (~1));
6348 e_conv.is_owned = (e & 1) || (e == 0);
6349 e_conv = DecodeError_clone(&e_conv);
6350 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6351 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
6352 return (long)ret_conv;
6355 void __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_free(uint32_t _res) {
6356 if ((_res & 1) != 0) return;
6357 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6359 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
6362 uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6363 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
6364 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
6365 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
6366 return (long)ret_conv;
6369 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint32_t o) {
6370 LDKChannelInfo o_conv;
6371 o_conv.inner = (void*)(o & (~1));
6372 o_conv.is_owned = (o & 1) || (o == 0);
6373 o_conv = ChannelInfo_clone(&o_conv);
6374 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6375 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
6376 return (long)ret_conv;
6379 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint32_t e) {
6380 LDKDecodeError e_conv;
6381 e_conv.inner = (void*)(e & (~1));
6382 e_conv.is_owned = (e & 1) || (e == 0);
6383 e_conv = DecodeError_clone(&e_conv);
6384 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6385 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
6386 return (long)ret_conv;
6389 void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint32_t _res) {
6390 if ((_res & 1) != 0) return;
6391 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6393 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
6396 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) {
6397 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
6398 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
6399 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
6400 return (long)ret_conv;
6403 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) {
6404 LDKRoutingFees o_conv;
6405 o_conv.inner = (void*)(o & (~1));
6406 o_conv.is_owned = (o & 1) || (o == 0);
6407 o_conv = RoutingFees_clone(&o_conv);
6408 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6409 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
6410 return (long)ret_conv;
6413 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint32_t e) {
6414 LDKDecodeError e_conv;
6415 e_conv.inner = (void*)(e & (~1));
6416 e_conv.is_owned = (e & 1) || (e == 0);
6417 e_conv = DecodeError_clone(&e_conv);
6418 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6419 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
6420 return (long)ret_conv;
6423 void __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint32_t _res) {
6424 if ((_res & 1) != 0) return;
6425 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
6427 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
6430 uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint32_t orig) {
6431 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
6432 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
6433 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
6434 return (long)ret_conv;
6437 void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
6438 LDKCVec_NetAddressZ _res_constr;
6439 _res_constr.datalen = *((uint32_t*)_res);
6440 if (_res_constr.datalen > 0)
6441 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6443 _res_constr.data = NULL;
6444 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6445 for (size_t m = 0; m < _res_constr.datalen; m++) {
6446 uint32_t _res_conv_12 = _res_vals[m];
6447 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
6448 FREE((void*)_res_conv_12);
6449 _res_constr.data[m] = _res_conv_12_conv;
6451 CVec_NetAddressZ_free(_res_constr);
6454 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint32_t o) {
6455 LDKNodeAnnouncementInfo o_conv;
6456 o_conv.inner = (void*)(o & (~1));
6457 o_conv.is_owned = (o & 1) || (o == 0);
6458 o_conv = NodeAnnouncementInfo_clone(&o_conv);
6459 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6460 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
6461 return (long)ret_conv;
6464 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint32_t e) {
6465 LDKDecodeError e_conv;
6466 e_conv.inner = (void*)(e & (~1));
6467 e_conv.is_owned = (e & 1) || (e == 0);
6468 e_conv = DecodeError_clone(&e_conv);
6469 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6470 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
6471 return (long)ret_conv;
6474 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint32_t _res) {
6475 if ((_res & 1) != 0) return;
6476 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6478 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
6481 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint32_t orig) {
6482 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
6483 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
6484 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
6485 return (long)ret_conv;
6488 void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res) {
6489 LDKCVec_u64Z _res_constr;
6490 _res_constr.datalen = *((uint32_t*)_res);
6491 if (_res_constr.datalen > 0)
6492 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6494 _res_constr.data = NULL;
6495 int64_t* _res_vals = (int64_t*)(_res + 4);
6496 for (size_t i = 0; i < _res_constr.datalen; i++) {
6497 int64_t _res_conv_8 = _res_vals[i];
6498 _res_constr.data[i] = _res_conv_8;
6500 CVec_u64Z_free(_res_constr);
6503 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint32_t o) {
6505 o_conv.inner = (void*)(o & (~1));
6506 o_conv.is_owned = (o & 1) || (o == 0);
6507 o_conv = NodeInfo_clone(&o_conv);
6508 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6509 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
6510 return (long)ret_conv;
6513 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint32_t e) {
6514 LDKDecodeError e_conv;
6515 e_conv.inner = (void*)(e & (~1));
6516 e_conv.is_owned = (e & 1) || (e == 0);
6517 e_conv = DecodeError_clone(&e_conv);
6518 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6519 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
6520 return (long)ret_conv;
6523 void __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint32_t _res) {
6524 if ((_res & 1) != 0) return;
6525 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
6527 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
6530 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint32_t orig) {
6531 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
6532 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
6533 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
6534 return (long)ret_conv;
6537 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint32_t o) {
6538 LDKNetworkGraph o_conv;
6539 o_conv.inner = (void*)(o & (~1));
6540 o_conv.is_owned = (o & 1) || (o == 0);
6541 o_conv = NetworkGraph_clone(&o_conv);
6542 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6543 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
6544 return (long)ret_conv;
6547 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint32_t e) {
6548 LDKDecodeError e_conv;
6549 e_conv.inner = (void*)(e & (~1));
6550 e_conv.is_owned = (e & 1) || (e == 0);
6551 e_conv = DecodeError_clone(&e_conv);
6552 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6553 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
6554 return (long)ret_conv;
6557 void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint32_t _res) {
6558 if ((_res & 1) != 0) return;
6559 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
6561 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
6564 uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
6565 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
6566 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
6567 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
6568 return (long)ret_conv;
6571 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) {
6572 LDKTransaction b_ref;
6573 b_ref.datalen = *((uint32_t*)b);
6574 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
6575 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6576 b_ref.data_is_owned = true;
6577 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6578 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
6579 return (long)ret_ref;
6582 void __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_free(uint32_t _res) {
6583 if ((_res & 1) != 0) return;
6584 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
6586 C2Tuple_usizeTransactionZ_free(_res_conv);
6589 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint32_tArray _res) {
6590 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
6591 _res_constr.datalen = *((uint32_t*)_res);
6592 if (_res_constr.datalen > 0)
6593 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6595 _res_constr.data = NULL;
6596 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6597 for (size_t e = 0; e < _res_constr.datalen; e++) {
6598 uint32_t _res_conv_30 = _res_vals[e];
6599 LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1);
6600 FREE((void*)_res_conv_30);
6601 _res_constr.data[e] = _res_conv_30_conv;
6603 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
6606 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
6607 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6608 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
6609 return (long)ret_conv;
6612 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
6613 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
6614 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6615 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
6616 return (long)ret_conv;
6619 void __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint32_t _res) {
6620 if ((_res & 1) != 0) return;
6621 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
6623 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
6626 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint32_t orig) {
6627 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
6628 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6629 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
6630 return (long)ret_conv;
6633 void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_tArray _res) {
6634 LDKCVec_MonitorEventZ _res_constr;
6635 _res_constr.datalen = *((uint32_t*)_res);
6636 if (_res_constr.datalen > 0)
6637 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
6639 _res_constr.data = NULL;
6640 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6641 for (size_t o = 0; o < _res_constr.datalen; o++) {
6642 uint32_t _res_conv_14 = _res_vals[o];
6643 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
6644 FREE((void*)_res_conv_14);
6645 _res_constr.data[o] = _res_conv_14_conv;
6647 CVec_MonitorEventZ_free(_res_constr);
6650 void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _res) {
6651 LDKCVec_EventZ _res_constr;
6652 _res_constr.datalen = *((uint32_t*)_res);
6653 if (_res_constr.datalen > 0)
6654 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
6656 _res_constr.data = NULL;
6657 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6658 for (size_t h = 0; h < _res_constr.datalen; h++) {
6659 uint32_t _res_conv_7 = _res_vals[h];
6660 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
6661 FREE((void*)_res_conv_7);
6662 _res_constr.data[h] = _res_conv_7_conv;
6664 CVec_EventZ_free(_res_constr);
6667 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_ok(uint32_t o) {
6669 o_conv.inner = (void*)(o & (~1));
6670 o_conv.is_owned = (o & 1) || (o == 0);
6671 o_conv = OutPoint_clone(&o_conv);
6672 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6673 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
6674 return (long)ret_conv;
6677 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_err(uint32_t e) {
6678 LDKDecodeError e_conv;
6679 e_conv.inner = (void*)(e & (~1));
6680 e_conv.is_owned = (e & 1) || (e == 0);
6681 e_conv = DecodeError_clone(&e_conv);
6682 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6683 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
6684 return (long)ret_conv;
6687 void __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_free(uint32_t _res) {
6688 if ((_res & 1) != 0) return;
6689 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
6691 CResult_OutPointDecodeErrorZ_free(_res_conv);
6694 uint32_t __attribute__((visibility("default"))) TS_CResult_OutPointDecodeErrorZ_clone(uint32_t orig) {
6695 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
6696 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
6697 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
6698 return (long)ret_conv;
6701 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint32_t o) {
6702 LDKChannelMonitorUpdate o_conv;
6703 o_conv.inner = (void*)(o & (~1));
6704 o_conv.is_owned = (o & 1) || (o == 0);
6705 o_conv = ChannelMonitorUpdate_clone(&o_conv);
6706 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6707 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
6708 return (long)ret_conv;
6711 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint32_t e) {
6712 LDKDecodeError e_conv;
6713 e_conv.inner = (void*)(e & (~1));
6714 e_conv.is_owned = (e & 1) || (e == 0);
6715 e_conv = DecodeError_clone(&e_conv);
6716 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6717 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
6718 return (long)ret_conv;
6721 void __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint32_t _res) {
6722 if ((_res & 1) != 0) return;
6723 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6725 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
6728 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint32_t orig) {
6729 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
6730 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
6731 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
6732 return (long)ret_conv;
6735 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint32_t o) {
6736 LDKHTLCUpdate o_conv;
6737 o_conv.inner = (void*)(o & (~1));
6738 o_conv.is_owned = (o & 1) || (o == 0);
6739 o_conv = HTLCUpdate_clone(&o_conv);
6740 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6741 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
6742 return (long)ret_conv;
6745 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint32_t e) {
6746 LDKDecodeError e_conv;
6747 e_conv.inner = (void*)(e & (~1));
6748 e_conv.is_owned = (e & 1) || (e == 0);
6749 e_conv = DecodeError_clone(&e_conv);
6750 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6751 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
6752 return (long)ret_conv;
6755 void __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint32_t _res) {
6756 if ((_res & 1) != 0) return;
6757 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6759 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
6762 uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint32_t orig) {
6763 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
6764 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
6765 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
6766 return (long)ret_conv;
6769 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() {
6770 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6771 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
6772 return (long)ret_conv;
6775 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) {
6776 LDKMonitorUpdateError e_conv;
6777 e_conv.inner = (void*)(e & (~1));
6778 e_conv.is_owned = (e & 1) || (e == 0);
6779 e_conv = MonitorUpdateError_clone(&e_conv);
6780 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6781 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
6782 return (long)ret_conv;
6785 void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) {
6786 if ((_res & 1) != 0) return;
6787 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
6789 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
6792 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) {
6793 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
6794 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6795 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
6796 return (long)ret_conv;
6799 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_clone(uint32_t orig) {
6800 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
6801 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6802 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
6803 return (long)ret_ref;
6806 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_new(uint32_t a, int8_tArray b) {
6808 a_conv.inner = (void*)(a & (~1));
6809 a_conv.is_owned = (a & 1) || (a == 0);
6810 a_conv = OutPoint_clone(&a_conv);
6812 b_ref.datalen = *((uint32_t*)b);
6813 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6814 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6815 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6816 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
6817 return (long)ret_ref;
6820 void __attribute__((visibility("default"))) TS_C2Tuple_OutPointScriptZ_free(uint32_t _res) {
6821 if ((_res & 1) != 0) return;
6822 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
6824 C2Tuple_OutPointScriptZ_free(_res_conv);
6827 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_clone(uint32_t orig) {
6828 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
6829 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6830 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
6831 return (long)ret_ref;
6834 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
6836 b_ref.datalen = *((uint32_t*)b);
6837 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
6838 memcpy(b_ref.data, (uint8_t*)(b + 4), b_ref.datalen);
6839 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6840 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
6841 return (long)ret_ref;
6844 void __attribute__((visibility("default"))) TS_C2Tuple_u32ScriptZ_free(uint32_t _res) {
6845 if ((_res & 1) != 0) return;
6846 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
6848 C2Tuple_u32ScriptZ_free(_res_conv);
6851 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint32_tArray _res) {
6852 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
6853 _res_constr.datalen = *((uint32_t*)_res);
6854 if (_res_constr.datalen > 0)
6855 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6857 _res_constr.data = NULL;
6858 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6859 for (size_t e = 0; e < _res_constr.datalen; e++) {
6860 uint32_t _res_conv_30 = _res_vals[e];
6861 LDKC2Tuple_u32ScriptZ _res_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_30) & ~1);
6862 FREE((void*)_res_conv_30);
6863 _res_constr.data[e] = _res_conv_30_conv;
6865 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
6868 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint32_tArray b) {
6869 LDKThirtyTwoBytes a_ref;
6870 CHECK(*((uint32_t*)a) == 32);
6871 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6872 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
6873 b_constr.datalen = *((uint32_t*)b);
6874 if (b_constr.datalen > 0)
6875 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
6877 b_constr.data = NULL;
6878 uint32_t* b_vals = (uint32_t*)(b + 4);
6879 for (size_t e = 0; e < b_constr.datalen; e++) {
6880 uint32_t b_conv_30 = b_vals[e];
6881 LDKC2Tuple_u32ScriptZ b_conv_30_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_30) & ~1);
6882 FREE((void*)b_conv_30);
6883 b_constr.data[e] = b_conv_30_conv;
6885 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
6886 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
6887 return (long)ret_ref;
6890 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint32_t _res) {
6891 if ((_res & 1) != 0) return;
6892 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
6894 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
6897 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint32_tArray _res) {
6898 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
6899 _res_constr.datalen = *((uint32_t*)_res);
6900 if (_res_constr.datalen > 0)
6901 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
6903 _res_constr.data = NULL;
6904 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6905 for (size_t c = 0; c < _res_constr.datalen; c++) {
6906 uint32_t _res_conv_54 = _res_vals[c];
6907 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_54_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_54) & ~1);
6908 FREE((void*)_res_conv_54);
6909 _res_constr.data[c] = _res_conv_54_conv;
6911 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
6914 void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res) {
6915 LDKCVec_TransactionZ _res_constr;
6916 _res_constr.datalen = *((uint32_t*)_res);
6917 if (_res_constr.datalen > 0)
6918 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6920 _res_constr.data = NULL;
6921 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
6922 for (size_t m = 0; m < _res_constr.datalen; m++) {
6923 int8_tArray _res_conv_12 = _res_vals[m];
6924 LDKTransaction _res_conv_12_ref;
6925 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
6926 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
6927 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
6928 _res_conv_12_ref.data_is_owned = true;
6929 _res_constr.data[m] = _res_conv_12_ref;
6931 CVec_TransactionZ_free(_res_constr);
6934 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_clone(uint32_t orig) {
6935 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
6936 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6937 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
6938 return (long)ret_ref;
6941 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
6942 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
6944 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6945 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
6946 return (long)ret_ref;
6949 void __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_free(uint32_t _res) {
6950 if ((_res & 1) != 0) return;
6951 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
6953 C2Tuple_u32TxOutZ_free(_res_conv);
6956 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint32_tArray _res) {
6957 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
6958 _res_constr.datalen = *((uint32_t*)_res);
6959 if (_res_constr.datalen > 0)
6960 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6962 _res_constr.data = NULL;
6963 uint32_t* _res_vals = (uint32_t*)(_res + 4);
6964 for (size_t z = 0; z < _res_constr.datalen; z++) {
6965 uint32_t _res_conv_25 = _res_vals[z];
6966 LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1);
6967 FREE((void*)_res_conv_25);
6968 _res_constr.data[z] = _res_conv_25_conv;
6970 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
6973 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint32_tArray b) {
6974 LDKThirtyTwoBytes a_ref;
6975 CHECK(*((uint32_t*)a) == 32);
6976 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
6977 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
6978 b_constr.datalen = *((uint32_t*)b);
6979 if (b_constr.datalen > 0)
6980 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
6982 b_constr.data = NULL;
6983 uint32_t* b_vals = (uint32_t*)(b + 4);
6984 for (size_t z = 0; z < b_constr.datalen; z++) {
6985 uint32_t b_conv_25 = b_vals[z];
6986 LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1);
6987 FREE((void*)b_conv_25);
6988 b_constr.data[z] = b_conv_25_conv;
6990 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
6991 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
6992 return (long)ret_ref;
6995 void __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint32_t _res) {
6996 if ((_res & 1) != 0) return;
6997 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
6999 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
7002 void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint32_tArray _res) {
7003 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
7004 _res_constr.datalen = *((uint32_t*)_res);
7005 if (_res_constr.datalen > 0)
7006 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
7008 _res_constr.data = NULL;
7009 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7010 for (size_t x = 0; x < _res_constr.datalen; x++) {
7011 uint32_t _res_conv_49 = _res_vals[x];
7012 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1);
7013 FREE((void*)_res_conv_49);
7014 _res_constr.data[x] = _res_conv_49_conv;
7016 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
7019 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint32_t b) {
7020 LDKThirtyTwoBytes a_ref;
7021 CHECK(*((uint32_t*)a) == 32);
7022 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
7023 LDKChannelMonitor b_conv;
7024 b_conv.inner = (void*)(b & (~1));
7025 b_conv.is_owned = (b & 1) || (b == 0);
7026 b_conv = ChannelMonitor_clone(&b_conv);
7027 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7028 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
7029 return (long)ret_ref;
7032 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint32_t _res) {
7033 if ((_res & 1) != 0) return;
7034 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
7036 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
7039 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
7040 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
7042 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7043 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
7044 return (long)ret_conv;
7047 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint32_t e) {
7048 LDKDecodeError e_conv;
7049 e_conv.inner = (void*)(e & (~1));
7050 e_conv.is_owned = (e & 1) || (e == 0);
7051 e_conv = DecodeError_clone(&e_conv);
7052 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
7053 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
7054 return (long)ret_conv;
7057 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint32_t _res) {
7058 if ((_res & 1) != 0) return;
7059 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7061 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
7064 void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
7065 LDKCVec_SpendableOutputDescriptorZ _res_constr;
7066 _res_constr.datalen = *((uint32_t*)_res);
7067 if (_res_constr.datalen > 0)
7068 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
7070 _res_constr.data = NULL;
7071 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7072 for (size_t b = 0; b < _res_constr.datalen; b++) {
7073 uint32_t _res_conv_27 = _res_vals[b];
7074 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
7075 FREE((void*)_res_conv_27);
7076 _res_constr.data[b] = _res_conv_27_conv;
7078 CVec_SpendableOutputDescriptorZ_free(_res_constr);
7081 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
7082 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
7084 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7085 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
7086 return (long)ret_conv;
7089 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
7090 LDKAccessError e_conv = LDKAccessError_from_js(e);
7091 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7092 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
7093 return (long)ret_conv;
7096 void __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_free(uint32_t _res) {
7097 if ((_res & 1) != 0) return;
7098 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
7100 CResult_TxOutAccessErrorZ_free(_res_conv);
7103 uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_clone(uint32_t orig) {
7104 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
7105 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7106 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
7107 return (long)ret_conv;
7110 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
7111 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
7113 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7114 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
7115 long ret_ref = (long)ret_copy;
7119 uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_none() {
7120 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7121 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
7122 long ret_ref = (long)ret_copy;
7126 void __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_free(uint32_t _res) {
7127 if ((_res & 1) != 0) return;
7128 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
7130 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
7133 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_ok() {
7134 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7135 *ret_conv = CResult_NoneAPIErrorZ_ok();
7136 return (long)ret_conv;
7139 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
7140 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
7142 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7143 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
7144 return (long)ret_conv;
7147 void __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_free(uint32_t _res) {
7148 if ((_res & 1) != 0) return;
7149 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
7151 CResult_NoneAPIErrorZ_free(_res_conv);
7154 uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone(uint32_t orig) {
7155 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
7156 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7157 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
7158 return (long)ret_conv;
7161 void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) {
7162 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
7163 _res_constr.datalen = *((uint32_t*)_res);
7164 if (_res_constr.datalen > 0)
7165 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
7167 _res_constr.data = NULL;
7168 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7169 for (size_t w = 0; w < _res_constr.datalen; w++) {
7170 uint32_t _res_conv_22 = _res_vals[w];
7171 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
7172 FREE((void*)_res_conv_22);
7173 _res_constr.data[w] = _res_conv_22_conv;
7175 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
7178 void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) {
7179 LDKCVec_APIErrorZ _res_constr;
7180 _res_constr.datalen = *((uint32_t*)_res);
7181 if (_res_constr.datalen > 0)
7182 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
7184 _res_constr.data = NULL;
7185 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7186 for (size_t k = 0; k < _res_constr.datalen; k++) {
7187 uint32_t _res_conv_10 = _res_vals[k];
7188 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
7189 FREE((void*)_res_conv_10);
7190 _res_constr.data[k] = _res_conv_10_conv;
7192 CVec_APIErrorZ_free(_res_constr);
7195 void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) {
7196 LDKCVec_ChannelDetailsZ _res_constr;
7197 _res_constr.datalen = *((uint32_t*)_res);
7198 if (_res_constr.datalen > 0)
7199 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7201 _res_constr.data = NULL;
7202 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7203 for (size_t q = 0; q < _res_constr.datalen; q++) {
7204 uint32_t _res_conv_16 = _res_vals[q];
7205 LDKChannelDetails _res_conv_16_conv;
7206 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7207 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7208 _res_constr.data[q] = _res_conv_16_conv;
7210 CVec_ChannelDetailsZ_free(_res_constr);
7213 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() {
7214 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7215 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
7216 return (long)ret_conv;
7219 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
7220 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
7222 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7223 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
7224 return (long)ret_conv;
7227 void __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_free(uint32_t _res) {
7228 if ((_res & 1) != 0) return;
7229 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
7231 CResult_NonePaymentSendFailureZ_free(_res_conv);
7234 uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_clone(uint32_t orig) {
7235 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
7236 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7237 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
7238 return (long)ret_conv;
7241 void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) {
7242 LDKCVec_ChannelMonitorZ _res_constr;
7243 _res_constr.datalen = *((uint32_t*)_res);
7244 if (_res_constr.datalen > 0)
7245 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7247 _res_constr.data = NULL;
7248 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7249 for (size_t q = 0; q < _res_constr.datalen; q++) {
7250 uint32_t _res_conv_16 = _res_vals[q];
7251 LDKChannelMonitor _res_conv_16_conv;
7252 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7253 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7254 _res_constr.data[q] = _res_conv_16_conv;
7256 CVec_ChannelMonitorZ_free(_res_constr);
7259 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint32_t b) {
7260 LDKThirtyTwoBytes a_ref;
7261 CHECK(*((uint32_t*)a) == 32);
7262 memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
7263 LDKChannelManager b_conv;
7264 b_conv.inner = (void*)(b & (~1));
7265 b_conv.is_owned = (b & 1) || (b == 0);
7266 // Warning: we need a move here but no clone is available for LDKChannelManager
7267 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
7268 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
7269 return (long)ret_ref;
7272 void __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint32_t _res) {
7273 if ((_res & 1) != 0) return;
7274 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
7276 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
7279 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
7280 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
7282 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7283 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
7284 return (long)ret_conv;
7287 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint32_t e) {
7288 LDKDecodeError e_conv;
7289 e_conv.inner = (void*)(e & (~1));
7290 e_conv.is_owned = (e & 1) || (e == 0);
7291 e_conv = DecodeError_clone(&e_conv);
7292 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
7293 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
7294 return (long)ret_conv;
7297 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint32_t _res) {
7298 if ((_res & 1) != 0) return;
7299 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7301 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
7304 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
7305 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
7307 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7308 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
7309 return (long)ret_conv;
7312 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint32_t e) {
7313 LDKDecodeError e_conv;
7314 e_conv.inner = (void*)(e & (~1));
7315 e_conv.is_owned = (e & 1) || (e == 0);
7316 e_conv = DecodeError_clone(&e_conv);
7317 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7318 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
7319 return (long)ret_conv;
7322 void __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint32_t _res) {
7323 if ((_res & 1) != 0) return;
7324 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
7326 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
7329 uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint32_t orig) {
7330 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
7331 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
7332 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
7333 return (long)ret_conv;
7336 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
7337 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
7338 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7339 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
7340 return (long)ret_ref;
7343 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
7345 CHECK(*((uint32_t*)a) == 64);
7346 memcpy(a_ref.compact_form, (uint8_t*)(a + 4), 64);
7347 LDKCVec_SignatureZ b_constr;
7348 b_constr.datalen = *((uint32_t*)b);
7349 if (b_constr.datalen > 0)
7350 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7352 b_constr.data = NULL;
7353 int8_tArray* b_vals = (int8_tArray*)(b + 4);
7354 for (size_t m = 0; m < b_constr.datalen; m++) {
7355 int8_tArray b_conv_12 = b_vals[m];
7356 LDKSignature b_conv_12_ref;
7357 CHECK(*((uint32_t*)b_conv_12) == 64);
7358 memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64);
7359 b_constr.data[m] = b_conv_12_ref;
7361 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
7362 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
7363 return (long)ret_ref;
7366 void __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint32_t _res) {
7367 if ((_res & 1) != 0) return;
7368 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
7370 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
7373 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
7374 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
7376 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7377 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
7378 return (long)ret_conv;
7381 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
7382 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7383 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
7384 return (long)ret_conv;
7387 void __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint32_t _res) {
7388 if ((_res & 1) != 0) return;
7389 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
7391 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
7394 uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint32_t orig) {
7395 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
7396 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
7397 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
7398 return (long)ret_conv;
7401 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
7403 CHECK(*((uint32_t*)o) == 64);
7404 memcpy(o_ref.compact_form, (uint8_t*)(o + 4), 64);
7405 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7406 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
7407 return (long)ret_conv;
7410 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_err() {
7411 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7412 *ret_conv = CResult_SignatureNoneZ_err();
7413 return (long)ret_conv;
7416 void __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_free(uint32_t _res) {
7417 if ((_res & 1) != 0) return;
7418 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
7420 CResult_SignatureNoneZ_free(_res_conv);
7423 uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone(uint32_t orig) {
7424 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
7425 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
7426 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
7427 return (long)ret_conv;
7430 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) {
7431 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
7432 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7433 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
7434 return (long)ret_conv;
7437 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_err(uint32_t e) {
7438 LDKDecodeError e_conv;
7439 e_conv.inner = (void*)(e & (~1));
7440 e_conv.is_owned = (e & 1) || (e == 0);
7441 e_conv = DecodeError_clone(&e_conv);
7442 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7443 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
7444 return (long)ret_conv;
7447 void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) {
7448 if ((_res & 1) != 0) return;
7449 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
7451 CResult_SignDecodeErrorZ_free(_res_conv);
7454 uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) {
7455 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
7456 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
7457 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
7458 return (long)ret_conv;
7461 void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
7462 LDKCVec_CVec_u8ZZ _res_constr;
7463 _res_constr.datalen = *((uint32_t*)_res);
7464 if (_res_constr.datalen > 0)
7465 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7467 _res_constr.data = NULL;
7468 int8_tArray* _res_vals = (int8_tArray*)(_res + 4);
7469 for (size_t m = 0; m < _res_constr.datalen; m++) {
7470 int8_tArray _res_conv_12 = _res_vals[m];
7471 LDKCVec_u8Z _res_conv_12_ref;
7472 _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12);
7473 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7474 memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen);
7475 _res_constr.data[m] = _res_conv_12_ref;
7477 CVec_CVec_u8ZZ_free(_res_constr);
7480 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
7481 LDKCVec_CVec_u8ZZ o_constr;
7482 o_constr.datalen = *((uint32_t*)o);
7483 if (o_constr.datalen > 0)
7484 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
7486 o_constr.data = NULL;
7487 int8_tArray* o_vals = (int8_tArray*)(o + 4);
7488 for (size_t m = 0; m < o_constr.datalen; m++) {
7489 int8_tArray o_conv_12 = o_vals[m];
7490 LDKCVec_u8Z o_conv_12_ref;
7491 o_conv_12_ref.datalen = *((uint32_t*)o_conv_12);
7492 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
7493 memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen);
7494 o_constr.data[m] = o_conv_12_ref;
7496 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7497 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
7498 return (long)ret_conv;
7501 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
7502 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7503 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
7504 return (long)ret_conv;
7507 void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) {
7508 if ((_res & 1) != 0) return;
7509 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
7511 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
7514 uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) {
7515 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
7516 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
7517 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
7518 return (long)ret_conv;
7521 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) {
7522 LDKInMemorySigner o_conv;
7523 o_conv.inner = (void*)(o & (~1));
7524 o_conv.is_owned = (o & 1) || (o == 0);
7525 o_conv = InMemorySigner_clone(&o_conv);
7526 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7527 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
7528 return (long)ret_conv;
7531 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint32_t e) {
7532 LDKDecodeError e_conv;
7533 e_conv.inner = (void*)(e & (~1));
7534 e_conv.is_owned = (e & 1) || (e == 0);
7535 e_conv = DecodeError_clone(&e_conv);
7536 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7537 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
7538 return (long)ret_conv;
7541 void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) {
7542 if ((_res & 1) != 0) return;
7543 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
7545 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
7548 uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) {
7549 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
7550 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
7551 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
7552 return (long)ret_conv;
7555 void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) {
7556 LDKCVec_TxOutZ _res_constr;
7557 _res_constr.datalen = *((uint32_t*)_res);
7558 if (_res_constr.datalen > 0)
7559 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
7561 _res_constr.data = NULL;
7562 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7563 for (size_t h = 0; h < _res_constr.datalen; h++) {
7564 uint32_t _res_conv_7 = _res_vals[h];
7565 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
7566 FREE((void*)_res_conv_7);
7567 _res_constr.data[h] = _res_conv_7_conv;
7569 CVec_TxOutZ_free(_res_constr);
7572 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
7573 LDKTransaction o_ref;
7574 o_ref.datalen = *((uint32_t*)o);
7575 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
7576 memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen);
7577 o_ref.data_is_owned = true;
7578 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7579 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
7580 return (long)ret_conv;
7583 uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() {
7584 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
7585 *ret_conv = CResult_TransactionNoneZ_err();
7586 return (long)ret_conv;
7589 void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) {
7590 if ((_res & 1) != 0) return;
7591 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
7593 CResult_TransactionNoneZ_free(_res_conv);
7596 void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) {
7597 LDKCVec_RouteHopZ _res_constr;
7598 _res_constr.datalen = *((uint32_t*)_res);
7599 if (_res_constr.datalen > 0)
7600 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7602 _res_constr.data = NULL;
7603 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7604 for (size_t k = 0; k < _res_constr.datalen; k++) {
7605 uint32_t _res_conv_10 = _res_vals[k];
7606 LDKRouteHop _res_conv_10_conv;
7607 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
7608 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
7609 _res_constr.data[k] = _res_conv_10_conv;
7611 CVec_RouteHopZ_free(_res_constr);
7614 void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
7615 LDKCVec_CVec_RouteHopZZ _res_constr;
7616 _res_constr.datalen = *((uint32_t*)_res);
7617 if (_res_constr.datalen > 0)
7618 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7620 _res_constr.data = NULL;
7621 uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4);
7622 for (size_t m = 0; m < _res_constr.datalen; m++) {
7623 uint32_tArray _res_conv_12 = _res_vals[m];
7624 LDKCVec_RouteHopZ _res_conv_12_constr;
7625 _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12);
7626 if (_res_conv_12_constr.datalen > 0)
7627 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7629 _res_conv_12_constr.data = NULL;
7630 uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4);
7631 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
7632 uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
7633 LDKRouteHop _res_conv_12_conv_10_conv;
7634 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
7635 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
7636 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
7638 _res_constr.data[m] = _res_conv_12_constr;
7640 CVec_CVec_RouteHopZZ_free(_res_constr);
7643 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_ok(uint32_t o) {
7645 o_conv.inner = (void*)(o & (~1));
7646 o_conv.is_owned = (o & 1) || (o == 0);
7647 o_conv = Route_clone(&o_conv);
7648 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7649 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7650 return (long)ret_conv;
7653 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_err(uint32_t e) {
7654 LDKDecodeError e_conv;
7655 e_conv.inner = (void*)(e & (~1));
7656 e_conv.is_owned = (e & 1) || (e == 0);
7657 e_conv = DecodeError_clone(&e_conv);
7658 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7659 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7660 return (long)ret_conv;
7663 void __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_free(uint32_t _res) {
7664 if ((_res & 1) != 0) return;
7665 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7667 CResult_RouteDecodeErrorZ_free(_res_conv);
7670 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteDecodeErrorZ_clone(uint32_t orig) {
7671 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
7672 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7673 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
7674 return (long)ret_conv;
7677 void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArray _res) {
7678 LDKCVec_RouteHintZ _res_constr;
7679 _res_constr.datalen = *((uint32_t*)_res);
7680 if (_res_constr.datalen > 0)
7681 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7683 _res_constr.data = NULL;
7684 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7685 for (size_t l = 0; l < _res_constr.datalen; l++) {
7686 uint32_t _res_conv_11 = _res_vals[l];
7687 LDKRouteHint _res_conv_11_conv;
7688 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
7689 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
7690 _res_constr.data[l] = _res_conv_11_conv;
7692 CVec_RouteHintZ_free(_res_constr);
7695 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_ok(uint32_t o) {
7697 o_conv.inner = (void*)(o & (~1));
7698 o_conv.is_owned = (o & 1) || (o == 0);
7699 o_conv = Route_clone(&o_conv);
7700 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7701 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7702 return (long)ret_conv;
7705 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_err(uint32_t e) {
7706 LDKLightningError e_conv;
7707 e_conv.inner = (void*)(e & (~1));
7708 e_conv.is_owned = (e & 1) || (e == 0);
7709 e_conv = LightningError_clone(&e_conv);
7710 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7711 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7712 return (long)ret_conv;
7715 void __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_free(uint32_t _res) {
7716 if ((_res & 1) != 0) return;
7717 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7719 CResult_RouteLightningErrorZ_free(_res_conv);
7722 uint32_t __attribute__((visibility("default"))) TS_CResult_RouteLightningErrorZ_clone(uint32_t orig) {
7723 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
7724 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7725 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
7726 return (long)ret_conv;
7729 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
7730 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
7732 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7733 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
7734 return (long)ret_conv;
7737 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_err(int8_t e) {
7738 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7739 *ret_conv = CResult_NetAddressu8Z_err(e);
7740 return (long)ret_conv;
7743 void __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_free(uint32_t _res) {
7744 if ((_res & 1) != 0) return;
7745 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
7747 CResult_NetAddressu8Z_free(_res_conv);
7750 uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_clone(uint32_t orig) {
7751 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
7752 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
7753 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
7754 return (long)ret_conv;
7757 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
7758 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
7760 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7761 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
7762 return (long)ret_conv;
7765 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_err(uint32_t e) {
7766 LDKDecodeError e_conv;
7767 e_conv.inner = (void*)(e & (~1));
7768 e_conv.is_owned = (e & 1) || (e == 0);
7769 e_conv = DecodeError_clone(&e_conv);
7770 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7771 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
7772 return (long)ret_conv;
7775 void __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_free(uint32_t _res) {
7776 if ((_res & 1) != 0) return;
7777 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
7779 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
7782 uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(uint32_t orig) {
7783 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
7784 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
7785 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
7786 return (long)ret_conv;
7789 void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_tArray _res) {
7790 LDKCVec_UpdateAddHTLCZ _res_constr;
7791 _res_constr.datalen = *((uint32_t*)_res);
7792 if (_res_constr.datalen > 0)
7793 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
7795 _res_constr.data = NULL;
7796 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7797 for (size_t p = 0; p < _res_constr.datalen; p++) {
7798 uint32_t _res_conv_15 = _res_vals[p];
7799 LDKUpdateAddHTLC _res_conv_15_conv;
7800 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
7801 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
7802 _res_constr.data[p] = _res_conv_15_conv;
7804 CVec_UpdateAddHTLCZ_free(_res_constr);
7807 void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uint32_tArray _res) {
7808 LDKCVec_UpdateFulfillHTLCZ _res_constr;
7809 _res_constr.datalen = *((uint32_t*)_res);
7810 if (_res_constr.datalen > 0)
7811 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
7813 _res_constr.data = NULL;
7814 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7815 for (size_t t = 0; t < _res_constr.datalen; t++) {
7816 uint32_t _res_conv_19 = _res_vals[t];
7817 LDKUpdateFulfillHTLC _res_conv_19_conv;
7818 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
7819 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
7820 _res_constr.data[t] = _res_conv_19_conv;
7822 CVec_UpdateFulfillHTLCZ_free(_res_constr);
7825 void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32_tArray _res) {
7826 LDKCVec_UpdateFailHTLCZ _res_constr;
7827 _res_constr.datalen = *((uint32_t*)_res);
7828 if (_res_constr.datalen > 0)
7829 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
7831 _res_constr.data = NULL;
7832 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7833 for (size_t q = 0; q < _res_constr.datalen; q++) {
7834 uint32_t _res_conv_16 = _res_vals[q];
7835 LDKUpdateFailHTLC _res_conv_16_conv;
7836 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
7837 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
7838 _res_constr.data[q] = _res_conv_16_conv;
7840 CVec_UpdateFailHTLCZ_free(_res_constr);
7843 void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint32_tArray _res) {
7844 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
7845 _res_constr.datalen = *((uint32_t*)_res);
7846 if (_res_constr.datalen > 0)
7847 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
7849 _res_constr.data = NULL;
7850 uint32_t* _res_vals = (uint32_t*)(_res + 4);
7851 for (size_t z = 0; z < _res_constr.datalen; z++) {
7852 uint32_t _res_conv_25 = _res_vals[z];
7853 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
7854 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
7855 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
7856 _res_constr.data[z] = _res_conv_25_conv;
7858 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
7861 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint32_t o) {
7862 LDKAcceptChannel o_conv;
7863 o_conv.inner = (void*)(o & (~1));
7864 o_conv.is_owned = (o & 1) || (o == 0);
7865 o_conv = AcceptChannel_clone(&o_conv);
7866 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7867 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
7868 return (long)ret_conv;
7871 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint32_t e) {
7872 LDKDecodeError e_conv;
7873 e_conv.inner = (void*)(e & (~1));
7874 e_conv.is_owned = (e & 1) || (e == 0);
7875 e_conv = DecodeError_clone(&e_conv);
7876 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7877 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
7878 return (long)ret_conv;
7881 void __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint32_t _res) {
7882 if ((_res & 1) != 0) return;
7883 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
7885 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
7888 uint32_t __attribute__((visibility("default"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint32_t orig) {
7889 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
7890 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
7891 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
7892 return (long)ret_conv;
7895 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint32_t o) {
7896 LDKAnnouncementSignatures o_conv;
7897 o_conv.inner = (void*)(o & (~1));
7898 o_conv.is_owned = (o & 1) || (o == 0);
7899 o_conv = AnnouncementSignatures_clone(&o_conv);
7900 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7901 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
7902 return (long)ret_conv;
7905 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint32_t e) {
7906 LDKDecodeError e_conv;
7907 e_conv.inner = (void*)(e & (~1));
7908 e_conv.is_owned = (e & 1) || (e == 0);
7909 e_conv = DecodeError_clone(&e_conv);
7910 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7911 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
7912 return (long)ret_conv;
7915 void __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint32_t _res) {
7916 if ((_res & 1) != 0) return;
7917 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7919 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
7922 uint32_t __attribute__((visibility("default"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint32_t orig) {
7923 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
7924 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
7925 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
7926 return (long)ret_conv;
7929 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint32_t o) {
7930 LDKChannelReestablish o_conv;
7931 o_conv.inner = (void*)(o & (~1));
7932 o_conv.is_owned = (o & 1) || (o == 0);
7933 o_conv = ChannelReestablish_clone(&o_conv);
7934 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7935 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
7936 return (long)ret_conv;
7939 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint32_t e) {
7940 LDKDecodeError e_conv;
7941 e_conv.inner = (void*)(e & (~1));
7942 e_conv.is_owned = (e & 1) || (e == 0);
7943 e_conv = DecodeError_clone(&e_conv);
7944 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7945 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
7946 return (long)ret_conv;
7949 void __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint32_t _res) {
7950 if ((_res & 1) != 0) return;
7951 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
7953 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
7956 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint32_t orig) {
7957 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
7958 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
7959 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
7960 return (long)ret_conv;
7963 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint32_t o) {
7964 LDKClosingSigned o_conv;
7965 o_conv.inner = (void*)(o & (~1));
7966 o_conv.is_owned = (o & 1) || (o == 0);
7967 o_conv = ClosingSigned_clone(&o_conv);
7968 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7969 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
7970 return (long)ret_conv;
7973 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint32_t e) {
7974 LDKDecodeError e_conv;
7975 e_conv.inner = (void*)(e & (~1));
7976 e_conv.is_owned = (e & 1) || (e == 0);
7977 e_conv = DecodeError_clone(&e_conv);
7978 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7979 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
7980 return (long)ret_conv;
7983 void __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint32_t _res) {
7984 if ((_res & 1) != 0) return;
7985 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
7987 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
7990 uint32_t __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint32_t orig) {
7991 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
7992 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
7993 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
7994 return (long)ret_conv;
7997 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
7998 LDKCommitmentSigned o_conv;
7999 o_conv.inner = (void*)(o & (~1));
8000 o_conv.is_owned = (o & 1) || (o == 0);
8001 o_conv = CommitmentSigned_clone(&o_conv);
8002 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8003 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
8004 return (long)ret_conv;
8007 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint32_t e) {
8008 LDKDecodeError e_conv;
8009 e_conv.inner = (void*)(e & (~1));
8010 e_conv.is_owned = (e & 1) || (e == 0);
8011 e_conv = DecodeError_clone(&e_conv);
8012 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8013 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
8014 return (long)ret_conv;
8017 void __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint32_t _res) {
8018 if ((_res & 1) != 0) return;
8019 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8021 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
8024 uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint32_t orig) {
8025 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
8026 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
8027 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
8028 return (long)ret_conv;
8031 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint32_t o) {
8032 LDKFundingCreated o_conv;
8033 o_conv.inner = (void*)(o & (~1));
8034 o_conv.is_owned = (o & 1) || (o == 0);
8035 o_conv = FundingCreated_clone(&o_conv);
8036 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8037 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
8038 return (long)ret_conv;
8041 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint32_t e) {
8042 LDKDecodeError e_conv;
8043 e_conv.inner = (void*)(e & (~1));
8044 e_conv.is_owned = (e & 1) || (e == 0);
8045 e_conv = DecodeError_clone(&e_conv);
8046 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8047 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
8048 return (long)ret_conv;
8051 void __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint32_t _res) {
8052 if ((_res & 1) != 0) return;
8053 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8055 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
8058 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint32_t orig) {
8059 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
8060 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
8061 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
8062 return (long)ret_conv;
8065 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint32_t o) {
8066 LDKFundingSigned o_conv;
8067 o_conv.inner = (void*)(o & (~1));
8068 o_conv.is_owned = (o & 1) || (o == 0);
8069 o_conv = FundingSigned_clone(&o_conv);
8070 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8071 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
8072 return (long)ret_conv;
8075 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint32_t e) {
8076 LDKDecodeError e_conv;
8077 e_conv.inner = (void*)(e & (~1));
8078 e_conv.is_owned = (e & 1) || (e == 0);
8079 e_conv = DecodeError_clone(&e_conv);
8080 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8081 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
8082 return (long)ret_conv;
8085 void __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint32_t _res) {
8086 if ((_res & 1) != 0) return;
8087 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8089 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
8092 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint32_t orig) {
8093 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
8094 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
8095 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
8096 return (long)ret_conv;
8099 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_ok(uint32_t o) {
8100 LDKFundingLocked o_conv;
8101 o_conv.inner = (void*)(o & (~1));
8102 o_conv.is_owned = (o & 1) || (o == 0);
8103 o_conv = FundingLocked_clone(&o_conv);
8104 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8105 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
8106 return (long)ret_conv;
8109 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_err(uint32_t e) {
8110 LDKDecodeError e_conv;
8111 e_conv.inner = (void*)(e & (~1));
8112 e_conv.is_owned = (e & 1) || (e == 0);
8113 e_conv = DecodeError_clone(&e_conv);
8114 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8115 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
8116 return (long)ret_conv;
8119 void __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_free(uint32_t _res) {
8120 if ((_res & 1) != 0) return;
8121 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
8123 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
8126 uint32_t __attribute__((visibility("default"))) TS_CResult_FundingLockedDecodeErrorZ_clone(uint32_t orig) {
8127 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
8128 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
8129 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
8130 return (long)ret_conv;
8133 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_ok(uint32_t o) {
8135 o_conv.inner = (void*)(o & (~1));
8136 o_conv.is_owned = (o & 1) || (o == 0);
8137 o_conv = Init_clone(&o_conv);
8138 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8139 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
8140 return (long)ret_conv;
8143 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_err(uint32_t e) {
8144 LDKDecodeError e_conv;
8145 e_conv.inner = (void*)(e & (~1));
8146 e_conv.is_owned = (e & 1) || (e == 0);
8147 e_conv = DecodeError_clone(&e_conv);
8148 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8149 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
8150 return (long)ret_conv;
8153 void __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_free(uint32_t _res) {
8154 if ((_res & 1) != 0) return;
8155 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
8157 CResult_InitDecodeErrorZ_free(_res_conv);
8160 uint32_t __attribute__((visibility("default"))) TS_CResult_InitDecodeErrorZ_clone(uint32_t orig) {
8161 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
8162 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
8163 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
8164 return (long)ret_conv;
8167 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint32_t o) {
8168 LDKOpenChannel o_conv;
8169 o_conv.inner = (void*)(o & (~1));
8170 o_conv.is_owned = (o & 1) || (o == 0);
8171 o_conv = OpenChannel_clone(&o_conv);
8172 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8173 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
8174 return (long)ret_conv;
8177 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint32_t e) {
8178 LDKDecodeError e_conv;
8179 e_conv.inner = (void*)(e & (~1));
8180 e_conv.is_owned = (e & 1) || (e == 0);
8181 e_conv = DecodeError_clone(&e_conv);
8182 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8183 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
8184 return (long)ret_conv;
8187 void __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint32_t _res) {
8188 if ((_res & 1) != 0) return;
8189 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
8191 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
8194 uint32_t __attribute__((visibility("default"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint32_t orig) {
8195 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
8196 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
8197 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
8198 return (long)ret_conv;
8201 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint32_t o) {
8202 LDKRevokeAndACK o_conv;
8203 o_conv.inner = (void*)(o & (~1));
8204 o_conv.is_owned = (o & 1) || (o == 0);
8205 o_conv = RevokeAndACK_clone(&o_conv);
8206 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8207 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
8208 return (long)ret_conv;
8211 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint32_t e) {
8212 LDKDecodeError e_conv;
8213 e_conv.inner = (void*)(e & (~1));
8214 e_conv.is_owned = (e & 1) || (e == 0);
8215 e_conv = DecodeError_clone(&e_conv);
8216 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8217 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
8218 return (long)ret_conv;
8221 void __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint32_t _res) {
8222 if ((_res & 1) != 0) return;
8223 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
8225 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
8228 uint32_t __attribute__((visibility("default"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint32_t orig) {
8229 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
8230 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
8231 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
8232 return (long)ret_conv;
8235 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint32_t o) {
8237 o_conv.inner = (void*)(o & (~1));
8238 o_conv.is_owned = (o & 1) || (o == 0);
8239 o_conv = Shutdown_clone(&o_conv);
8240 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8241 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
8242 return (long)ret_conv;
8245 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_err(uint32_t e) {
8246 LDKDecodeError e_conv;
8247 e_conv.inner = (void*)(e & (~1));
8248 e_conv.is_owned = (e & 1) || (e == 0);
8249 e_conv = DecodeError_clone(&e_conv);
8250 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8251 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
8252 return (long)ret_conv;
8255 void __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_free(uint32_t _res) {
8256 if ((_res & 1) != 0) return;
8257 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
8259 CResult_ShutdownDecodeErrorZ_free(_res_conv);
8262 uint32_t __attribute__((visibility("default"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint32_t orig) {
8263 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
8264 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
8265 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
8266 return (long)ret_conv;
8269 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint32_t o) {
8270 LDKUpdateFailHTLC o_conv;
8271 o_conv.inner = (void*)(o & (~1));
8272 o_conv.is_owned = (o & 1) || (o == 0);
8273 o_conv = UpdateFailHTLC_clone(&o_conv);
8274 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8275 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
8276 return (long)ret_conv;
8279 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint32_t e) {
8280 LDKDecodeError e_conv;
8281 e_conv.inner = (void*)(e & (~1));
8282 e_conv.is_owned = (e & 1) || (e == 0);
8283 e_conv = DecodeError_clone(&e_conv);
8284 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8285 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
8286 return (long)ret_conv;
8289 void __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint32_t _res) {
8290 if ((_res & 1) != 0) return;
8291 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8293 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
8296 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint32_t orig) {
8297 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
8298 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
8299 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
8300 return (long)ret_conv;
8303 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint32_t o) {
8304 LDKUpdateFailMalformedHTLC o_conv;
8305 o_conv.inner = (void*)(o & (~1));
8306 o_conv.is_owned = (o & 1) || (o == 0);
8307 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
8308 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8309 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
8310 return (long)ret_conv;
8313 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint32_t e) {
8314 LDKDecodeError e_conv;
8315 e_conv.inner = (void*)(e & (~1));
8316 e_conv.is_owned = (e & 1) || (e == 0);
8317 e_conv = DecodeError_clone(&e_conv);
8318 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8319 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
8320 return (long)ret_conv;
8323 void __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint32_t _res) {
8324 if ((_res & 1) != 0) return;
8325 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8327 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
8330 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint32_t orig) {
8331 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
8332 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
8333 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
8334 return (long)ret_conv;
8337 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint32_t o) {
8338 LDKUpdateFee o_conv;
8339 o_conv.inner = (void*)(o & (~1));
8340 o_conv.is_owned = (o & 1) || (o == 0);
8341 o_conv = UpdateFee_clone(&o_conv);
8342 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8343 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
8344 return (long)ret_conv;
8347 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint32_t e) {
8348 LDKDecodeError e_conv;
8349 e_conv.inner = (void*)(e & (~1));
8350 e_conv.is_owned = (e & 1) || (e == 0);
8351 e_conv = DecodeError_clone(&e_conv);
8352 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8353 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
8354 return (long)ret_conv;
8357 void __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint32_t _res) {
8358 if ((_res & 1) != 0) return;
8359 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8361 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
8364 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint32_t orig) {
8365 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
8366 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
8367 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
8368 return (long)ret_conv;
8371 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint32_t o) {
8372 LDKUpdateFulfillHTLC o_conv;
8373 o_conv.inner = (void*)(o & (~1));
8374 o_conv.is_owned = (o & 1) || (o == 0);
8375 o_conv = UpdateFulfillHTLC_clone(&o_conv);
8376 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8377 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
8378 return (long)ret_conv;
8381 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint32_t e) {
8382 LDKDecodeError e_conv;
8383 e_conv.inner = (void*)(e & (~1));
8384 e_conv.is_owned = (e & 1) || (e == 0);
8385 e_conv = DecodeError_clone(&e_conv);
8386 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8387 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
8388 return (long)ret_conv;
8391 void __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint32_t _res) {
8392 if ((_res & 1) != 0) return;
8393 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8395 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
8398 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint32_t orig) {
8399 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
8400 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
8401 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
8402 return (long)ret_conv;
8405 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint32_t o) {
8406 LDKUpdateAddHTLC o_conv;
8407 o_conv.inner = (void*)(o & (~1));
8408 o_conv.is_owned = (o & 1) || (o == 0);
8409 o_conv = UpdateAddHTLC_clone(&o_conv);
8410 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8411 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
8412 return (long)ret_conv;
8415 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint32_t e) {
8416 LDKDecodeError e_conv;
8417 e_conv.inner = (void*)(e & (~1));
8418 e_conv.is_owned = (e & 1) || (e == 0);
8419 e_conv = DecodeError_clone(&e_conv);
8420 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8421 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
8422 return (long)ret_conv;
8425 void __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint32_t _res) {
8426 if ((_res & 1) != 0) return;
8427 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
8429 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
8432 uint32_t __attribute__((visibility("default"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint32_t orig) {
8433 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
8434 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
8435 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
8436 return (long)ret_conv;
8439 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_ok(uint32_t o) {
8441 o_conv.inner = (void*)(o & (~1));
8442 o_conv.is_owned = (o & 1) || (o == 0);
8443 o_conv = Ping_clone(&o_conv);
8444 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8445 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
8446 return (long)ret_conv;
8449 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_err(uint32_t e) {
8450 LDKDecodeError e_conv;
8451 e_conv.inner = (void*)(e & (~1));
8452 e_conv.is_owned = (e & 1) || (e == 0);
8453 e_conv = DecodeError_clone(&e_conv);
8454 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8455 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
8456 return (long)ret_conv;
8459 void __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_free(uint32_t _res) {
8460 if ((_res & 1) != 0) return;
8461 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
8463 CResult_PingDecodeErrorZ_free(_res_conv);
8466 uint32_t __attribute__((visibility("default"))) TS_CResult_PingDecodeErrorZ_clone(uint32_t orig) {
8467 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
8468 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
8469 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
8470 return (long)ret_conv;
8473 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_ok(uint32_t o) {
8475 o_conv.inner = (void*)(o & (~1));
8476 o_conv.is_owned = (o & 1) || (o == 0);
8477 o_conv = Pong_clone(&o_conv);
8478 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8479 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
8480 return (long)ret_conv;
8483 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_err(uint32_t e) {
8484 LDKDecodeError e_conv;
8485 e_conv.inner = (void*)(e & (~1));
8486 e_conv.is_owned = (e & 1) || (e == 0);
8487 e_conv = DecodeError_clone(&e_conv);
8488 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8489 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
8490 return (long)ret_conv;
8493 void __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_free(uint32_t _res) {
8494 if ((_res & 1) != 0) return;
8495 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
8497 CResult_PongDecodeErrorZ_free(_res_conv);
8500 uint32_t __attribute__((visibility("default"))) TS_CResult_PongDecodeErrorZ_clone(uint32_t orig) {
8501 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
8502 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
8503 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
8504 return (long)ret_conv;
8507 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8508 LDKUnsignedChannelAnnouncement o_conv;
8509 o_conv.inner = (void*)(o & (~1));
8510 o_conv.is_owned = (o & 1) || (o == 0);
8511 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
8512 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8513 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
8514 return (long)ret_conv;
8517 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8518 LDKDecodeError e_conv;
8519 e_conv.inner = (void*)(e & (~1));
8520 e_conv.is_owned = (e & 1) || (e == 0);
8521 e_conv = DecodeError_clone(&e_conv);
8522 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8523 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
8524 return (long)ret_conv;
8527 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8528 if ((_res & 1) != 0) return;
8529 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8531 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
8534 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8535 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8536 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
8537 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8538 return (long)ret_conv;
8541 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint32_t o) {
8542 LDKChannelAnnouncement o_conv;
8543 o_conv.inner = (void*)(o & (~1));
8544 o_conv.is_owned = (o & 1) || (o == 0);
8545 o_conv = ChannelAnnouncement_clone(&o_conv);
8546 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8547 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
8548 return (long)ret_conv;
8551 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint32_t e) {
8552 LDKDecodeError e_conv;
8553 e_conv.inner = (void*)(e & (~1));
8554 e_conv.is_owned = (e & 1) || (e == 0);
8555 e_conv = DecodeError_clone(&e_conv);
8556 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8557 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
8558 return (long)ret_conv;
8561 void __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint32_t _res) {
8562 if ((_res & 1) != 0) return;
8563 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8565 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
8568 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8569 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
8570 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
8571 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
8572 return (long)ret_conv;
8575 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8576 LDKUnsignedChannelUpdate o_conv;
8577 o_conv.inner = (void*)(o & (~1));
8578 o_conv.is_owned = (o & 1) || (o == 0);
8579 o_conv = UnsignedChannelUpdate_clone(&o_conv);
8580 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8581 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
8582 return (long)ret_conv;
8585 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint32_t e) {
8586 LDKDecodeError e_conv;
8587 e_conv.inner = (void*)(e & (~1));
8588 e_conv.is_owned = (e & 1) || (e == 0);
8589 e_conv = DecodeError_clone(&e_conv);
8590 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8591 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
8592 return (long)ret_conv;
8595 void __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8596 if ((_res & 1) != 0) return;
8597 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8599 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
8602 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8603 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
8604 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
8605 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
8606 return (long)ret_conv;
8609 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint32_t o) {
8610 LDKChannelUpdate o_conv;
8611 o_conv.inner = (void*)(o & (~1));
8612 o_conv.is_owned = (o & 1) || (o == 0);
8613 o_conv = ChannelUpdate_clone(&o_conv);
8614 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8615 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
8616 return (long)ret_conv;
8619 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint32_t e) {
8620 LDKDecodeError e_conv;
8621 e_conv.inner = (void*)(e & (~1));
8622 e_conv.is_owned = (e & 1) || (e == 0);
8623 e_conv = DecodeError_clone(&e_conv);
8624 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8625 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
8626 return (long)ret_conv;
8629 void __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint32_t _res) {
8630 if ((_res & 1) != 0) return;
8631 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
8633 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
8636 uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint32_t orig) {
8637 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
8638 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
8639 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
8640 return (long)ret_conv;
8643 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint32_t o) {
8644 LDKErrorMessage o_conv;
8645 o_conv.inner = (void*)(o & (~1));
8646 o_conv.is_owned = (o & 1) || (o == 0);
8647 o_conv = ErrorMessage_clone(&o_conv);
8648 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8649 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
8650 return (long)ret_conv;
8653 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint32_t e) {
8654 LDKDecodeError e_conv;
8655 e_conv.inner = (void*)(e & (~1));
8656 e_conv.is_owned = (e & 1) || (e == 0);
8657 e_conv = DecodeError_clone(&e_conv);
8658 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8659 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
8660 return (long)ret_conv;
8663 void __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint32_t _res) {
8664 if ((_res & 1) != 0) return;
8665 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
8667 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
8670 uint32_t __attribute__((visibility("default"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint32_t orig) {
8671 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
8672 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
8673 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
8674 return (long)ret_conv;
8677 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8678 LDKUnsignedNodeAnnouncement o_conv;
8679 o_conv.inner = (void*)(o & (~1));
8680 o_conv.is_owned = (o & 1) || (o == 0);
8681 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
8682 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8683 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
8684 return (long)ret_conv;
8687 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8688 LDKDecodeError e_conv;
8689 e_conv.inner = (void*)(e & (~1));
8690 e_conv.is_owned = (e & 1) || (e == 0);
8691 e_conv = DecodeError_clone(&e_conv);
8692 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8693 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
8694 return (long)ret_conv;
8697 void __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8698 if ((_res & 1) != 0) return;
8699 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8701 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
8704 uint32_t __attribute__((visibility("default"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8705 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
8706 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
8707 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
8708 return (long)ret_conv;
8711 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint32_t o) {
8712 LDKNodeAnnouncement o_conv;
8713 o_conv.inner = (void*)(o & (~1));
8714 o_conv.is_owned = (o & 1) || (o == 0);
8715 o_conv = NodeAnnouncement_clone(&o_conv);
8716 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8717 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
8718 return (long)ret_conv;
8721 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint32_t e) {
8722 LDKDecodeError e_conv;
8723 e_conv.inner = (void*)(e & (~1));
8724 e_conv.is_owned = (e & 1) || (e == 0);
8725 e_conv = DecodeError_clone(&e_conv);
8726 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8727 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
8728 return (long)ret_conv;
8731 void __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint32_t _res) {
8732 if ((_res & 1) != 0) return;
8733 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
8735 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
8738 uint32_t __attribute__((visibility("default"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint32_t orig) {
8739 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
8740 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
8741 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
8742 return (long)ret_conv;
8745 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint32_t o) {
8746 LDKQueryShortChannelIds o_conv;
8747 o_conv.inner = (void*)(o & (~1));
8748 o_conv.is_owned = (o & 1) || (o == 0);
8749 o_conv = QueryShortChannelIds_clone(&o_conv);
8750 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8751 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
8752 return (long)ret_conv;
8755 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint32_t e) {
8756 LDKDecodeError e_conv;
8757 e_conv.inner = (void*)(e & (~1));
8758 e_conv.is_owned = (e & 1) || (e == 0);
8759 e_conv = DecodeError_clone(&e_conv);
8760 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8761 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
8762 return (long)ret_conv;
8765 void __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint32_t _res) {
8766 if ((_res & 1) != 0) return;
8767 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
8769 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
8772 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint32_t orig) {
8773 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
8774 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
8775 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
8776 return (long)ret_conv;
8779 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint32_t o) {
8780 LDKReplyShortChannelIdsEnd o_conv;
8781 o_conv.inner = (void*)(o & (~1));
8782 o_conv.is_owned = (o & 1) || (o == 0);
8783 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
8784 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8785 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
8786 return (long)ret_conv;
8789 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint32_t e) {
8790 LDKDecodeError e_conv;
8791 e_conv.inner = (void*)(e & (~1));
8792 e_conv.is_owned = (e & 1) || (e == 0);
8793 e_conv = DecodeError_clone(&e_conv);
8794 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8795 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
8796 return (long)ret_conv;
8799 void __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint32_t _res) {
8800 if ((_res & 1) != 0) return;
8801 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
8803 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
8806 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint32_t orig) {
8807 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
8808 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
8809 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
8810 return (long)ret_conv;
8813 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint32_t o) {
8814 LDKQueryChannelRange o_conv;
8815 o_conv.inner = (void*)(o & (~1));
8816 o_conv.is_owned = (o & 1) || (o == 0);
8817 o_conv = QueryChannelRange_clone(&o_conv);
8818 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8819 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
8820 return (long)ret_conv;
8823 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint32_t e) {
8824 LDKDecodeError e_conv;
8825 e_conv.inner = (void*)(e & (~1));
8826 e_conv.is_owned = (e & 1) || (e == 0);
8827 e_conv = DecodeError_clone(&e_conv);
8828 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8829 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
8830 return (long)ret_conv;
8833 void __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint32_t _res) {
8834 if ((_res & 1) != 0) return;
8835 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8837 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
8840 uint32_t __attribute__((visibility("default"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8841 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
8842 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
8843 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
8844 return (long)ret_conv;
8847 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint32_t o) {
8848 LDKReplyChannelRange o_conv;
8849 o_conv.inner = (void*)(o & (~1));
8850 o_conv.is_owned = (o & 1) || (o == 0);
8851 o_conv = ReplyChannelRange_clone(&o_conv);
8852 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8853 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
8854 return (long)ret_conv;
8857 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint32_t e) {
8858 LDKDecodeError e_conv;
8859 e_conv.inner = (void*)(e & (~1));
8860 e_conv.is_owned = (e & 1) || (e == 0);
8861 e_conv = DecodeError_clone(&e_conv);
8862 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8863 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
8864 return (long)ret_conv;
8867 void __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint32_t _res) {
8868 if ((_res & 1) != 0) return;
8869 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
8871 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
8874 uint32_t __attribute__((visibility("default"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint32_t orig) {
8875 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
8876 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
8877 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
8878 return (long)ret_conv;
8881 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint32_t o) {
8882 LDKGossipTimestampFilter o_conv;
8883 o_conv.inner = (void*)(o & (~1));
8884 o_conv.is_owned = (o & 1) || (o == 0);
8885 o_conv = GossipTimestampFilter_clone(&o_conv);
8886 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8887 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
8888 return (long)ret_conv;
8891 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint32_t e) {
8892 LDKDecodeError e_conv;
8893 e_conv.inner = (void*)(e & (~1));
8894 e_conv.is_owned = (e & 1) || (e == 0);
8895 e_conv = DecodeError_clone(&e_conv);
8896 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8897 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
8898 return (long)ret_conv;
8901 void __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint32_t _res) {
8902 if ((_res & 1) != 0) return;
8903 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
8905 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
8908 uint32_t __attribute__((visibility("default"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint32_t orig) {
8909 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
8910 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
8911 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
8912 return (long)ret_conv;
8915 void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
8916 if ((this_ptr & 1) != 0) return;
8917 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
8918 FREE((void*)this_ptr);
8919 Event_free(this_ptr_conv);
8922 uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) {
8923 LDKEvent* orig_conv = (LDKEvent*)orig;
8924 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8925 *ret_copy = Event_clone(orig_conv);
8926 long ret_ref = (long)ret_copy;
8930 int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
8931 LDKEvent* obj_conv = (LDKEvent*)obj;
8932 LDKCVec_u8Z ret_var = Event_write(obj_conv);
8933 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
8934 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
8935 CVec_u8Z_free(ret_var);
8939 void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) {
8940 if ((this_ptr & 1) != 0) return;
8941 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
8942 FREE((void*)this_ptr);
8943 MessageSendEvent_free(this_ptr_conv);
8946 uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_clone(uint32_t orig) {
8947 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
8948 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8949 *ret_copy = MessageSendEvent_clone(orig_conv);
8950 long ret_ref = (long)ret_copy;
8954 void __attribute__((visibility("default"))) TS_MessageSendEventsProvider_free(uint32_t this_ptr) {
8955 if ((this_ptr & 1) != 0) return;
8956 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
8957 FREE((void*)this_ptr);
8958 MessageSendEventsProvider_free(this_ptr_conv);
8961 void __attribute__((visibility("default"))) TS_EventsProvider_free(uint32_t this_ptr) {
8962 if ((this_ptr & 1) != 0) return;
8963 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
8964 FREE((void*)this_ptr);
8965 EventsProvider_free(this_ptr_conv);
8968 void __attribute__((visibility("default"))) TS_APIError_free(uint32_t this_ptr) {
8969 if ((this_ptr & 1) != 0) return;
8970 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
8971 FREE((void*)this_ptr);
8972 APIError_free(this_ptr_conv);
8975 uint32_t __attribute__((visibility("default"))) TS_APIError_clone(uint32_t orig) {
8976 LDKAPIError* orig_conv = (LDKAPIError*)orig;
8977 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8978 *ret_copy = APIError_clone(orig_conv);
8979 long ret_ref = (long)ret_copy;
8983 uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) {
8984 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
8985 uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
8989 uint32_t __attribute__((visibility("default"))) TS_Level_max() {
8990 uint32_t ret_conv = LDKLevel_to_js(Level_max());
8994 void __attribute__((visibility("default"))) TS_Logger_free(uint32_t this_ptr) {
8995 if ((this_ptr & 1) != 0) return;
8996 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
8997 FREE((void*)this_ptr);
8998 Logger_free(this_ptr_conv);
9001 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_free(uint32_t this_obj) {
9002 LDKChannelHandshakeConfig this_obj_conv;
9003 this_obj_conv.inner = (void*)(this_obj & (~1));
9004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9005 ChannelHandshakeConfig_free(this_obj_conv);
9008 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint32_t this_ptr) {
9009 LDKChannelHandshakeConfig this_ptr_conv;
9010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9011 this_ptr_conv.is_owned = false;
9012 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
9016 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint32_t this_ptr, int32_t val) {
9017 LDKChannelHandshakeConfig this_ptr_conv;
9018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9019 this_ptr_conv.is_owned = false;
9020 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
9023 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint32_t this_ptr) {
9024 LDKChannelHandshakeConfig this_ptr_conv;
9025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9026 this_ptr_conv.is_owned = false;
9027 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
9031 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_to_self_delay(uint32_t this_ptr, int16_t val) {
9032 LDKChannelHandshakeConfig this_ptr_conv;
9033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9034 this_ptr_conv.is_owned = false;
9035 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
9038 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint32_t this_ptr) {
9039 LDKChannelHandshakeConfig this_ptr_conv;
9040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9041 this_ptr_conv.is_owned = false;
9042 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
9046 void __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_set_our_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
9047 LDKChannelHandshakeConfig this_ptr_conv;
9048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9049 this_ptr_conv.is_owned = false;
9050 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
9053 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) {
9054 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
9055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9057 long ret_ref = (long)ret_var.inner;
9058 if (ret_var.is_owned) {
9064 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_clone(uint32_t orig) {
9065 LDKChannelHandshakeConfig orig_conv;
9066 orig_conv.inner = (void*)(orig & (~1));
9067 orig_conv.is_owned = false;
9068 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
9069 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9070 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9071 long ret_ref = (long)ret_var.inner;
9072 if (ret_var.is_owned) {
9078 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeConfig_default() {
9079 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
9080 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9081 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9082 long ret_ref = (long)ret_var.inner;
9083 if (ret_var.is_owned) {
9089 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_free(uint32_t this_obj) {
9090 LDKChannelHandshakeLimits this_obj_conv;
9091 this_obj_conv.inner = (void*)(this_obj & (~1));
9092 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9093 ChannelHandshakeLimits_free(this_obj_conv);
9096 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint32_t this_ptr) {
9097 LDKChannelHandshakeLimits this_ptr_conv;
9098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9099 this_ptr_conv.is_owned = false;
9100 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
9104 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint32_t this_ptr, int64_t val) {
9105 LDKChannelHandshakeLimits this_ptr_conv;
9106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9107 this_ptr_conv.is_owned = false;
9108 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
9111 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint32_t this_ptr) {
9112 LDKChannelHandshakeLimits this_ptr_conv;
9113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9114 this_ptr_conv.is_owned = false;
9115 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
9119 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
9120 LDKChannelHandshakeLimits this_ptr_conv;
9121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9122 this_ptr_conv.is_owned = false;
9123 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
9126 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
9127 LDKChannelHandshakeLimits this_ptr_conv;
9128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9129 this_ptr_conv.is_owned = false;
9130 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
9134 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
9135 LDKChannelHandshakeLimits this_ptr_conv;
9136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9137 this_ptr_conv.is_owned = false;
9138 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9141 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint32_t this_ptr) {
9142 LDKChannelHandshakeLimits this_ptr_conv;
9143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9144 this_ptr_conv.is_owned = false;
9145 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
9149 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
9150 LDKChannelHandshakeLimits this_ptr_conv;
9151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9152 this_ptr_conv.is_owned = false;
9153 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
9156 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint32_t this_ptr) {
9157 LDKChannelHandshakeLimits this_ptr_conv;
9158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9159 this_ptr_conv.is_owned = false;
9160 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
9164 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
9165 LDKChannelHandshakeLimits this_ptr_conv;
9166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9167 this_ptr_conv.is_owned = false;
9168 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
9171 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_min_dust_limit_satoshis(uint32_t this_ptr) {
9172 LDKChannelHandshakeLimits this_ptr_conv;
9173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9174 this_ptr_conv.is_owned = false;
9175 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
9179 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_min_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9180 LDKChannelHandshakeLimits this_ptr_conv;
9181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9182 this_ptr_conv.is_owned = false;
9183 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
9186 int64_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_dust_limit_satoshis(uint32_t this_ptr) {
9187 LDKChannelHandshakeLimits this_ptr_conv;
9188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9189 this_ptr_conv.is_owned = false;
9190 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
9194 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
9195 LDKChannelHandshakeLimits this_ptr_conv;
9196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9197 this_ptr_conv.is_owned = false;
9198 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
9201 int32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint32_t this_ptr) {
9202 LDKChannelHandshakeLimits this_ptr_conv;
9203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9204 this_ptr_conv.is_owned = false;
9205 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
9209 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint32_t this_ptr, int32_t val) {
9210 LDKChannelHandshakeLimits this_ptr_conv;
9211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9212 this_ptr_conv.is_owned = false;
9213 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
9216 jboolean __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint32_t this_ptr) {
9217 LDKChannelHandshakeLimits this_ptr_conv;
9218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9219 this_ptr_conv.is_owned = false;
9220 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
9224 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint32_t this_ptr, jboolean val) {
9225 LDKChannelHandshakeLimits this_ptr_conv;
9226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9227 this_ptr_conv.is_owned = false;
9228 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
9231 int16_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint32_t this_ptr) {
9232 LDKChannelHandshakeLimits this_ptr_conv;
9233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9234 this_ptr_conv.is_owned = false;
9235 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
9239 void __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_set_their_to_self_delay(uint32_t this_ptr, int16_t val) {
9240 LDKChannelHandshakeLimits this_ptr_conv;
9241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9242 this_ptr_conv.is_owned = false;
9243 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
9246 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) {
9247 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);
9248 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9249 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9250 long ret_ref = (long)ret_var.inner;
9251 if (ret_var.is_owned) {
9257 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_clone(uint32_t orig) {
9258 LDKChannelHandshakeLimits orig_conv;
9259 orig_conv.inner = (void*)(orig & (~1));
9260 orig_conv.is_owned = false;
9261 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
9262 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9263 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9264 long ret_ref = (long)ret_var.inner;
9265 if (ret_var.is_owned) {
9271 uint32_t __attribute__((visibility("default"))) TS_ChannelHandshakeLimits_default() {
9272 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
9273 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9274 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9275 long ret_ref = (long)ret_var.inner;
9276 if (ret_var.is_owned) {
9282 void __attribute__((visibility("default"))) TS_ChannelConfig_free(uint32_t this_obj) {
9283 LDKChannelConfig this_obj_conv;
9284 this_obj_conv.inner = (void*)(this_obj & (~1));
9285 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9286 ChannelConfig_free(this_obj_conv);
9289 int32_t __attribute__((visibility("default"))) TS_ChannelConfig_get_fee_proportional_millionths(uint32_t this_ptr) {
9290 LDKChannelConfig this_ptr_conv;
9291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9292 this_ptr_conv.is_owned = false;
9293 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
9297 void __attribute__((visibility("default"))) TS_ChannelConfig_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
9298 LDKChannelConfig this_ptr_conv;
9299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9300 this_ptr_conv.is_owned = false;
9301 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
9304 int16_t __attribute__((visibility("default"))) TS_ChannelConfig_get_cltv_expiry_delta(uint32_t this_ptr) {
9305 LDKChannelConfig this_ptr_conv;
9306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9307 this_ptr_conv.is_owned = false;
9308 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
9312 void __attribute__((visibility("default"))) TS_ChannelConfig_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
9313 LDKChannelConfig this_ptr_conv;
9314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9315 this_ptr_conv.is_owned = false;
9316 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
9319 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_announced_channel(uint32_t this_ptr) {
9320 LDKChannelConfig this_ptr_conv;
9321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9322 this_ptr_conv.is_owned = false;
9323 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
9327 void __attribute__((visibility("default"))) TS_ChannelConfig_set_announced_channel(uint32_t this_ptr, jboolean val) {
9328 LDKChannelConfig this_ptr_conv;
9329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9330 this_ptr_conv.is_owned = false;
9331 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
9334 jboolean __attribute__((visibility("default"))) TS_ChannelConfig_get_commit_upfront_shutdown_pubkey(uint32_t this_ptr) {
9335 LDKChannelConfig this_ptr_conv;
9336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9337 this_ptr_conv.is_owned = false;
9338 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
9342 void __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront_shutdown_pubkey(uint32_t this_ptr, jboolean val) {
9343 LDKChannelConfig this_ptr_conv;
9344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9345 this_ptr_conv.is_owned = false;
9346 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
9349 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
9350 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
9351 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9352 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9353 long ret_ref = (long)ret_var.inner;
9354 if (ret_var.is_owned) {
9360 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_clone(uint32_t orig) {
9361 LDKChannelConfig orig_conv;
9362 orig_conv.inner = (void*)(orig & (~1));
9363 orig_conv.is_owned = false;
9364 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
9365 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9366 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9367 long ret_ref = (long)ret_var.inner;
9368 if (ret_var.is_owned) {
9374 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_default() {
9375 LDKChannelConfig ret_var = ChannelConfig_default();
9376 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9377 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9378 long ret_ref = (long)ret_var.inner;
9379 if (ret_var.is_owned) {
9385 int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint32_t obj) {
9386 LDKChannelConfig obj_conv;
9387 obj_conv.inner = (void*)(obj & (~1));
9388 obj_conv.is_owned = false;
9389 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
9390 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9391 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9392 CVec_u8Z_free(ret_var);
9396 uint32_t __attribute__((visibility("default"))) TS_ChannelConfig_read(int8_tArray ser) {
9398 ser_ref.datalen = *((uint32_t*)ser);
9399 ser_ref.data = (int8_t*)(ser + 4);
9400 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
9401 *ret_conv = ChannelConfig_read(ser_ref);
9402 return (long)ret_conv;
9405 void __attribute__((visibility("default"))) TS_UserConfig_free(uint32_t this_obj) {
9406 LDKUserConfig this_obj_conv;
9407 this_obj_conv.inner = (void*)(this_obj & (~1));
9408 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9409 UserConfig_free(this_obj_conv);
9412 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_own_channel_config(uint32_t this_ptr) {
9413 LDKUserConfig this_ptr_conv;
9414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9415 this_ptr_conv.is_owned = false;
9416 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
9417 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9418 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9419 long ret_ref = (long)ret_var.inner;
9420 if (ret_var.is_owned) {
9426 void __attribute__((visibility("default"))) TS_UserConfig_set_own_channel_config(uint32_t this_ptr, uint32_t val) {
9427 LDKUserConfig this_ptr_conv;
9428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9429 this_ptr_conv.is_owned = false;
9430 LDKChannelHandshakeConfig val_conv;
9431 val_conv.inner = (void*)(val & (~1));
9432 val_conv.is_owned = (val & 1) || (val == 0);
9433 val_conv = ChannelHandshakeConfig_clone(&val_conv);
9434 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
9437 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_peer_channel_config_limits(uint32_t this_ptr) {
9438 LDKUserConfig this_ptr_conv;
9439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9440 this_ptr_conv.is_owned = false;
9441 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
9442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9444 long ret_ref = (long)ret_var.inner;
9445 if (ret_var.is_owned) {
9451 void __attribute__((visibility("default"))) TS_UserConfig_set_peer_channel_config_limits(uint32_t this_ptr, uint32_t val) {
9452 LDKUserConfig this_ptr_conv;
9453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9454 this_ptr_conv.is_owned = false;
9455 LDKChannelHandshakeLimits val_conv;
9456 val_conv.inner = (void*)(val & (~1));
9457 val_conv.is_owned = (val & 1) || (val == 0);
9458 val_conv = ChannelHandshakeLimits_clone(&val_conv);
9459 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
9462 uint32_t __attribute__((visibility("default"))) TS_UserConfig_get_channel_options(uint32_t this_ptr) {
9463 LDKUserConfig this_ptr_conv;
9464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9465 this_ptr_conv.is_owned = false;
9466 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
9467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9469 long ret_ref = (long)ret_var.inner;
9470 if (ret_var.is_owned) {
9476 void __attribute__((visibility("default"))) TS_UserConfig_set_channel_options(uint32_t this_ptr, uint32_t val) {
9477 LDKUserConfig this_ptr_conv;
9478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9479 this_ptr_conv.is_owned = false;
9480 LDKChannelConfig val_conv;
9481 val_conv.inner = (void*)(val & (~1));
9482 val_conv.is_owned = (val & 1) || (val == 0);
9483 val_conv = ChannelConfig_clone(&val_conv);
9484 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
9487 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) {
9488 LDKChannelHandshakeConfig own_channel_config_arg_conv;
9489 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
9490 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
9491 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
9492 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
9493 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
9494 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
9495 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
9496 LDKChannelConfig channel_options_arg_conv;
9497 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
9498 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
9499 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
9500 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
9501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9503 long ret_ref = (long)ret_var.inner;
9504 if (ret_var.is_owned) {
9510 uint32_t __attribute__((visibility("default"))) TS_UserConfig_clone(uint32_t orig) {
9511 LDKUserConfig orig_conv;
9512 orig_conv.inner = (void*)(orig & (~1));
9513 orig_conv.is_owned = false;
9514 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
9515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9517 long ret_ref = (long)ret_var.inner;
9518 if (ret_var.is_owned) {
9524 uint32_t __attribute__((visibility("default"))) TS_UserConfig_default() {
9525 LDKUserConfig ret_var = UserConfig_default();
9526 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9527 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9528 long ret_ref = (long)ret_var.inner;
9529 if (ret_var.is_owned) {
9535 uint32_t __attribute__((visibility("default"))) TS_AccessError_clone(uint32_t orig) {
9536 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
9537 uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
9541 void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) {
9542 if ((this_ptr & 1) != 0) return;
9543 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
9544 FREE((void*)this_ptr);
9545 Access_free(this_ptr_conv);
9548 void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) {
9549 if ((this_ptr & 1) != 0) return;
9550 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
9551 FREE((void*)this_ptr);
9552 Listen_free(this_ptr_conv);
9555 void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) {
9556 if ((this_ptr & 1) != 0) return;
9557 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
9558 FREE((void*)this_ptr);
9559 Watch_free(this_ptr_conv);
9562 void __attribute__((visibility("default"))) TS_Filter_free(uint32_t this_ptr) {
9563 if ((this_ptr & 1) != 0) return;
9564 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
9565 FREE((void*)this_ptr);
9566 Filter_free(this_ptr_conv);
9569 void __attribute__((visibility("default"))) TS_WatchedOutput_free(uint32_t this_obj) {
9570 LDKWatchedOutput this_obj_conv;
9571 this_obj_conv.inner = (void*)(this_obj & (~1));
9572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9573 WatchedOutput_free(this_obj_conv);
9576 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_block_hash(uint32_t this_ptr) {
9577 LDKWatchedOutput this_ptr_conv;
9578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9579 this_ptr_conv.is_owned = false;
9580 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
9581 memcpy((uint8_t*)(ret_arr + 4), WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
9585 void __attribute__((visibility("default"))) TS_WatchedOutput_set_block_hash(uint32_t this_ptr, int8_tArray val) {
9586 LDKWatchedOutput this_ptr_conv;
9587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9588 this_ptr_conv.is_owned = false;
9589 LDKThirtyTwoBytes val_ref;
9590 CHECK(*((uint32_t*)val) == 32);
9591 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
9592 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
9595 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_get_outpoint(uint32_t this_ptr) {
9596 LDKWatchedOutput this_ptr_conv;
9597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9598 this_ptr_conv.is_owned = false;
9599 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_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 void __attribute__((visibility("default"))) TS_WatchedOutput_set_outpoint(uint32_t this_ptr, uint32_t val) {
9610 LDKWatchedOutput this_ptr_conv;
9611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9612 this_ptr_conv.is_owned = false;
9613 LDKOutPoint val_conv;
9614 val_conv.inner = (void*)(val & (~1));
9615 val_conv.is_owned = (val & 1) || (val == 0);
9616 val_conv = OutPoint_clone(&val_conv);
9617 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
9620 int8_tArray __attribute__((visibility("default"))) TS_WatchedOutput_get_script_pubkey(uint32_t this_ptr) {
9621 LDKWatchedOutput this_ptr_conv;
9622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9623 this_ptr_conv.is_owned = false;
9624 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
9625 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9626 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9630 void __attribute__((visibility("default"))) TS_WatchedOutput_set_script_pubkey(uint32_t this_ptr, int8_tArray val) {
9631 LDKWatchedOutput this_ptr_conv;
9632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9633 this_ptr_conv.is_owned = false;
9634 LDKCVec_u8Z val_ref;
9635 val_ref.datalen = *((uint32_t*)val);
9636 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9637 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
9638 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
9641 uint32_t __attribute__((visibility("default"))) TS_WatchedOutput_new(int8_tArray block_hash_arg, uint32_t outpoint_arg, int8_tArray script_pubkey_arg) {
9642 LDKThirtyTwoBytes block_hash_arg_ref;
9643 CHECK(*((uint32_t*)block_hash_arg) == 32);
9644 memcpy(block_hash_arg_ref.data, (uint8_t*)(block_hash_arg + 4), 32);
9645 LDKOutPoint outpoint_arg_conv;
9646 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
9647 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
9648 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
9649 LDKCVec_u8Z script_pubkey_arg_ref;
9650 script_pubkey_arg_ref.datalen = *((uint32_t*)script_pubkey_arg);
9651 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9652 memcpy(script_pubkey_arg_ref.data, (uint8_t*)(script_pubkey_arg + 4), script_pubkey_arg_ref.datalen);
9653 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
9654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9656 long ret_ref = (long)ret_var.inner;
9657 if (ret_var.is_owned) {
9663 void __attribute__((visibility("default"))) TS_BroadcasterInterface_free(uint32_t this_ptr) {
9664 if ((this_ptr & 1) != 0) return;
9665 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
9666 FREE((void*)this_ptr);
9667 BroadcasterInterface_free(this_ptr_conv);
9670 uint32_t __attribute__((visibility("default"))) TS_ConfirmationTarget_clone(uint32_t orig) {
9671 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
9672 uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
9676 void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
9677 if ((this_ptr & 1) != 0) return;
9678 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
9679 FREE((void*)this_ptr);
9680 FeeEstimator_free(this_ptr_conv);
9683 void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) {
9684 LDKChainMonitor this_obj_conv;
9685 this_obj_conv.inner = (void*)(this_obj & (~1));
9686 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9687 ChainMonitor_free(this_obj_conv);
9690 void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
9691 LDKChainMonitor this_arg_conv;
9692 this_arg_conv.inner = (void*)(this_arg & (~1));
9693 this_arg_conv.is_owned = false;
9694 unsigned char header_arr[80];
9695 CHECK(*((uint32_t*)header) == 80);
9696 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9697 unsigned char (*header_ref)[80] = &header_arr;
9698 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9699 txdata_constr.datalen = *((uint32_t*)txdata);
9700 if (txdata_constr.datalen > 0)
9701 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9703 txdata_constr.data = NULL;
9704 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
9705 for (size_t e = 0; e < txdata_constr.datalen; e++) {
9706 uint32_t txdata_conv_30 = txdata_vals[e];
9707 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
9708 FREE((void*)txdata_conv_30);
9709 txdata_constr.data[e] = txdata_conv_30_conv;
9711 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9714 void __attribute__((visibility("default"))) TS_ChainMonitor_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t disconnected_height) {
9715 LDKChainMonitor this_arg_conv;
9716 this_arg_conv.inner = (void*)(this_arg & (~1));
9717 this_arg_conv.is_owned = false;
9718 unsigned char header_arr[80];
9719 CHECK(*((uint32_t*)header) == 80);
9720 memcpy(header_arr, (uint8_t*)(header + 4), 80);
9721 unsigned char (*header_ref)[80] = &header_arr;
9722 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
9725 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
9726 LDKFilter *chain_source_conv_ptr = NULL;
9727 if (chain_source != 0) {
9728 LDKFilter chain_source_conv;
9729 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
9730 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9731 *chain_source_conv_ptr = chain_source_conv;
9733 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9734 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9735 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
9736 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
9737 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
9738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9740 long ret_ref = (long)ret_var.inner;
9741 if (ret_var.is_owned) {
9747 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
9748 LDKChainMonitor this_arg_conv;
9749 this_arg_conv.inner = (void*)(this_arg & (~1));
9750 this_arg_conv.is_owned = false;
9751 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
9752 *ret = ChainMonitor_as_Watch(&this_arg_conv);
9756 uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
9757 LDKChainMonitor this_arg_conv;
9758 this_arg_conv.inner = (void*)(this_arg & (~1));
9759 this_arg_conv.is_owned = false;
9760 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9761 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
9765 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
9766 LDKChannelMonitorUpdate this_obj_conv;
9767 this_obj_conv.inner = (void*)(this_obj & (~1));
9768 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9769 ChannelMonitorUpdate_free(this_obj_conv);
9772 int64_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_get_update_id(uint32_t this_ptr) {
9773 LDKChannelMonitorUpdate this_ptr_conv;
9774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9775 this_ptr_conv.is_owned = false;
9776 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
9780 void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_set_update_id(uint32_t this_ptr, int64_t val) {
9781 LDKChannelMonitorUpdate this_ptr_conv;
9782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9783 this_ptr_conv.is_owned = false;
9784 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
9787 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_clone(uint32_t orig) {
9788 LDKChannelMonitorUpdate orig_conv;
9789 orig_conv.inner = (void*)(orig & (~1));
9790 orig_conv.is_owned = false;
9791 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
9792 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9793 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9794 long ret_ref = (long)ret_var.inner;
9795 if (ret_var.is_owned) {
9801 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_write(uint32_t obj) {
9802 LDKChannelMonitorUpdate obj_conv;
9803 obj_conv.inner = (void*)(obj & (~1));
9804 obj_conv.is_owned = false;
9805 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
9806 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9807 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9808 CVec_u8Z_free(ret_var);
9812 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
9814 ser_ref.datalen = *((uint32_t*)ser);
9815 ser_ref.data = (int8_t*)(ser + 4);
9816 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
9817 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
9818 return (long)ret_conv;
9821 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) {
9822 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
9823 uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
9827 void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) {
9828 LDKMonitorUpdateError this_obj_conv;
9829 this_obj_conv.inner = (void*)(this_obj & (~1));
9830 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9831 MonitorUpdateError_free(this_obj_conv);
9834 uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) {
9835 LDKMonitorUpdateError orig_conv;
9836 orig_conv.inner = (void*)(orig & (~1));
9837 orig_conv.is_owned = false;
9838 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
9839 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9840 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9841 long ret_ref = (long)ret_var.inner;
9842 if (ret_var.is_owned) {
9848 void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) {
9849 if ((this_ptr & 1) != 0) return;
9850 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
9851 FREE((void*)this_ptr);
9852 MonitorEvent_free(this_ptr_conv);
9855 uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) {
9856 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
9857 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
9858 *ret_copy = MonitorEvent_clone(orig_conv);
9859 long ret_ref = (long)ret_copy;
9863 void __attribute__((visibility("default"))) TS_HTLCUpdate_free(uint32_t this_obj) {
9864 LDKHTLCUpdate this_obj_conv;
9865 this_obj_conv.inner = (void*)(this_obj & (~1));
9866 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9867 HTLCUpdate_free(this_obj_conv);
9870 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_clone(uint32_t orig) {
9871 LDKHTLCUpdate orig_conv;
9872 orig_conv.inner = (void*)(orig & (~1));
9873 orig_conv.is_owned = false;
9874 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
9875 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9876 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9877 long ret_ref = (long)ret_var.inner;
9878 if (ret_var.is_owned) {
9884 int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t obj) {
9885 LDKHTLCUpdate obj_conv;
9886 obj_conv.inner = (void*)(obj & (~1));
9887 obj_conv.is_owned = false;
9888 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
9889 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9890 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9891 CVec_u8Z_free(ret_var);
9895 uint32_t __attribute__((visibility("default"))) TS_HTLCUpdate_read(int8_tArray ser) {
9897 ser_ref.datalen = *((uint32_t*)ser);
9898 ser_ref.data = (int8_t*)(ser + 4);
9899 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
9900 *ret_conv = HTLCUpdate_read(ser_ref);
9901 return (long)ret_conv;
9904 void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
9905 LDKChannelMonitor this_obj_conv;
9906 this_obj_conv.inner = (void*)(this_obj & (~1));
9907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
9908 ChannelMonitor_free(this_obj_conv);
9911 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_clone(uint32_t orig) {
9912 LDKChannelMonitor orig_conv;
9913 orig_conv.inner = (void*)(orig & (~1));
9914 orig_conv.is_owned = false;
9915 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
9916 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9917 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9918 long ret_ref = (long)ret_var.inner;
9919 if (ret_var.is_owned) {
9925 int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint32_t obj) {
9926 LDKChannelMonitor obj_conv;
9927 obj_conv.inner = (void*)(obj & (~1));
9928 obj_conv.is_owned = false;
9929 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
9930 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
9931 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
9932 CVec_u8Z_free(ret_var);
9936 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) {
9937 LDKChannelMonitor this_arg_conv;
9938 this_arg_conv.inner = (void*)(this_arg & (~1));
9939 this_arg_conv.is_owned = false;
9940 LDKChannelMonitorUpdate updates_conv;
9941 updates_conv.inner = (void*)(updates & (~1));
9942 updates_conv.is_owned = false;
9943 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
9944 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9945 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
9946 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
9947 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
9948 return (long)ret_conv;
9951 int64_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_update_id(uint32_t this_arg) {
9952 LDKChannelMonitor this_arg_conv;
9953 this_arg_conv.inner = (void*)(this_arg & (~1));
9954 this_arg_conv.is_owned = false;
9955 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
9959 uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_get_funding_txo(uint32_t this_arg) {
9960 LDKChannelMonitor this_arg_conv;
9961 this_arg_conv.inner = (void*)(this_arg & (~1));
9962 this_arg_conv.is_owned = false;
9963 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
9964 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
9965 return (long)ret_ref;
9968 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_outputs_to_watch(uint32_t this_arg) {
9969 LDKChannelMonitor this_arg_conv;
9970 this_arg_conv.inner = (void*)(this_arg & (~1));
9971 this_arg_conv.is_owned = false;
9972 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
9973 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9974 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9975 for (size_t c = 0; c < ret_var.datalen; c++) {
9976 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_54_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
9977 *ret_conv_54_ref = ret_var.data[c];
9978 ret_arr_ptr[c] = (long)ret_conv_54_ref;
9984 void __attribute__((visibility("default"))) TS_ChannelMonitor_load_outputs_to_watch(uint32_t this_arg, uint32_t filter) {
9985 LDKChannelMonitor this_arg_conv;
9986 this_arg_conv.inner = (void*)(this_arg & (~1));
9987 this_arg_conv.is_owned = false;
9988 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
9989 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
9992 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_monitor_events(uint32_t this_arg) {
9993 LDKChannelMonitor this_arg_conv;
9994 this_arg_conv.inner = (void*)(this_arg & (~1));
9995 this_arg_conv.is_owned = false;
9996 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
9997 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
9998 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
9999 for (size_t o = 0; o < ret_var.datalen; o++) {
10000 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
10001 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
10002 long ret_conv_14_ref = (long)ret_conv_14_copy;
10003 ret_arr_ptr[o] = ret_conv_14_ref;
10005 FREE(ret_var.data);
10009 uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_clear_pending_events(uint32_t this_arg) {
10010 LDKChannelMonitor this_arg_conv;
10011 this_arg_conv.inner = (void*)(this_arg & (~1));
10012 this_arg_conv.is_owned = false;
10013 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
10014 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10015 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10016 for (size_t h = 0; h < ret_var.datalen; h++) {
10017 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
10018 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
10019 long ret_conv_7_ref = (long)ret_conv_7_copy;
10020 ret_arr_ptr[h] = ret_conv_7_ref;
10022 FREE(ret_var.data);
10026 ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_holder_commitment_txn(uint32_t this_arg, uint32_t logger) {
10027 LDKChannelMonitor this_arg_conv;
10028 this_arg_conv.inner = (void*)(this_arg & (~1));
10029 this_arg_conv.is_owned = false;
10030 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
10031 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
10032 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
10033 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
10034 for (size_t m = 0; m < ret_var.datalen; m++) {
10035 LDKTransaction ret_conv_12_var = ret_var.data[m];
10036 int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10037 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen);
10038 Transaction_free(ret_conv_12_var);
10039 ret_arr_ptr[m] = ret_conv_12_arr;
10041 FREE(ret_var.data);
10045 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) {
10046 LDKChannelMonitor this_arg_conv;
10047 this_arg_conv.inner = (void*)(this_arg & (~1));
10048 this_arg_conv.is_owned = false;
10049 unsigned char header_arr[80];
10050 CHECK(*((uint32_t*)header) == 80);
10051 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10052 unsigned char (*header_ref)[80] = &header_arr;
10053 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10054 txdata_constr.datalen = *((uint32_t*)txdata);
10055 if (txdata_constr.datalen > 0)
10056 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10058 txdata_constr.data = NULL;
10059 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
10060 for (size_t e = 0; e < txdata_constr.datalen; e++) {
10061 uint32_t txdata_conv_30 = txdata_vals[e];
10062 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
10063 FREE((void*)txdata_conv_30);
10064 txdata_constr.data[e] = txdata_conv_30_conv;
10066 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10067 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10068 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10069 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);
10070 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
10071 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
10072 for (size_t x = 0; x < ret_var.datalen; x++) {
10073 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
10074 *ret_conv_49_ref = ret_var.data[x];
10075 ret_arr_ptr[x] = (long)ret_conv_49_ref;
10077 FREE(ret_var.data);
10081 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) {
10082 LDKChannelMonitor this_arg_conv;
10083 this_arg_conv.inner = (void*)(this_arg & (~1));
10084 this_arg_conv.is_owned = false;
10085 unsigned char header_arr[80];
10086 CHECK(*((uint32_t*)header) == 80);
10087 memcpy(header_arr, (uint8_t*)(header + 4), 80);
10088 unsigned char (*header_ref)[80] = &header_arr;
10089 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
10090 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
10091 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
10092 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
10095 void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
10096 if ((this_ptr & 1) != 0) return;
10097 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
10098 FREE((void*)this_ptr);
10099 Persist_free(this_ptr_conv);
10102 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) {
10103 LDKu8slice ser_ref;
10104 ser_ref.datalen = *((uint32_t*)ser);
10105 ser_ref.data = (int8_t*)(ser + 4);
10106 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
10107 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
10108 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
10109 return (long)ret_conv;
10112 void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_obj) {
10113 LDKOutPoint this_obj_conv;
10114 this_obj_conv.inner = (void*)(this_obj & (~1));
10115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10116 OutPoint_free(this_obj_conv);
10119 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) {
10120 LDKOutPoint this_ptr_conv;
10121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10122 this_ptr_conv.is_owned = false;
10123 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10124 memcpy((uint8_t*)(ret_arr + 4), *OutPoint_get_txid(&this_ptr_conv), 32);
10128 void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) {
10129 LDKOutPoint this_ptr_conv;
10130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10131 this_ptr_conv.is_owned = false;
10132 LDKThirtyTwoBytes val_ref;
10133 CHECK(*((uint32_t*)val) == 32);
10134 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10135 OutPoint_set_txid(&this_ptr_conv, val_ref);
10138 int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) {
10139 LDKOutPoint this_ptr_conv;
10140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10141 this_ptr_conv.is_owned = false;
10142 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
10146 void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) {
10147 LDKOutPoint this_ptr_conv;
10148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10149 this_ptr_conv.is_owned = false;
10150 OutPoint_set_index(&this_ptr_conv, val);
10153 uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
10154 LDKThirtyTwoBytes txid_arg_ref;
10155 CHECK(*((uint32_t*)txid_arg) == 32);
10156 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
10157 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
10158 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10159 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10160 long ret_ref = (long)ret_var.inner;
10161 if (ret_var.is_owned) {
10167 uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) {
10168 LDKOutPoint orig_conv;
10169 orig_conv.inner = (void*)(orig & (~1));
10170 orig_conv.is_owned = false;
10171 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
10172 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10173 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10174 long ret_ref = (long)ret_var.inner;
10175 if (ret_var.is_owned) {
10181 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) {
10182 LDKOutPoint this_arg_conv;
10183 this_arg_conv.inner = (void*)(this_arg & (~1));
10184 this_arg_conv.is_owned = false;
10185 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10186 memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32);
10190 int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) {
10191 LDKOutPoint obj_conv;
10192 obj_conv.inner = (void*)(obj & (~1));
10193 obj_conv.is_owned = false;
10194 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
10195 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10196 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10197 CVec_u8Z_free(ret_var);
10201 uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) {
10202 LDKu8slice ser_ref;
10203 ser_ref.datalen = *((uint32_t*)ser);
10204 ser_ref.data = (int8_t*)(ser + 4);
10205 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10206 *ret_conv = OutPoint_read(ser_ref);
10207 return (long)ret_conv;
10210 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_obj) {
10211 LDKDelayedPaymentOutputDescriptor this_obj_conv;
10212 this_obj_conv.inner = (void*)(this_obj & (~1));
10213 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10214 DelayedPaymentOutputDescriptor_free(this_obj_conv);
10217 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
10218 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10220 this_ptr_conv.is_owned = false;
10221 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10222 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10223 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10224 long ret_ref = (long)ret_var.inner;
10225 if (ret_var.is_owned) {
10231 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
10232 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10234 this_ptr_conv.is_owned = false;
10235 LDKOutPoint val_conv;
10236 val_conv.inner = (void*)(val & (~1));
10237 val_conv.is_owned = (val & 1) || (val == 0);
10238 val_conv = OutPoint_clone(&val_conv);
10239 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10242 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) {
10243 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10245 this_ptr_conv.is_owned = false;
10246 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10247 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
10251 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
10252 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10254 this_ptr_conv.is_owned = false;
10255 LDKPublicKey val_ref;
10256 CHECK(*((uint32_t*)val) == 33);
10257 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10258 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
10261 int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) {
10262 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10264 this_ptr_conv.is_owned = false;
10265 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
10269 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) {
10270 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10272 this_ptr_conv.is_owned = false;
10273 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
10276 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10277 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10279 this_ptr_conv.is_owned = false;
10280 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10282 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10285 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) {
10286 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10288 this_ptr_conv.is_owned = false;
10289 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
10290 memcpy((uint8_t*)(ret_arr + 4), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
10294 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) {
10295 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10297 this_ptr_conv.is_owned = false;
10298 LDKPublicKey val_ref;
10299 CHECK(*((uint32_t*)val) == 33);
10300 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
10301 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
10304 int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10305 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10307 this_ptr_conv.is_owned = false;
10308 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10309 memcpy((uint8_t*)(ret_arr + 4), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10313 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10314 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10316 this_ptr_conv.is_owned = false;
10317 LDKThirtyTwoBytes val_ref;
10318 CHECK(*((uint32_t*)val) == 32);
10319 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10320 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10323 int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10324 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10326 this_ptr_conv.is_owned = false;
10327 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10331 void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10332 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
10333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10334 this_ptr_conv.is_owned = false;
10335 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10338 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) {
10339 LDKOutPoint outpoint_arg_conv;
10340 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10341 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10342 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10343 LDKPublicKey per_commitment_point_arg_ref;
10344 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
10345 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
10346 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10347 FREE((void*)output_arg);
10348 LDKPublicKey revocation_pubkey_arg_ref;
10349 CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
10350 memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
10351 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10352 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10353 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10354 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);
10355 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10356 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10357 long ret_ref = (long)ret_var.inner;
10358 if (ret_var.is_owned) {
10364 uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) {
10365 LDKDelayedPaymentOutputDescriptor orig_conv;
10366 orig_conv.inner = (void*)(orig & (~1));
10367 orig_conv.is_owned = false;
10368 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
10369 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10370 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10371 long ret_ref = (long)ret_var.inner;
10372 if (ret_var.is_owned) {
10378 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_obj) {
10379 LDKStaticPaymentOutputDescriptor this_obj_conv;
10380 this_obj_conv.inner = (void*)(this_obj & (~1));
10381 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10382 StaticPaymentOutputDescriptor_free(this_obj_conv);
10385 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) {
10386 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10388 this_ptr_conv.is_owned = false;
10389 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
10390 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10391 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10392 long ret_ref = (long)ret_var.inner;
10393 if (ret_var.is_owned) {
10399 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) {
10400 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10402 this_ptr_conv.is_owned = false;
10403 LDKOutPoint val_conv;
10404 val_conv.inner = (void*)(val & (~1));
10405 val_conv.is_owned = (val & 1) || (val == 0);
10406 val_conv = OutPoint_clone(&val_conv);
10407 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
10410 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) {
10411 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10413 this_ptr_conv.is_owned = false;
10414 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
10416 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
10419 int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) {
10420 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10422 this_ptr_conv.is_owned = false;
10423 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10424 memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
10428 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) {
10429 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10431 this_ptr_conv.is_owned = false;
10432 LDKThirtyTwoBytes val_ref;
10433 CHECK(*((uint32_t*)val) == 32);
10434 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10435 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
10438 int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) {
10439 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10441 this_ptr_conv.is_owned = false;
10442 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
10446 void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
10447 LDKStaticPaymentOutputDescriptor this_ptr_conv;
10448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10449 this_ptr_conv.is_owned = false;
10450 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
10453 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) {
10454 LDKOutPoint outpoint_arg_conv;
10455 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
10456 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
10457 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
10458 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
10459 FREE((void*)output_arg);
10460 LDKThirtyTwoBytes channel_keys_id_arg_ref;
10461 CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
10462 memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
10463 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
10464 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10465 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10466 long ret_ref = (long)ret_var.inner;
10467 if (ret_var.is_owned) {
10473 uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) {
10474 LDKStaticPaymentOutputDescriptor orig_conv;
10475 orig_conv.inner = (void*)(orig & (~1));
10476 orig_conv.is_owned = false;
10477 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
10478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10480 long ret_ref = (long)ret_var.inner;
10481 if (ret_var.is_owned) {
10487 void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) {
10488 if ((this_ptr & 1) != 0) return;
10489 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
10490 FREE((void*)this_ptr);
10491 SpendableOutputDescriptor_free(this_ptr_conv);
10494 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_clone(uint32_t orig) {
10495 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
10496 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
10497 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
10498 long ret_ref = (long)ret_copy;
10502 int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) {
10503 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
10504 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
10505 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10506 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10507 CVec_u8Z_free(ret_var);
10511 uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
10512 LDKu8slice ser_ref;
10513 ser_ref.datalen = *((uint32_t*)ser);
10514 ser_ref.data = (int8_t*)(ser + 4);
10515 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10516 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
10517 return (long)ret_conv;
10520 uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
10521 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
10522 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10523 *ret = Sign_clone(orig_conv);
10527 void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
10528 if ((this_ptr & 1) != 0) return;
10529 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
10530 FREE((void*)this_ptr);
10531 Sign_free(this_ptr_conv);
10534 void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) {
10535 if ((this_ptr & 1) != 0) return;
10536 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
10537 FREE((void*)this_ptr);
10538 KeysInterface_free(this_ptr_conv);
10541 void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_obj) {
10542 LDKInMemorySigner this_obj_conv;
10543 this_obj_conv.inner = (void*)(this_obj & (~1));
10544 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10545 InMemorySigner_free(this_obj_conv);
10548 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) {
10549 LDKInMemorySigner this_ptr_conv;
10550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10551 this_ptr_conv.is_owned = false;
10552 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10553 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
10557 void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) {
10558 LDKInMemorySigner this_ptr_conv;
10559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10560 this_ptr_conv.is_owned = false;
10561 LDKSecretKey val_ref;
10562 CHECK(*((uint32_t*)val) == 32);
10563 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10564 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
10567 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) {
10568 LDKInMemorySigner this_ptr_conv;
10569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10570 this_ptr_conv.is_owned = false;
10571 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10572 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
10576 void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) {
10577 LDKInMemorySigner this_ptr_conv;
10578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10579 this_ptr_conv.is_owned = false;
10580 LDKSecretKey val_ref;
10581 CHECK(*((uint32_t*)val) == 32);
10582 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10583 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
10586 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) {
10587 LDKInMemorySigner this_ptr_conv;
10588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10589 this_ptr_conv.is_owned = false;
10590 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10591 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
10595 void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) {
10596 LDKInMemorySigner this_ptr_conv;
10597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10598 this_ptr_conv.is_owned = false;
10599 LDKSecretKey val_ref;
10600 CHECK(*((uint32_t*)val) == 32);
10601 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10602 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
10605 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) {
10606 LDKInMemorySigner this_ptr_conv;
10607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10608 this_ptr_conv.is_owned = false;
10609 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10610 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
10614 void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) {
10615 LDKInMemorySigner this_ptr_conv;
10616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10617 this_ptr_conv.is_owned = false;
10618 LDKSecretKey val_ref;
10619 CHECK(*((uint32_t*)val) == 32);
10620 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10621 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
10624 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) {
10625 LDKInMemorySigner this_ptr_conv;
10626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10627 this_ptr_conv.is_owned = false;
10628 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10629 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
10633 void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) {
10634 LDKInMemorySigner this_ptr_conv;
10635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10636 this_ptr_conv.is_owned = false;
10637 LDKSecretKey val_ref;
10638 CHECK(*((uint32_t*)val) == 32);
10639 memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32);
10640 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
10643 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) {
10644 LDKInMemorySigner this_ptr_conv;
10645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10646 this_ptr_conv.is_owned = false;
10647 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10648 memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
10652 void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) {
10653 LDKInMemorySigner this_ptr_conv;
10654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10655 this_ptr_conv.is_owned = false;
10656 LDKThirtyTwoBytes val_ref;
10657 CHECK(*((uint32_t*)val) == 32);
10658 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10659 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
10662 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) {
10663 LDKInMemorySigner orig_conv;
10664 orig_conv.inner = (void*)(orig & (~1));
10665 orig_conv.is_owned = false;
10666 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
10667 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10668 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10669 long ret_ref = (long)ret_var.inner;
10670 if (ret_var.is_owned) {
10676 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) {
10677 LDKSecretKey funding_key_ref;
10678 CHECK(*((uint32_t*)funding_key) == 32);
10679 memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32);
10680 LDKSecretKey revocation_base_key_ref;
10681 CHECK(*((uint32_t*)revocation_base_key) == 32);
10682 memcpy(revocation_base_key_ref.bytes, (uint8_t*)(revocation_base_key + 4), 32);
10683 LDKSecretKey payment_key_ref;
10684 CHECK(*((uint32_t*)payment_key) == 32);
10685 memcpy(payment_key_ref.bytes, (uint8_t*)(payment_key + 4), 32);
10686 LDKSecretKey delayed_payment_base_key_ref;
10687 CHECK(*((uint32_t*)delayed_payment_base_key) == 32);
10688 memcpy(delayed_payment_base_key_ref.bytes, (uint8_t*)(delayed_payment_base_key + 4), 32);
10689 LDKSecretKey htlc_base_key_ref;
10690 CHECK(*((uint32_t*)htlc_base_key) == 32);
10691 memcpy(htlc_base_key_ref.bytes, (uint8_t*)(htlc_base_key + 4), 32);
10692 LDKThirtyTwoBytes commitment_seed_ref;
10693 CHECK(*((uint32_t*)commitment_seed) == 32);
10694 memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32);
10695 LDKThirtyTwoBytes channel_keys_id_ref;
10696 CHECK(*((uint32_t*)channel_keys_id) == 32);
10697 memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32);
10698 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);
10699 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10700 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10701 long ret_ref = (long)ret_var.inner;
10702 if (ret_var.is_owned) {
10708 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) {
10709 LDKInMemorySigner this_arg_conv;
10710 this_arg_conv.inner = (void*)(this_arg & (~1));
10711 this_arg_conv.is_owned = false;
10712 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
10713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10715 long ret_ref = (long)ret_var.inner;
10716 if (ret_var.is_owned) {
10722 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) {
10723 LDKInMemorySigner this_arg_conv;
10724 this_arg_conv.inner = (void*)(this_arg & (~1));
10725 this_arg_conv.is_owned = false;
10726 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
10730 int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) {
10731 LDKInMemorySigner this_arg_conv;
10732 this_arg_conv.inner = (void*)(this_arg & (~1));
10733 this_arg_conv.is_owned = false;
10734 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
10738 jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) {
10739 LDKInMemorySigner this_arg_conv;
10740 this_arg_conv.inner = (void*)(this_arg & (~1));
10741 this_arg_conv.is_owned = false;
10742 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
10746 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) {
10747 LDKInMemorySigner this_arg_conv;
10748 this_arg_conv.inner = (void*)(this_arg & (~1));
10749 this_arg_conv.is_owned = false;
10750 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
10751 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10752 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10753 long ret_ref = (long)ret_var.inner;
10754 if (ret_var.is_owned) {
10760 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) {
10761 LDKInMemorySigner this_arg_conv;
10762 this_arg_conv.inner = (void*)(this_arg & (~1));
10763 this_arg_conv.is_owned = false;
10764 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
10765 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10766 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10767 long ret_ref = (long)ret_var.inner;
10768 if (ret_var.is_owned) {
10774 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) {
10775 LDKInMemorySigner this_arg_conv;
10776 this_arg_conv.inner = (void*)(this_arg & (~1));
10777 this_arg_conv.is_owned = false;
10778 LDKTransaction spend_tx_ref;
10779 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10780 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10781 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10782 spend_tx_ref.data_is_owned = true;
10783 LDKStaticPaymentOutputDescriptor descriptor_conv;
10784 descriptor_conv.inner = (void*)(descriptor & (~1));
10785 descriptor_conv.is_owned = false;
10786 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10787 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10788 return (long)ret_conv;
10791 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) {
10792 LDKInMemorySigner this_arg_conv;
10793 this_arg_conv.inner = (void*)(this_arg & (~1));
10794 this_arg_conv.is_owned = false;
10795 LDKTransaction spend_tx_ref;
10796 spend_tx_ref.datalen = *((uint32_t*)spend_tx);
10797 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
10798 memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen);
10799 spend_tx_ref.data_is_owned = true;
10800 LDKDelayedPaymentOutputDescriptor descriptor_conv;
10801 descriptor_conv.inner = (void*)(descriptor & (~1));
10802 descriptor_conv.is_owned = false;
10803 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10804 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
10805 return (long)ret_conv;
10808 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
10809 LDKInMemorySigner this_arg_conv;
10810 this_arg_conv.inner = (void*)(this_arg & (~1));
10811 this_arg_conv.is_owned = false;
10812 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
10813 *ret = InMemorySigner_as_Sign(&this_arg_conv);
10817 int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
10818 LDKInMemorySigner obj_conv;
10819 obj_conv.inner = (void*)(obj & (~1));
10820 obj_conv.is_owned = false;
10821 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
10822 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
10823 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
10824 CVec_u8Z_free(ret_var);
10828 uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) {
10829 LDKu8slice ser_ref;
10830 ser_ref.datalen = *((uint32_t*)ser);
10831 ser_ref.data = (int8_t*)(ser + 4);
10832 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10833 *ret_conv = InMemorySigner_read(ser_ref);
10834 return (long)ret_conv;
10837 void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_obj) {
10838 LDKKeysManager this_obj_conv;
10839 this_obj_conv.inner = (void*)(this_obj & (~1));
10840 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10841 KeysManager_free(this_obj_conv);
10844 uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
10845 unsigned char seed_arr[32];
10846 CHECK(*((uint32_t*)seed) == 32);
10847 memcpy(seed_arr, (uint8_t*)(seed + 4), 32);
10848 unsigned char (*seed_ref)[32] = &seed_arr;
10849 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
10850 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10851 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10852 long ret_ref = (long)ret_var.inner;
10853 if (ret_var.is_owned) {
10859 uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
10860 LDKKeysManager this_arg_conv;
10861 this_arg_conv.inner = (void*)(this_arg & (~1));
10862 this_arg_conv.is_owned = false;
10863 unsigned char params_arr[32];
10864 CHECK(*((uint32_t*)params) == 32);
10865 memcpy(params_arr, (uint8_t*)(params + 4), 32);
10866 unsigned char (*params_ref)[32] = ¶ms_arr;
10867 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
10868 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10869 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10870 long ret_ref = (long)ret_var.inner;
10871 if (ret_var.is_owned) {
10877 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) {
10878 LDKKeysManager this_arg_conv;
10879 this_arg_conv.inner = (void*)(this_arg & (~1));
10880 this_arg_conv.is_owned = false;
10881 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
10882 descriptors_constr.datalen = *((uint32_t*)descriptors);
10883 if (descriptors_constr.datalen > 0)
10884 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10886 descriptors_constr.data = NULL;
10887 uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4);
10888 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
10889 uint32_t descriptors_conv_27 = descriptors_vals[b];
10890 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
10891 FREE((void*)descriptors_conv_27);
10892 descriptors_constr.data[b] = descriptors_conv_27_conv;
10894 LDKCVec_TxOutZ outputs_constr;
10895 outputs_constr.datalen = *((uint32_t*)outputs);
10896 if (outputs_constr.datalen > 0)
10897 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10899 outputs_constr.data = NULL;
10900 uint32_t* outputs_vals = (uint32_t*)(outputs + 4);
10901 for (size_t h = 0; h < outputs_constr.datalen; h++) {
10902 uint32_t outputs_conv_7 = outputs_vals[h];
10903 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
10904 FREE((void*)outputs_conv_7);
10905 outputs_constr.data[h] = outputs_conv_7_conv;
10907 LDKCVec_u8Z change_destination_script_ref;
10908 change_destination_script_ref.datalen = *((uint32_t*)change_destination_script);
10909 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
10910 memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen);
10911 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10912 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
10913 return (long)ret_conv;
10916 uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) {
10917 LDKKeysManager this_arg_conv;
10918 this_arg_conv.inner = (void*)(this_arg & (~1));
10919 this_arg_conv.is_owned = false;
10920 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
10921 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
10925 void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
10926 LDKChannelManager this_obj_conv;
10927 this_obj_conv.inner = (void*)(this_obj & (~1));
10928 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10929 ChannelManager_free(this_obj_conv);
10932 void __attribute__((visibility("default"))) TS_ChainParameters_free(uint32_t this_obj) {
10933 LDKChainParameters this_obj_conv;
10934 this_obj_conv.inner = (void*)(this_obj & (~1));
10935 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
10936 ChainParameters_free(this_obj_conv);
10939 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_get_network(uint32_t this_ptr) {
10940 LDKChainParameters this_ptr_conv;
10941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10942 this_ptr_conv.is_owned = false;
10943 uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
10947 void __attribute__((visibility("default"))) TS_ChainParameters_set_network(uint32_t this_ptr, uint32_t val) {
10948 LDKChainParameters this_ptr_conv;
10949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10950 this_ptr_conv.is_owned = false;
10951 LDKNetwork val_conv = LDKNetwork_from_js(val);
10952 ChainParameters_set_network(&this_ptr_conv, val_conv);
10955 int8_tArray __attribute__((visibility("default"))) TS_ChainParameters_get_latest_hash(uint32_t this_ptr) {
10956 LDKChainParameters this_ptr_conv;
10957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10958 this_ptr_conv.is_owned = false;
10959 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
10960 memcpy((uint8_t*)(ret_arr + 4), *ChainParameters_get_latest_hash(&this_ptr_conv), 32);
10964 void __attribute__((visibility("default"))) TS_ChainParameters_set_latest_hash(uint32_t this_ptr, int8_tArray val) {
10965 LDKChainParameters this_ptr_conv;
10966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10967 this_ptr_conv.is_owned = false;
10968 LDKThirtyTwoBytes val_ref;
10969 CHECK(*((uint32_t*)val) == 32);
10970 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
10971 ChainParameters_set_latest_hash(&this_ptr_conv, val_ref);
10974 int64_t __attribute__((visibility("default"))) TS_ChainParameters_get_latest_height(uint32_t this_ptr) {
10975 LDKChainParameters this_ptr_conv;
10976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10977 this_ptr_conv.is_owned = false;
10978 int64_t ret_val = ChainParameters_get_latest_height(&this_ptr_conv);
10982 void __attribute__((visibility("default"))) TS_ChainParameters_set_latest_height(uint32_t this_ptr, int64_t val) {
10983 LDKChainParameters this_ptr_conv;
10984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10985 this_ptr_conv.is_owned = false;
10986 ChainParameters_set_latest_height(&this_ptr_conv, val);
10989 uint32_t __attribute__((visibility("default"))) TS_ChainParameters_new(uint32_t network_arg, int8_tArray latest_hash_arg, int64_t latest_height_arg) {
10990 LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
10991 LDKThirtyTwoBytes latest_hash_arg_ref;
10992 CHECK(*((uint32_t*)latest_hash_arg) == 32);
10993 memcpy(latest_hash_arg_ref.data, (uint8_t*)(latest_hash_arg + 4), 32);
10994 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, latest_hash_arg_ref, latest_height_arg);
10995 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10996 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10997 long ret_ref = (long)ret_var.inner;
10998 if (ret_var.is_owned) {
11004 void __attribute__((visibility("default"))) TS_ChannelDetails_free(uint32_t this_obj) {
11005 LDKChannelDetails this_obj_conv;
11006 this_obj_conv.inner = (void*)(this_obj & (~1));
11007 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11008 ChannelDetails_free(this_obj_conv);
11011 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_id(uint32_t this_ptr) {
11012 LDKChannelDetails this_ptr_conv;
11013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11014 this_ptr_conv.is_owned = false;
11015 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11016 memcpy((uint8_t*)(ret_arr + 4), *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
11020 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11021 LDKChannelDetails this_ptr_conv;
11022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11023 this_ptr_conv.is_owned = false;
11024 LDKThirtyTwoBytes val_ref;
11025 CHECK(*((uint32_t*)val) == 32);
11026 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11027 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
11030 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_short_channel_id(uint32_t this_ptr) {
11031 LDKChannelDetails this_ptr_conv;
11032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11033 this_ptr_conv.is_owned = false;
11034 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
11035 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
11036 long ret_ref = (long)ret_copy;
11040 void __attribute__((visibility("default"))) TS_ChannelDetails_set_short_channel_id(uint32_t this_ptr, uint32_t val) {
11041 LDKChannelDetails this_ptr_conv;
11042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11043 this_ptr_conv.is_owned = false;
11044 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
11046 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
11049 int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote_network_id(uint32_t this_ptr) {
11050 LDKChannelDetails this_ptr_conv;
11051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11052 this_ptr_conv.is_owned = false;
11053 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11054 memcpy((uint8_t*)(ret_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33);
11058 void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) {
11059 LDKChannelDetails this_ptr_conv;
11060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11061 this_ptr_conv.is_owned = false;
11062 LDKPublicKey val_ref;
11063 CHECK(*((uint32_t*)val) == 33);
11064 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
11065 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
11068 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_get_counterparty_features(uint32_t this_ptr) {
11069 LDKChannelDetails this_ptr_conv;
11070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11071 this_ptr_conv.is_owned = false;
11072 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
11073 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11074 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11075 long ret_ref = (long)ret_var.inner;
11076 if (ret_var.is_owned) {
11082 void __attribute__((visibility("default"))) TS_ChannelDetails_set_counterparty_features(uint32_t this_ptr, uint32_t val) {
11083 LDKChannelDetails this_ptr_conv;
11084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11085 this_ptr_conv.is_owned = false;
11086 LDKInitFeatures val_conv;
11087 val_conv.inner = (void*)(val & (~1));
11088 val_conv.is_owned = (val & 1) || (val == 0);
11089 val_conv = InitFeatures_clone(&val_conv);
11090 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
11093 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_channel_value_satoshis(uint32_t this_ptr) {
11094 LDKChannelDetails this_ptr_conv;
11095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11096 this_ptr_conv.is_owned = false;
11097 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
11101 void __attribute__((visibility("default"))) TS_ChannelDetails_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) {
11102 LDKChannelDetails this_ptr_conv;
11103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11104 this_ptr_conv.is_owned = false;
11105 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
11108 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) {
11109 LDKChannelDetails this_ptr_conv;
11110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11111 this_ptr_conv.is_owned = false;
11112 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
11116 void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) {
11117 LDKChannelDetails this_ptr_conv;
11118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11119 this_ptr_conv.is_owned = false;
11120 ChannelDetails_set_user_id(&this_ptr_conv, val);
11123 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) {
11124 LDKChannelDetails this_ptr_conv;
11125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11126 this_ptr_conv.is_owned = false;
11127 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
11131 void __attribute__((visibility("default"))) TS_ChannelDetails_set_outbound_capacity_msat(uint32_t this_ptr, int64_t val) {
11132 LDKChannelDetails this_ptr_conv;
11133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11134 this_ptr_conv.is_owned = false;
11135 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
11138 int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_inbound_capacity_msat(uint32_t this_ptr) {
11139 LDKChannelDetails this_ptr_conv;
11140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11141 this_ptr_conv.is_owned = false;
11142 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
11146 void __attribute__((visibility("default"))) TS_ChannelDetails_set_inbound_capacity_msat(uint32_t this_ptr, int64_t val) {
11147 LDKChannelDetails this_ptr_conv;
11148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11149 this_ptr_conv.is_owned = false;
11150 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
11153 jboolean __attribute__((visibility("default"))) TS_ChannelDetails_get_is_live(uint32_t this_ptr) {
11154 LDKChannelDetails this_ptr_conv;
11155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11156 this_ptr_conv.is_owned = false;
11157 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
11161 void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_live(uint32_t this_ptr, jboolean val) {
11162 LDKChannelDetails this_ptr_conv;
11163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11164 this_ptr_conv.is_owned = false;
11165 ChannelDetails_set_is_live(&this_ptr_conv, val);
11168 uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_t orig) {
11169 LDKChannelDetails orig_conv;
11170 orig_conv.inner = (void*)(orig & (~1));
11171 orig_conv.is_owned = false;
11172 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
11173 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11174 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11175 long ret_ref = (long)ret_var.inner;
11176 if (ret_var.is_owned) {
11182 void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) {
11183 if ((this_ptr & 1) != 0) return;
11184 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
11185 FREE((void*)this_ptr);
11186 PaymentSendFailure_free(this_ptr_conv);
11189 uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) {
11190 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
11191 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
11192 *ret_copy = PaymentSendFailure_clone(orig_conv);
11193 long ret_ref = (long)ret_copy;
11197 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) {
11198 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
11199 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11200 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11201 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11202 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11203 LDKUserConfig config_conv;
11204 config_conv.inner = (void*)(config & (~1));
11205 config_conv.is_owned = (config & 1) || (config == 0);
11206 config_conv = UserConfig_clone(&config_conv);
11207 LDKChainParameters params_conv;
11208 params_conv.inner = (void*)(params & (~1));
11209 params_conv.is_owned = (params & 1) || (params == 0);
11210 // Warning: we need a move here but no clone is available for LDKChainParameters
11211 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
11212 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11213 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11214 long ret_ref = (long)ret_var.inner;
11215 if (ret_var.is_owned) {
11221 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) {
11222 LDKChannelManager this_arg_conv;
11223 this_arg_conv.inner = (void*)(this_arg & (~1));
11224 this_arg_conv.is_owned = false;
11225 LDKPublicKey their_network_key_ref;
11226 CHECK(*((uint32_t*)their_network_key) == 33);
11227 memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
11228 LDKUserConfig override_config_conv;
11229 override_config_conv.inner = (void*)(override_config & (~1));
11230 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
11231 override_config_conv = UserConfig_clone(&override_config_conv);
11232 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11233 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
11234 return (long)ret_conv;
11237 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
11238 LDKChannelManager this_arg_conv;
11239 this_arg_conv.inner = (void*)(this_arg & (~1));
11240 this_arg_conv.is_owned = false;
11241 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
11242 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
11243 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
11244 for (size_t q = 0; q < ret_var.datalen; q++) {
11245 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11246 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11247 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11248 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11249 if (ret_conv_16_var.is_owned) {
11250 ret_conv_16_ref |= 1;
11252 ret_arr_ptr[q] = ret_conv_16_ref;
11254 FREE(ret_var.data);
11258 uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
11259 LDKChannelManager this_arg_conv;
11260 this_arg_conv.inner = (void*)(this_arg & (~1));
11261 this_arg_conv.is_owned = false;
11262 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
11263 uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
11264 uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
11265 for (size_t q = 0; q < ret_var.datalen; q++) {
11266 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11267 CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11268 CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11269 long ret_conv_16_ref = (long)ret_conv_16_var.inner;
11270 if (ret_conv_16_var.is_owned) {
11271 ret_conv_16_ref |= 1;
11273 ret_arr_ptr[q] = ret_conv_16_ref;
11275 FREE(ret_var.data);
11279 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11280 LDKChannelManager this_arg_conv;
11281 this_arg_conv.inner = (void*)(this_arg & (~1));
11282 this_arg_conv.is_owned = false;
11283 unsigned char channel_id_arr[32];
11284 CHECK(*((uint32_t*)channel_id) == 32);
11285 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11286 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11287 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11288 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
11289 return (long)ret_conv;
11292 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
11293 LDKChannelManager this_arg_conv;
11294 this_arg_conv.inner = (void*)(this_arg & (~1));
11295 this_arg_conv.is_owned = false;
11296 unsigned char channel_id_arr[32];
11297 CHECK(*((uint32_t*)channel_id) == 32);
11298 memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
11299 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
11300 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11301 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
11302 return (long)ret_conv;
11305 void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
11306 LDKChannelManager this_arg_conv;
11307 this_arg_conv.inner = (void*)(this_arg & (~1));
11308 this_arg_conv.is_owned = false;
11309 ChannelManager_force_close_all_channels(&this_arg_conv);
11312 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
11313 LDKChannelManager this_arg_conv;
11314 this_arg_conv.inner = (void*)(this_arg & (~1));
11315 this_arg_conv.is_owned = false;
11316 LDKRoute route_conv;
11317 route_conv.inner = (void*)(route & (~1));
11318 route_conv.is_owned = false;
11319 LDKThirtyTwoBytes payment_hash_ref;
11320 CHECK(*((uint32_t*)payment_hash) == 32);
11321 memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
11322 LDKThirtyTwoBytes payment_secret_ref;
11323 CHECK(*((uint32_t*)payment_secret) == 32);
11324 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11325 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11326 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
11327 return (long)ret_conv;
11330 void __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, uint32_t funding_txo) {
11331 LDKChannelManager this_arg_conv;
11332 this_arg_conv.inner = (void*)(this_arg & (~1));
11333 this_arg_conv.is_owned = false;
11334 unsigned char temporary_channel_id_arr[32];
11335 CHECK(*((uint32_t*)temporary_channel_id) == 32);
11336 memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
11337 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
11338 LDKOutPoint funding_txo_conv;
11339 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11340 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
11341 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
11342 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
11345 void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
11346 LDKChannelManager this_arg_conv;
11347 this_arg_conv.inner = (void*)(this_arg & (~1));
11348 this_arg_conv.is_owned = false;
11349 LDKThreeBytes rgb_ref;
11350 CHECK(*((uint32_t*)rgb) == 3);
11351 memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
11352 LDKThirtyTwoBytes alias_ref;
11353 CHECK(*((uint32_t*)alias) == 32);
11354 memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
11355 LDKCVec_NetAddressZ addresses_constr;
11356 addresses_constr.datalen = *((uint32_t*)addresses);
11357 if (addresses_constr.datalen > 0)
11358 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11360 addresses_constr.data = NULL;
11361 uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
11362 for (size_t m = 0; m < addresses_constr.datalen; m++) {
11363 uint32_t addresses_conv_12 = addresses_vals[m];
11364 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
11365 FREE((void*)addresses_conv_12);
11366 addresses_constr.data[m] = addresses_conv_12_conv;
11368 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
11371 void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
11372 LDKChannelManager this_arg_conv;
11373 this_arg_conv.inner = (void*)(this_arg & (~1));
11374 this_arg_conv.is_owned = false;
11375 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
11378 void __attribute__((visibility("default"))) TS_ChannelManager_timer_chan_freshness_every_min(uint32_t this_arg) {
11379 LDKChannelManager this_arg_conv;
11380 this_arg_conv.inner = (void*)(this_arg & (~1));
11381 this_arg_conv.is_owned = false;
11382 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
11385 jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
11386 LDKChannelManager this_arg_conv;
11387 this_arg_conv.inner = (void*)(this_arg & (~1));
11388 this_arg_conv.is_owned = false;
11389 unsigned char payment_hash_arr[32];
11390 CHECK(*((uint32_t*)payment_hash) == 32);
11391 memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
11392 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
11393 LDKThirtyTwoBytes payment_secret_ref;
11394 CHECK(*((uint32_t*)payment_secret) == 32);
11395 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11396 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
11400 jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
11401 LDKChannelManager this_arg_conv;
11402 this_arg_conv.inner = (void*)(this_arg & (~1));
11403 this_arg_conv.is_owned = false;
11404 LDKThirtyTwoBytes payment_preimage_ref;
11405 CHECK(*((uint32_t*)payment_preimage) == 32);
11406 memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
11407 LDKThirtyTwoBytes payment_secret_ref;
11408 CHECK(*((uint32_t*)payment_secret) == 32);
11409 memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
11410 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
11414 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
11415 LDKChannelManager this_arg_conv;
11416 this_arg_conv.inner = (void*)(this_arg & (~1));
11417 this_arg_conv.is_owned = false;
11418 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
11419 memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
11423 void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) {
11424 LDKChannelManager this_arg_conv;
11425 this_arg_conv.inner = (void*)(this_arg & (~1));
11426 this_arg_conv.is_owned = false;
11427 LDKOutPoint funding_txo_conv;
11428 funding_txo_conv.inner = (void*)(funding_txo & (~1));
11429 funding_txo_conv.is_owned = false;
11430 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
11433 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
11434 LDKChannelManager this_arg_conv;
11435 this_arg_conv.inner = (void*)(this_arg & (~1));
11436 this_arg_conv.is_owned = false;
11437 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11438 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
11442 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
11443 LDKChannelManager this_arg_conv;
11444 this_arg_conv.inner = (void*)(this_arg & (~1));
11445 this_arg_conv.is_owned = false;
11446 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
11447 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
11451 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
11452 LDKChannelManager this_arg_conv;
11453 this_arg_conv.inner = (void*)(this_arg & (~1));
11454 this_arg_conv.is_owned = false;
11455 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
11456 *ret = ChannelManager_as_Listen(&this_arg_conv);
11460 void __attribute__((visibility("default"))) TS_ChannelManager_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) {
11461 LDKChannelManager this_arg_conv;
11462 this_arg_conv.inner = (void*)(this_arg & (~1));
11463 this_arg_conv.is_owned = false;
11464 unsigned char header_arr[80];
11465 CHECK(*((uint32_t*)header) == 80);
11466 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11467 unsigned char (*header_ref)[80] = &header_arr;
11468 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11469 txdata_constr.datalen = *((uint32_t*)txdata);
11470 if (txdata_constr.datalen > 0)
11471 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11473 txdata_constr.data = NULL;
11474 uint32_t* txdata_vals = (uint32_t*)(txdata + 4);
11475 for (size_t e = 0; e < txdata_constr.datalen; e++) {
11476 uint32_t txdata_conv_30 = txdata_vals[e];
11477 LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1);
11478 FREE((void*)txdata_conv_30);
11479 txdata_constr.data[e] = txdata_conv_30_conv;
11481 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
11484 void __attribute__((visibility("default"))) TS_ChannelManager_block_disconnected(uint32_t this_arg, int8_tArray header) {
11485 LDKChannelManager this_arg_conv;
11486 this_arg_conv.inner = (void*)(this_arg & (~1));
11487 this_arg_conv.is_owned = false;
11488 unsigned char header_arr[80];
11489 CHECK(*((uint32_t*)header) == 80);
11490 memcpy(header_arr, (uint8_t*)(header + 4), 80);
11491 unsigned char (*header_ref)[80] = &header_arr;
11492 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
11495 void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
11496 LDKChannelManager this_arg_conv;
11497 this_arg_conv.inner = (void*)(this_arg & (~1));
11498 this_arg_conv.is_owned = false;
11499 ChannelManager_await_persistable_update(&this_arg_conv);
11502 uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
11503 LDKChannelManager this_arg_conv;
11504 this_arg_conv.inner = (void*)(this_arg & (~1));
11505 this_arg_conv.is_owned = false;
11506 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11507 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
11511 int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
11512 LDKChannelManager obj_conv;
11513 obj_conv.inner = (void*)(obj & (~1));
11514 obj_conv.is_owned = false;
11515 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
11516 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
11517 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
11518 CVec_u8Z_free(ret_var);
11522 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
11523 LDKChannelManagerReadArgs this_obj_conv;
11524 this_obj_conv.inner = (void*)(this_obj & (~1));
11525 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11526 ChannelManagerReadArgs_free(this_obj_conv);
11529 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
11530 LDKChannelManagerReadArgs this_ptr_conv;
11531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11532 this_ptr_conv.is_owned = false;
11533 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
11537 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
11538 LDKChannelManagerReadArgs this_ptr_conv;
11539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11540 this_ptr_conv.is_owned = false;
11541 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
11542 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
11545 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
11546 LDKChannelManagerReadArgs this_ptr_conv;
11547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11548 this_ptr_conv.is_owned = false;
11549 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
11553 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
11554 LDKChannelManagerReadArgs this_ptr_conv;
11555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11556 this_ptr_conv.is_owned = false;
11557 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
11558 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
11561 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
11562 LDKChannelManagerReadArgs this_ptr_conv;
11563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11564 this_ptr_conv.is_owned = false;
11565 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
11569 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
11570 LDKChannelManagerReadArgs this_ptr_conv;
11571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11572 this_ptr_conv.is_owned = false;
11573 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
11574 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
11577 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
11578 LDKChannelManagerReadArgs this_ptr_conv;
11579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11580 this_ptr_conv.is_owned = false;
11581 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
11585 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
11586 LDKChannelManagerReadArgs this_ptr_conv;
11587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11588 this_ptr_conv.is_owned = false;
11589 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
11590 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
11593 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
11594 LDKChannelManagerReadArgs this_ptr_conv;
11595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11596 this_ptr_conv.is_owned = false;
11597 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
11601 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
11602 LDKChannelManagerReadArgs this_ptr_conv;
11603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11604 this_ptr_conv.is_owned = false;
11605 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
11606 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
11609 uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
11610 LDKChannelManagerReadArgs this_ptr_conv;
11611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11612 this_ptr_conv.is_owned = false;
11613 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
11614 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11615 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11616 long ret_ref = (long)ret_var.inner;
11617 if (ret_var.is_owned) {
11623 void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
11624 LDKChannelManagerReadArgs this_ptr_conv;
11625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11626 this_ptr_conv.is_owned = false;
11627 LDKUserConfig val_conv;
11628 val_conv.inner = (void*)(val & (~1));
11629 val_conv.is_owned = (val & 1) || (val == 0);
11630 val_conv = UserConfig_clone(&val_conv);
11631 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
11634 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) {
11635 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
11636 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
11637 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
11638 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
11639 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
11640 LDKUserConfig default_config_conv;
11641 default_config_conv.inner = (void*)(default_config & (~1));
11642 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
11643 default_config_conv = UserConfig_clone(&default_config_conv);
11644 LDKCVec_ChannelMonitorZ channel_monitors_constr;
11645 channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
11646 if (channel_monitors_constr.datalen > 0)
11647 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11649 channel_monitors_constr.data = NULL;
11650 uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
11651 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
11652 uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
11653 LDKChannelMonitor channel_monitors_conv_16_conv;
11654 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
11655 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
11656 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
11658 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);
11659 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11660 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11661 long ret_ref = (long)ret_var.inner;
11662 if (ret_var.is_owned) {
11668 uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
11669 LDKu8slice ser_ref;
11670 ser_ref.datalen = *((uint32_t*)ser);
11671 ser_ref.data = (int8_t*)(ser + 4);
11672 LDKChannelManagerReadArgs arg_conv;
11673 arg_conv.inner = (void*)(arg & (~1));
11674 arg_conv.is_owned = (arg & 1) || (arg == 0);
11675 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
11676 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11677 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
11678 return (long)ret_conv;
11681 void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
11682 LDKDecodeError this_obj_conv;
11683 this_obj_conv.inner = (void*)(this_obj & (~1));
11684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11685 DecodeError_free(this_obj_conv);
11688 uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
11689 LDKDecodeError orig_conv;
11690 orig_conv.inner = (void*)(orig & (~1));
11691 orig_conv.is_owned = false;
11692 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
11693 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11694 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11695 long ret_ref = (long)ret_var.inner;
11696 if (ret_var.is_owned) {
11702 void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
11703 LDKInit this_obj_conv;
11704 this_obj_conv.inner = (void*)(this_obj & (~1));
11705 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11706 Init_free(this_obj_conv);
11709 uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
11710 LDKInit this_ptr_conv;
11711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11712 this_ptr_conv.is_owned = false;
11713 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
11714 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11715 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11716 long ret_ref = (long)ret_var.inner;
11717 if (ret_var.is_owned) {
11723 void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
11724 LDKInit this_ptr_conv;
11725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11726 this_ptr_conv.is_owned = false;
11727 LDKInitFeatures val_conv;
11728 val_conv.inner = (void*)(val & (~1));
11729 val_conv.is_owned = (val & 1) || (val == 0);
11730 val_conv = InitFeatures_clone(&val_conv);
11731 Init_set_features(&this_ptr_conv, val_conv);
11734 uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
11735 LDKInitFeatures features_arg_conv;
11736 features_arg_conv.inner = (void*)(features_arg & (~1));
11737 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11738 features_arg_conv = InitFeatures_clone(&features_arg_conv);
11739 LDKInit ret_var = Init_new(features_arg_conv);
11740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11742 long ret_ref = (long)ret_var.inner;
11743 if (ret_var.is_owned) {
11749 uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
11751 orig_conv.inner = (void*)(orig & (~1));
11752 orig_conv.is_owned = false;
11753 LDKInit ret_var = Init_clone(&orig_conv);
11754 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11755 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11756 long ret_ref = (long)ret_var.inner;
11757 if (ret_var.is_owned) {
11763 void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
11764 LDKErrorMessage this_obj_conv;
11765 this_obj_conv.inner = (void*)(this_obj & (~1));
11766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11767 ErrorMessage_free(this_obj_conv);
11770 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
11771 LDKErrorMessage this_ptr_conv;
11772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11773 this_ptr_conv.is_owned = false;
11774 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11775 memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
11779 void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
11780 LDKErrorMessage this_ptr_conv;
11781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11782 this_ptr_conv.is_owned = false;
11783 LDKThirtyTwoBytes val_ref;
11784 CHECK(*((uint32_t*)val) == 32);
11785 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11786 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
11789 jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
11790 LDKErrorMessage this_ptr_conv;
11791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11792 this_ptr_conv.is_owned = false;
11793 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
11794 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
11798 void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, int8_tArray val) {
11799 LDKErrorMessage this_ptr_conv;
11800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11801 this_ptr_conv.is_owned = false;
11802 LDKCVec_u8Z val_ref;
11803 val_ref.datalen = *((uint32_t*)val);
11804 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11805 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
11806 ErrorMessage_set_data(&this_ptr_conv, val_ref);
11809 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
11810 LDKThirtyTwoBytes channel_id_arg_ref;
11811 CHECK(*((uint32_t*)channel_id_arg) == 32);
11812 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
11813 LDKCVec_u8Z data_arg_ref;
11814 data_arg_ref.datalen = *((uint32_t*)data_arg);
11815 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11816 memcpy(data_arg_ref.data, (uint8_t*)(data_arg + 4), data_arg_ref.datalen);
11817 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
11818 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11819 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11820 long ret_ref = (long)ret_var.inner;
11821 if (ret_var.is_owned) {
11827 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
11828 LDKErrorMessage orig_conv;
11829 orig_conv.inner = (void*)(orig & (~1));
11830 orig_conv.is_owned = false;
11831 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
11832 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11833 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11834 long ret_ref = (long)ret_var.inner;
11835 if (ret_var.is_owned) {
11841 void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
11842 LDKPing this_obj_conv;
11843 this_obj_conv.inner = (void*)(this_obj & (~1));
11844 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11845 Ping_free(this_obj_conv);
11848 int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
11849 LDKPing this_ptr_conv;
11850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11851 this_ptr_conv.is_owned = false;
11852 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
11856 void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
11857 LDKPing this_ptr_conv;
11858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11859 this_ptr_conv.is_owned = false;
11860 Ping_set_ponglen(&this_ptr_conv, val);
11863 int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
11864 LDKPing this_ptr_conv;
11865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11866 this_ptr_conv.is_owned = false;
11867 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
11871 void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
11872 LDKPing this_ptr_conv;
11873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11874 this_ptr_conv.is_owned = false;
11875 Ping_set_byteslen(&this_ptr_conv, val);
11878 uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
11879 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
11880 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11881 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11882 long ret_ref = (long)ret_var.inner;
11883 if (ret_var.is_owned) {
11889 uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
11891 orig_conv.inner = (void*)(orig & (~1));
11892 orig_conv.is_owned = false;
11893 LDKPing ret_var = Ping_clone(&orig_conv);
11894 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11895 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11896 long ret_ref = (long)ret_var.inner;
11897 if (ret_var.is_owned) {
11903 void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
11904 LDKPong this_obj_conv;
11905 this_obj_conv.inner = (void*)(this_obj & (~1));
11906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11907 Pong_free(this_obj_conv);
11910 int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
11911 LDKPong this_ptr_conv;
11912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11913 this_ptr_conv.is_owned = false;
11914 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
11918 void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
11919 LDKPong this_ptr_conv;
11920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11921 this_ptr_conv.is_owned = false;
11922 Pong_set_byteslen(&this_ptr_conv, val);
11925 uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
11926 LDKPong ret_var = Pong_new(byteslen_arg);
11927 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11928 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11929 long ret_ref = (long)ret_var.inner;
11930 if (ret_var.is_owned) {
11936 uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
11938 orig_conv.inner = (void*)(orig & (~1));
11939 orig_conv.is_owned = false;
11940 LDKPong ret_var = Pong_clone(&orig_conv);
11941 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11942 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11943 long ret_ref = (long)ret_var.inner;
11944 if (ret_var.is_owned) {
11950 void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
11951 LDKOpenChannel this_obj_conv;
11952 this_obj_conv.inner = (void*)(this_obj & (~1));
11953 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
11954 OpenChannel_free(this_obj_conv);
11957 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
11958 LDKOpenChannel this_ptr_conv;
11959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11960 this_ptr_conv.is_owned = false;
11961 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11962 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
11966 void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
11967 LDKOpenChannel this_ptr_conv;
11968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11969 this_ptr_conv.is_owned = false;
11970 LDKThirtyTwoBytes val_ref;
11971 CHECK(*((uint32_t*)val) == 32);
11972 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11973 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
11976 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
11977 LDKOpenChannel this_ptr_conv;
11978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11979 this_ptr_conv.is_owned = false;
11980 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
11981 memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
11985 void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
11986 LDKOpenChannel this_ptr_conv;
11987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11988 this_ptr_conv.is_owned = false;
11989 LDKThirtyTwoBytes val_ref;
11990 CHECK(*((uint32_t*)val) == 32);
11991 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
11992 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
11995 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
11996 LDKOpenChannel this_ptr_conv;
11997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11998 this_ptr_conv.is_owned = false;
11999 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
12003 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
12004 LDKOpenChannel this_ptr_conv;
12005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12006 this_ptr_conv.is_owned = false;
12007 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
12010 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
12011 LDKOpenChannel this_ptr_conv;
12012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12013 this_ptr_conv.is_owned = false;
12014 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
12018 void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
12019 LDKOpenChannel this_ptr_conv;
12020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12021 this_ptr_conv.is_owned = false;
12022 OpenChannel_set_push_msat(&this_ptr_conv, val);
12025 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
12026 LDKOpenChannel this_ptr_conv;
12027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12028 this_ptr_conv.is_owned = false;
12029 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
12033 void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
12034 LDKOpenChannel this_ptr_conv;
12035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12036 this_ptr_conv.is_owned = false;
12037 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12040 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12041 LDKOpenChannel this_ptr_conv;
12042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12043 this_ptr_conv.is_owned = false;
12044 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12048 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12049 LDKOpenChannel this_ptr_conv;
12050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12051 this_ptr_conv.is_owned = false;
12052 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12055 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
12056 LDKOpenChannel this_ptr_conv;
12057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12058 this_ptr_conv.is_owned = false;
12059 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12063 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12064 LDKOpenChannel this_ptr_conv;
12065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12066 this_ptr_conv.is_owned = false;
12067 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12070 int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
12071 LDKOpenChannel this_ptr_conv;
12072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12073 this_ptr_conv.is_owned = false;
12074 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
12078 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12079 LDKOpenChannel this_ptr_conv;
12080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12081 this_ptr_conv.is_owned = false;
12082 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12085 int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
12086 LDKOpenChannel this_ptr_conv;
12087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12088 this_ptr_conv.is_owned = false;
12089 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
12093 void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
12094 LDKOpenChannel this_ptr_conv;
12095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12096 this_ptr_conv.is_owned = false;
12097 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
12100 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
12101 LDKOpenChannel this_ptr_conv;
12102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12103 this_ptr_conv.is_owned = false;
12104 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
12108 void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12109 LDKOpenChannel this_ptr_conv;
12110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12111 this_ptr_conv.is_owned = false;
12112 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
12115 int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
12116 LDKOpenChannel this_ptr_conv;
12117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12118 this_ptr_conv.is_owned = false;
12119 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
12123 void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12124 LDKOpenChannel this_ptr_conv;
12125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12126 this_ptr_conv.is_owned = false;
12127 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12130 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
12131 LDKOpenChannel this_ptr_conv;
12132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12133 this_ptr_conv.is_owned = false;
12134 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12135 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
12139 void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
12140 LDKOpenChannel this_ptr_conv;
12141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12142 this_ptr_conv.is_owned = false;
12143 LDKPublicKey val_ref;
12144 CHECK(*((uint32_t*)val) == 33);
12145 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12146 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12149 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
12150 LDKOpenChannel this_ptr_conv;
12151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12152 this_ptr_conv.is_owned = false;
12153 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12154 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
12158 void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
12159 LDKOpenChannel this_ptr_conv;
12160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12161 this_ptr_conv.is_owned = false;
12162 LDKPublicKey val_ref;
12163 CHECK(*((uint32_t*)val) == 33);
12164 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12165 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12168 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_point(uint32_t this_ptr) {
12169 LDKOpenChannel this_ptr_conv;
12170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12171 this_ptr_conv.is_owned = false;
12172 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12173 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
12177 void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
12178 LDKOpenChannel this_ptr_conv;
12179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12180 this_ptr_conv.is_owned = false;
12181 LDKPublicKey val_ref;
12182 CHECK(*((uint32_t*)val) == 33);
12183 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12184 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
12187 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
12188 LDKOpenChannel this_ptr_conv;
12189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12190 this_ptr_conv.is_owned = false;
12191 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12192 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
12196 void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
12197 LDKOpenChannel this_ptr_conv;
12198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12199 this_ptr_conv.is_owned = false;
12200 LDKPublicKey val_ref;
12201 CHECK(*((uint32_t*)val) == 33);
12202 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12203 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12206 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_basepoint(uint32_t this_ptr) {
12207 LDKOpenChannel this_ptr_conv;
12208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12209 this_ptr_conv.is_owned = false;
12210 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12211 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
12215 void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
12216 LDKOpenChannel this_ptr_conv;
12217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12218 this_ptr_conv.is_owned = false;
12219 LDKPublicKey val_ref;
12220 CHECK(*((uint32_t*)val) == 33);
12221 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12222 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12225 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per_commitment_point(uint32_t this_ptr) {
12226 LDKOpenChannel this_ptr_conv;
12227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12228 this_ptr_conv.is_owned = false;
12229 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12230 memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12234 void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12235 LDKOpenChannel this_ptr_conv;
12236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12237 this_ptr_conv.is_owned = false;
12238 LDKPublicKey val_ref;
12239 CHECK(*((uint32_t*)val) == 33);
12240 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12241 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12244 int8_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_flags(uint32_t this_ptr) {
12245 LDKOpenChannel this_ptr_conv;
12246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12247 this_ptr_conv.is_owned = false;
12248 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
12252 void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(uint32_t this_ptr, int8_t val) {
12253 LDKOpenChannel this_ptr_conv;
12254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12255 this_ptr_conv.is_owned = false;
12256 OpenChannel_set_channel_flags(&this_ptr_conv, val);
12259 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_clone(uint32_t orig) {
12260 LDKOpenChannel orig_conv;
12261 orig_conv.inner = (void*)(orig & (~1));
12262 orig_conv.is_owned = false;
12263 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
12264 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12265 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12266 long ret_ref = (long)ret_var.inner;
12267 if (ret_var.is_owned) {
12273 void __attribute__((visibility("default"))) TS_AcceptChannel_free(uint32_t this_obj) {
12274 LDKAcceptChannel this_obj_conv;
12275 this_obj_conv.inner = (void*)(this_obj & (~1));
12276 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12277 AcceptChannel_free(this_obj_conv);
12280 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_temporary_channel_id(uint32_t this_ptr) {
12281 LDKAcceptChannel this_ptr_conv;
12282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12283 this_ptr_conv.is_owned = false;
12284 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12285 memcpy((uint8_t*)(ret_arr + 4), *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
12289 void __attribute__((visibility("default"))) TS_AcceptChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12290 LDKAcceptChannel this_ptr_conv;
12291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12292 this_ptr_conv.is_owned = false;
12293 LDKThirtyTwoBytes val_ref;
12294 CHECK(*((uint32_t*)val) == 32);
12295 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12296 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
12299 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
12300 LDKAcceptChannel this_ptr_conv;
12301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12302 this_ptr_conv.is_owned = false;
12303 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
12307 void __attribute__((visibility("default"))) TS_AcceptChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
12308 LDKAcceptChannel this_ptr_conv;
12309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12310 this_ptr_conv.is_owned = false;
12311 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
12314 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
12315 LDKAcceptChannel this_ptr_conv;
12316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12317 this_ptr_conv.is_owned = false;
12318 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
12322 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
12323 LDKAcceptChannel this_ptr_conv;
12324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12325 this_ptr_conv.is_owned = false;
12326 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
12329 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
12330 LDKAcceptChannel this_ptr_conv;
12331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12332 this_ptr_conv.is_owned = false;
12333 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
12337 void __attribute__((visibility("default"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
12338 LDKAcceptChannel this_ptr_conv;
12339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12340 this_ptr_conv.is_owned = false;
12341 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
12344 int64_t __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
12345 LDKAcceptChannel this_ptr_conv;
12346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12347 this_ptr_conv.is_owned = false;
12348 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
12352 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
12353 LDKAcceptChannel this_ptr_conv;
12354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12355 this_ptr_conv.is_owned = false;
12356 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
12359 int32_t __attribute__((visibility("default"))) TS_AcceptChannel_get_minimum_depth(uint32_t this_ptr) {
12360 LDKAcceptChannel this_ptr_conv;
12361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12362 this_ptr_conv.is_owned = false;
12363 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
12367 void __attribute__((visibility("default"))) TS_AcceptChannel_set_minimum_depth(uint32_t this_ptr, int32_t val) {
12368 LDKAcceptChannel this_ptr_conv;
12369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12370 this_ptr_conv.is_owned = false;
12371 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
12374 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_to_self_delay(uint32_t this_ptr) {
12375 LDKAcceptChannel this_ptr_conv;
12376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12377 this_ptr_conv.is_owned = false;
12378 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
12382 void __attribute__((visibility("default"))) TS_AcceptChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
12383 LDKAcceptChannel this_ptr_conv;
12384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12385 this_ptr_conv.is_owned = false;
12386 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
12389 int16_t __attribute__((visibility("default"))) TS_AcceptChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
12390 LDKAcceptChannel this_ptr_conv;
12391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12392 this_ptr_conv.is_owned = false;
12393 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
12397 void __attribute__((visibility("default"))) TS_AcceptChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
12398 LDKAcceptChannel this_ptr_conv;
12399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12400 this_ptr_conv.is_owned = false;
12401 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
12404 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding_pubkey(uint32_t this_ptr) {
12405 LDKAcceptChannel this_ptr_conv;
12406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12407 this_ptr_conv.is_owned = false;
12408 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12409 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
12413 void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
12414 LDKAcceptChannel this_ptr_conv;
12415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12416 this_ptr_conv.is_owned = false;
12417 LDKPublicKey val_ref;
12418 CHECK(*((uint32_t*)val) == 33);
12419 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12420 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
12423 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocation_basepoint(uint32_t this_ptr) {
12424 LDKAcceptChannel this_ptr_conv;
12425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12426 this_ptr_conv.is_owned = false;
12427 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12428 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
12432 void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
12433 LDKAcceptChannel this_ptr_conv;
12434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12435 this_ptr_conv.is_owned = false;
12436 LDKPublicKey val_ref;
12437 CHECK(*((uint32_t*)val) == 33);
12438 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12439 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
12442 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment_point(uint32_t this_ptr) {
12443 LDKAcceptChannel this_ptr_conv;
12444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12445 this_ptr_conv.is_owned = false;
12446 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12447 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
12451 void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) {
12452 LDKAcceptChannel this_ptr_conv;
12453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12454 this_ptr_conv.is_owned = false;
12455 LDKPublicKey val_ref;
12456 CHECK(*((uint32_t*)val) == 33);
12457 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12458 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
12461 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint32_t this_ptr) {
12462 LDKAcceptChannel this_ptr_conv;
12463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12464 this_ptr_conv.is_owned = false;
12465 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12466 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
12470 void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
12471 LDKAcceptChannel this_ptr_conv;
12472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12473 this_ptr_conv.is_owned = false;
12474 LDKPublicKey val_ref;
12475 CHECK(*((uint32_t*)val) == 33);
12476 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12477 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12480 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_basepoint(uint32_t this_ptr) {
12481 LDKAcceptChannel this_ptr_conv;
12482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12483 this_ptr_conv.is_owned = false;
12484 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12485 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
12489 void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
12490 LDKAcceptChannel this_ptr_conv;
12491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12492 this_ptr_conv.is_owned = false;
12493 LDKPublicKey val_ref;
12494 CHECK(*((uint32_t*)val) == 33);
12495 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12496 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
12499 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_per_commitment_point(uint32_t this_ptr) {
12500 LDKAcceptChannel this_ptr_conv;
12501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12502 this_ptr_conv.is_owned = false;
12503 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12504 memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12508 void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12509 LDKAcceptChannel this_ptr_conv;
12510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12511 this_ptr_conv.is_owned = false;
12512 LDKPublicKey val_ref;
12513 CHECK(*((uint32_t*)val) == 33);
12514 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12515 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
12518 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_clone(uint32_t orig) {
12519 LDKAcceptChannel orig_conv;
12520 orig_conv.inner = (void*)(orig & (~1));
12521 orig_conv.is_owned = false;
12522 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
12523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12525 long ret_ref = (long)ret_var.inner;
12526 if (ret_var.is_owned) {
12532 void __attribute__((visibility("default"))) TS_FundingCreated_free(uint32_t this_obj) {
12533 LDKFundingCreated this_obj_conv;
12534 this_obj_conv.inner = (void*)(this_obj & (~1));
12535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12536 FundingCreated_free(this_obj_conv);
12539 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_temporary_channel_id(uint32_t this_ptr) {
12540 LDKFundingCreated this_ptr_conv;
12541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12542 this_ptr_conv.is_owned = false;
12543 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12544 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
12548 void __attribute__((visibility("default"))) TS_FundingCreated_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
12549 LDKFundingCreated this_ptr_conv;
12550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12551 this_ptr_conv.is_owned = false;
12552 LDKThirtyTwoBytes val_ref;
12553 CHECK(*((uint32_t*)val) == 32);
12554 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12555 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
12558 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_funding_txid(uint32_t this_ptr) {
12559 LDKFundingCreated this_ptr_conv;
12560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12561 this_ptr_conv.is_owned = false;
12562 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12563 memcpy((uint8_t*)(ret_arr + 4), *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
12567 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_txid(uint32_t this_ptr, int8_tArray val) {
12568 LDKFundingCreated this_ptr_conv;
12569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12570 this_ptr_conv.is_owned = false;
12571 LDKThirtyTwoBytes val_ref;
12572 CHECK(*((uint32_t*)val) == 32);
12573 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12574 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
12577 int16_t __attribute__((visibility("default"))) TS_FundingCreated_get_funding_output_index(uint32_t this_ptr) {
12578 LDKFundingCreated this_ptr_conv;
12579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12580 this_ptr_conv.is_owned = false;
12581 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
12585 void __attribute__((visibility("default"))) TS_FundingCreated_set_funding_output_index(uint32_t this_ptr, int16_t val) {
12586 LDKFundingCreated this_ptr_conv;
12587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12588 this_ptr_conv.is_owned = false;
12589 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
12592 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signature(uint32_t this_ptr) {
12593 LDKFundingCreated this_ptr_conv;
12594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12595 this_ptr_conv.is_owned = false;
12596 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12597 memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
12601 void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) {
12602 LDKFundingCreated this_ptr_conv;
12603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12604 this_ptr_conv.is_owned = false;
12605 LDKSignature val_ref;
12606 CHECK(*((uint32_t*)val) == 64);
12607 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12608 FundingCreated_set_signature(&this_ptr_conv, val_ref);
12611 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) {
12612 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
12613 CHECK(*((uint32_t*)temporary_channel_id_arg) == 32);
12614 memcpy(temporary_channel_id_arg_ref.data, (uint8_t*)(temporary_channel_id_arg + 4), 32);
12615 LDKThirtyTwoBytes funding_txid_arg_ref;
12616 CHECK(*((uint32_t*)funding_txid_arg) == 32);
12617 memcpy(funding_txid_arg_ref.data, (uint8_t*)(funding_txid_arg + 4), 32);
12618 LDKSignature signature_arg_ref;
12619 CHECK(*((uint32_t*)signature_arg) == 64);
12620 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12621 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
12622 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12623 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12624 long ret_ref = (long)ret_var.inner;
12625 if (ret_var.is_owned) {
12631 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_clone(uint32_t orig) {
12632 LDKFundingCreated orig_conv;
12633 orig_conv.inner = (void*)(orig & (~1));
12634 orig_conv.is_owned = false;
12635 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
12636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12638 long ret_ref = (long)ret_var.inner;
12639 if (ret_var.is_owned) {
12645 void __attribute__((visibility("default"))) TS_FundingSigned_free(uint32_t this_obj) {
12646 LDKFundingSigned this_obj_conv;
12647 this_obj_conv.inner = (void*)(this_obj & (~1));
12648 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12649 FundingSigned_free(this_obj_conv);
12652 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_channel_id(uint32_t this_ptr) {
12653 LDKFundingSigned this_ptr_conv;
12654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12655 this_ptr_conv.is_owned = false;
12656 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12657 memcpy((uint8_t*)(ret_arr + 4), *FundingSigned_get_channel_id(&this_ptr_conv), 32);
12661 void __attribute__((visibility("default"))) TS_FundingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12662 LDKFundingSigned this_ptr_conv;
12663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12664 this_ptr_conv.is_owned = false;
12665 LDKThirtyTwoBytes val_ref;
12666 CHECK(*((uint32_t*)val) == 32);
12667 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12668 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
12671 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signature(uint32_t this_ptr) {
12672 LDKFundingSigned this_ptr_conv;
12673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12674 this_ptr_conv.is_owned = false;
12675 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12676 memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12680 void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12681 LDKFundingSigned this_ptr_conv;
12682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12683 this_ptr_conv.is_owned = false;
12684 LDKSignature val_ref;
12685 CHECK(*((uint32_t*)val) == 64);
12686 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12687 FundingSigned_set_signature(&this_ptr_conv, val_ref);
12690 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
12691 LDKThirtyTwoBytes channel_id_arg_ref;
12692 CHECK(*((uint32_t*)channel_id_arg) == 32);
12693 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12694 LDKSignature signature_arg_ref;
12695 CHECK(*((uint32_t*)signature_arg) == 64);
12696 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12697 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
12698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12700 long ret_ref = (long)ret_var.inner;
12701 if (ret_var.is_owned) {
12707 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_clone(uint32_t orig) {
12708 LDKFundingSigned orig_conv;
12709 orig_conv.inner = (void*)(orig & (~1));
12710 orig_conv.is_owned = false;
12711 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
12712 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12713 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12714 long ret_ref = (long)ret_var.inner;
12715 if (ret_var.is_owned) {
12721 void __attribute__((visibility("default"))) TS_FundingLocked_free(uint32_t this_obj) {
12722 LDKFundingLocked this_obj_conv;
12723 this_obj_conv.inner = (void*)(this_obj & (~1));
12724 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12725 FundingLocked_free(this_obj_conv);
12728 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_channel_id(uint32_t this_ptr) {
12729 LDKFundingLocked this_ptr_conv;
12730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12731 this_ptr_conv.is_owned = false;
12732 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12733 memcpy((uint8_t*)(ret_arr + 4), *FundingLocked_get_channel_id(&this_ptr_conv), 32);
12737 void __attribute__((visibility("default"))) TS_FundingLocked_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12738 LDKFundingLocked this_ptr_conv;
12739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12740 this_ptr_conv.is_owned = false;
12741 LDKThirtyTwoBytes val_ref;
12742 CHECK(*((uint32_t*)val) == 32);
12743 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12744 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
12747 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_per_commitment_point(uint32_t this_ptr) {
12748 LDKFundingLocked this_ptr_conv;
12749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12750 this_ptr_conv.is_owned = false;
12751 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
12752 memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
12756 void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
12757 LDKFundingLocked this_ptr_conv;
12758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12759 this_ptr_conv.is_owned = false;
12760 LDKPublicKey val_ref;
12761 CHECK(*((uint32_t*)val) == 33);
12762 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
12763 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
12766 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_new(int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
12767 LDKThirtyTwoBytes channel_id_arg_ref;
12768 CHECK(*((uint32_t*)channel_id_arg) == 32);
12769 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12770 LDKPublicKey next_per_commitment_point_arg_ref;
12771 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
12772 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
12773 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
12774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12776 long ret_ref = (long)ret_var.inner;
12777 if (ret_var.is_owned) {
12783 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_clone(uint32_t orig) {
12784 LDKFundingLocked orig_conv;
12785 orig_conv.inner = (void*)(orig & (~1));
12786 orig_conv.is_owned = false;
12787 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
12788 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12789 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12790 long ret_ref = (long)ret_var.inner;
12791 if (ret_var.is_owned) {
12797 void __attribute__((visibility("default"))) TS_Shutdown_free(uint32_t this_obj) {
12798 LDKShutdown this_obj_conv;
12799 this_obj_conv.inner = (void*)(this_obj & (~1));
12800 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12801 Shutdown_free(this_obj_conv);
12804 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_channel_id(uint32_t this_ptr) {
12805 LDKShutdown this_ptr_conv;
12806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12807 this_ptr_conv.is_owned = false;
12808 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12809 memcpy((uint8_t*)(ret_arr + 4), *Shutdown_get_channel_id(&this_ptr_conv), 32);
12813 void __attribute__((visibility("default"))) TS_Shutdown_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12814 LDKShutdown this_ptr_conv;
12815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12816 this_ptr_conv.is_owned = false;
12817 LDKThirtyTwoBytes val_ref;
12818 CHECK(*((uint32_t*)val) == 32);
12819 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12820 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
12823 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey(uint32_t this_ptr) {
12824 LDKShutdown this_ptr_conv;
12825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12826 this_ptr_conv.is_owned = false;
12827 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
12828 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
12829 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
12833 void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) {
12834 LDKShutdown this_ptr_conv;
12835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12836 this_ptr_conv.is_owned = false;
12837 LDKCVec_u8Z val_ref;
12838 val_ref.datalen = *((uint32_t*)val);
12839 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12840 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
12841 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
12844 uint32_t __attribute__((visibility("default"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
12845 LDKThirtyTwoBytes channel_id_arg_ref;
12846 CHECK(*((uint32_t*)channel_id_arg) == 32);
12847 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12848 LDKCVec_u8Z scriptpubkey_arg_ref;
12849 scriptpubkey_arg_ref.datalen = *((uint32_t*)scriptpubkey_arg);
12850 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12851 memcpy(scriptpubkey_arg_ref.data, (uint8_t*)(scriptpubkey_arg + 4), scriptpubkey_arg_ref.datalen);
12852 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
12853 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12854 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12855 long ret_ref = (long)ret_var.inner;
12856 if (ret_var.is_owned) {
12862 uint32_t __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig) {
12863 LDKShutdown orig_conv;
12864 orig_conv.inner = (void*)(orig & (~1));
12865 orig_conv.is_owned = false;
12866 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
12867 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12868 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12869 long ret_ref = (long)ret_var.inner;
12870 if (ret_var.is_owned) {
12876 void __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
12877 LDKClosingSigned this_obj_conv;
12878 this_obj_conv.inner = (void*)(this_obj & (~1));
12879 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12880 ClosingSigned_free(this_obj_conv);
12883 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_channel_id(uint32_t this_ptr) {
12884 LDKClosingSigned this_ptr_conv;
12885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12886 this_ptr_conv.is_owned = false;
12887 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12888 memcpy((uint8_t*)(ret_arr + 4), *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
12892 void __attribute__((visibility("default"))) TS_ClosingSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12893 LDKClosingSigned this_ptr_conv;
12894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12895 this_ptr_conv.is_owned = false;
12896 LDKThirtyTwoBytes val_ref;
12897 CHECK(*((uint32_t*)val) == 32);
12898 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12899 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
12902 int64_t __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_satoshis(uint32_t this_ptr) {
12903 LDKClosingSigned this_ptr_conv;
12904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12905 this_ptr_conv.is_owned = false;
12906 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
12910 void __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_satoshis(uint32_t this_ptr, int64_t val) {
12911 LDKClosingSigned this_ptr_conv;
12912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12913 this_ptr_conv.is_owned = false;
12914 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
12917 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signature(uint32_t this_ptr) {
12918 LDKClosingSigned this_ptr_conv;
12919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12920 this_ptr_conv.is_owned = false;
12921 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
12922 memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
12926 void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
12927 LDKClosingSigned this_ptr_conv;
12928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12929 this_ptr_conv.is_owned = false;
12930 LDKSignature val_ref;
12931 CHECK(*((uint32_t*)val) == 64);
12932 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
12933 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
12936 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
12937 LDKThirtyTwoBytes channel_id_arg_ref;
12938 CHECK(*((uint32_t*)channel_id_arg) == 32);
12939 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
12940 LDKSignature signature_arg_ref;
12941 CHECK(*((uint32_t*)signature_arg) == 64);
12942 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
12943 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
12944 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12945 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12946 long ret_ref = (long)ret_var.inner;
12947 if (ret_var.is_owned) {
12953 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_clone(uint32_t orig) {
12954 LDKClosingSigned orig_conv;
12955 orig_conv.inner = (void*)(orig & (~1));
12956 orig_conv.is_owned = false;
12957 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
12958 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12959 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12960 long ret_ref = (long)ret_var.inner;
12961 if (ret_var.is_owned) {
12967 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_free(uint32_t this_obj) {
12968 LDKUpdateAddHTLC this_obj_conv;
12969 this_obj_conv.inner = (void*)(this_obj & (~1));
12970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
12971 UpdateAddHTLC_free(this_obj_conv);
12974 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_channel_id(uint32_t this_ptr) {
12975 LDKUpdateAddHTLC this_ptr_conv;
12976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12977 this_ptr_conv.is_owned = false;
12978 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
12979 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
12983 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
12984 LDKUpdateAddHTLC this_ptr_conv;
12985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12986 this_ptr_conv.is_owned = false;
12987 LDKThirtyTwoBytes val_ref;
12988 CHECK(*((uint32_t*)val) == 32);
12989 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
12990 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
12993 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_htlc_id(uint32_t this_ptr) {
12994 LDKUpdateAddHTLC this_ptr_conv;
12995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12996 this_ptr_conv.is_owned = false;
12997 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
13001 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13002 LDKUpdateAddHTLC this_ptr_conv;
13003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13004 this_ptr_conv.is_owned = false;
13005 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
13008 int64_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_amount_msat(uint32_t this_ptr) {
13009 LDKUpdateAddHTLC this_ptr_conv;
13010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13011 this_ptr_conv.is_owned = false;
13012 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
13016 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_amount_msat(uint32_t this_ptr, int64_t val) {
13017 LDKUpdateAddHTLC this_ptr_conv;
13018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13019 this_ptr_conv.is_owned = false;
13020 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
13023 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_payment_hash(uint32_t this_ptr) {
13024 LDKUpdateAddHTLC this_ptr_conv;
13025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13026 this_ptr_conv.is_owned = false;
13027 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13028 memcpy((uint8_t*)(ret_arr + 4), *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
13032 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
13033 LDKUpdateAddHTLC this_ptr_conv;
13034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13035 this_ptr_conv.is_owned = false;
13036 LDKThirtyTwoBytes val_ref;
13037 CHECK(*((uint32_t*)val) == 32);
13038 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13039 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
13042 int32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_get_cltv_expiry(uint32_t this_ptr) {
13043 LDKUpdateAddHTLC this_ptr_conv;
13044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13045 this_ptr_conv.is_owned = false;
13046 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
13050 void __attribute__((visibility("default"))) TS_UpdateAddHTLC_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
13051 LDKUpdateAddHTLC this_ptr_conv;
13052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13053 this_ptr_conv.is_owned = false;
13054 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
13057 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_clone(uint32_t orig) {
13058 LDKUpdateAddHTLC orig_conv;
13059 orig_conv.inner = (void*)(orig & (~1));
13060 orig_conv.is_owned = false;
13061 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
13062 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13063 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13064 long ret_ref = (long)ret_var.inner;
13065 if (ret_var.is_owned) {
13071 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_free(uint32_t this_obj) {
13072 LDKUpdateFulfillHTLC this_obj_conv;
13073 this_obj_conv.inner = (void*)(this_obj & (~1));
13074 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13075 UpdateFulfillHTLC_free(this_obj_conv);
13078 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_channel_id(uint32_t this_ptr) {
13079 LDKUpdateFulfillHTLC this_ptr_conv;
13080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13081 this_ptr_conv.is_owned = false;
13082 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13083 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
13087 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13088 LDKUpdateFulfillHTLC this_ptr_conv;
13089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13090 this_ptr_conv.is_owned = false;
13091 LDKThirtyTwoBytes val_ref;
13092 CHECK(*((uint32_t*)val) == 32);
13093 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13094 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
13097 int64_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_htlc_id(uint32_t this_ptr) {
13098 LDKUpdateFulfillHTLC this_ptr_conv;
13099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13100 this_ptr_conv.is_owned = false;
13101 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
13105 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13106 LDKUpdateFulfillHTLC this_ptr_conv;
13107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13108 this_ptr_conv.is_owned = false;
13109 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
13112 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint32_t this_ptr) {
13113 LDKUpdateFulfillHTLC this_ptr_conv;
13114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13115 this_ptr_conv.is_owned = false;
13116 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13117 memcpy((uint8_t*)(ret_arr + 4), *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
13121 void __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint32_t this_ptr, int8_tArray val) {
13122 LDKUpdateFulfillHTLC this_ptr_conv;
13123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13124 this_ptr_conv.is_owned = false;
13125 LDKThirtyTwoBytes val_ref;
13126 CHECK(*((uint32_t*)val) == 32);
13127 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13128 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
13131 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_new(int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
13132 LDKThirtyTwoBytes channel_id_arg_ref;
13133 CHECK(*((uint32_t*)channel_id_arg) == 32);
13134 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13135 LDKThirtyTwoBytes payment_preimage_arg_ref;
13136 CHECK(*((uint32_t*)payment_preimage_arg) == 32);
13137 memcpy(payment_preimage_arg_ref.data, (uint8_t*)(payment_preimage_arg + 4), 32);
13138 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
13139 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13140 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13141 long ret_ref = (long)ret_var.inner;
13142 if (ret_var.is_owned) {
13148 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_clone(uint32_t orig) {
13149 LDKUpdateFulfillHTLC orig_conv;
13150 orig_conv.inner = (void*)(orig & (~1));
13151 orig_conv.is_owned = false;
13152 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
13153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13155 long ret_ref = (long)ret_var.inner;
13156 if (ret_var.is_owned) {
13162 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_free(uint32_t this_obj) {
13163 LDKUpdateFailHTLC this_obj_conv;
13164 this_obj_conv.inner = (void*)(this_obj & (~1));
13165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13166 UpdateFailHTLC_free(this_obj_conv);
13169 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_channel_id(uint32_t this_ptr) {
13170 LDKUpdateFailHTLC this_ptr_conv;
13171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13172 this_ptr_conv.is_owned = false;
13173 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13174 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
13178 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13179 LDKUpdateFailHTLC this_ptr_conv;
13180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13181 this_ptr_conv.is_owned = false;
13182 LDKThirtyTwoBytes val_ref;
13183 CHECK(*((uint32_t*)val) == 32);
13184 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13185 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
13188 int64_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_get_htlc_id(uint32_t this_ptr) {
13189 LDKUpdateFailHTLC this_ptr_conv;
13190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13191 this_ptr_conv.is_owned = false;
13192 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
13196 void __attribute__((visibility("default"))) TS_UpdateFailHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13197 LDKUpdateFailHTLC this_ptr_conv;
13198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13199 this_ptr_conv.is_owned = false;
13200 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
13203 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_clone(uint32_t orig) {
13204 LDKUpdateFailHTLC orig_conv;
13205 orig_conv.inner = (void*)(orig & (~1));
13206 orig_conv.is_owned = false;
13207 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
13208 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13209 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13210 long ret_ref = (long)ret_var.inner;
13211 if (ret_var.is_owned) {
13217 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_free(uint32_t this_obj) {
13218 LDKUpdateFailMalformedHTLC this_obj_conv;
13219 this_obj_conv.inner = (void*)(this_obj & (~1));
13220 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13221 UpdateFailMalformedHTLC_free(this_obj_conv);
13224 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint32_t this_ptr) {
13225 LDKUpdateFailMalformedHTLC this_ptr_conv;
13226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13227 this_ptr_conv.is_owned = false;
13228 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13229 memcpy((uint8_t*)(ret_arr + 4), *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
13233 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13234 LDKUpdateFailMalformedHTLC this_ptr_conv;
13235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13236 this_ptr_conv.is_owned = false;
13237 LDKThirtyTwoBytes val_ref;
13238 CHECK(*((uint32_t*)val) == 32);
13239 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13240 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
13243 int64_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint32_t this_ptr) {
13244 LDKUpdateFailMalformedHTLC this_ptr_conv;
13245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13246 this_ptr_conv.is_owned = false;
13247 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
13251 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint32_t this_ptr, int64_t val) {
13252 LDKUpdateFailMalformedHTLC this_ptr_conv;
13253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13254 this_ptr_conv.is_owned = false;
13255 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
13258 int16_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint32_t this_ptr) {
13259 LDKUpdateFailMalformedHTLC this_ptr_conv;
13260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13261 this_ptr_conv.is_owned = false;
13262 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
13266 void __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint32_t this_ptr, int16_t val) {
13267 LDKUpdateFailMalformedHTLC this_ptr_conv;
13268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13269 this_ptr_conv.is_owned = false;
13270 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
13273 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_clone(uint32_t orig) {
13274 LDKUpdateFailMalformedHTLC orig_conv;
13275 orig_conv.inner = (void*)(orig & (~1));
13276 orig_conv.is_owned = false;
13277 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_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_CommitmentSigned_free(uint32_t this_obj) {
13288 LDKCommitmentSigned this_obj_conv;
13289 this_obj_conv.inner = (void*)(this_obj & (~1));
13290 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13291 CommitmentSigned_free(this_obj_conv);
13294 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_channel_id(uint32_t this_ptr) {
13295 LDKCommitmentSigned this_ptr_conv;
13296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13297 this_ptr_conv.is_owned = false;
13298 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13299 memcpy((uint8_t*)(ret_arr + 4), *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
13303 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13304 LDKCommitmentSigned this_ptr_conv;
13305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13306 this_ptr_conv.is_owned = false;
13307 LDKThirtyTwoBytes val_ref;
13308 CHECK(*((uint32_t*)val) == 32);
13309 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13310 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
13313 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_signature(uint32_t this_ptr) {
13314 LDKCommitmentSigned 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(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13318 memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
13322 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) {
13323 LDKCommitmentSigned this_ptr_conv;
13324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13325 this_ptr_conv.is_owned = false;
13326 LDKSignature val_ref;
13327 CHECK(*((uint32_t*)val) == 64);
13328 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13329 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
13332 void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signatures(uint32_t this_ptr, ptrArray val) {
13333 LDKCommitmentSigned this_ptr_conv;
13334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13335 this_ptr_conv.is_owned = false;
13336 LDKCVec_SignatureZ val_constr;
13337 val_constr.datalen = *((uint32_t*)val);
13338 if (val_constr.datalen > 0)
13339 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13341 val_constr.data = NULL;
13342 int8_tArray* val_vals = (int8_tArray*)(val + 4);
13343 for (size_t m = 0; m < val_constr.datalen; m++) {
13344 int8_tArray val_conv_12 = val_vals[m];
13345 LDKSignature val_conv_12_ref;
13346 CHECK(*((uint32_t*)val_conv_12) == 64);
13347 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
13348 val_constr.data[m] = val_conv_12_ref;
13350 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
13353 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
13354 LDKThirtyTwoBytes channel_id_arg_ref;
13355 CHECK(*((uint32_t*)channel_id_arg) == 32);
13356 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13357 LDKSignature signature_arg_ref;
13358 CHECK(*((uint32_t*)signature_arg) == 64);
13359 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
13360 LDKCVec_SignatureZ htlc_signatures_arg_constr;
13361 htlc_signatures_arg_constr.datalen = *((uint32_t*)htlc_signatures_arg);
13362 if (htlc_signatures_arg_constr.datalen > 0)
13363 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13365 htlc_signatures_arg_constr.data = NULL;
13366 int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4);
13367 for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
13368 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
13369 LDKSignature htlc_signatures_arg_conv_12_ref;
13370 CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64);
13371 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64);
13372 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
13374 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
13375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13377 long ret_ref = (long)ret_var.inner;
13378 if (ret_var.is_owned) {
13384 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_clone(uint32_t orig) {
13385 LDKCommitmentSigned orig_conv;
13386 orig_conv.inner = (void*)(orig & (~1));
13387 orig_conv.is_owned = false;
13388 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
13389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13391 long ret_ref = (long)ret_var.inner;
13392 if (ret_var.is_owned) {
13398 void __attribute__((visibility("default"))) TS_RevokeAndACK_free(uint32_t this_obj) {
13399 LDKRevokeAndACK this_obj_conv;
13400 this_obj_conv.inner = (void*)(this_obj & (~1));
13401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13402 RevokeAndACK_free(this_obj_conv);
13405 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_channel_id(uint32_t this_ptr) {
13406 LDKRevokeAndACK this_ptr_conv;
13407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13408 this_ptr_conv.is_owned = false;
13409 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13410 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
13414 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13415 LDKRevokeAndACK this_ptr_conv;
13416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13417 this_ptr_conv.is_owned = false;
13418 LDKThirtyTwoBytes val_ref;
13419 CHECK(*((uint32_t*)val) == 32);
13420 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13421 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
13424 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_per_commitment_secret(uint32_t this_ptr) {
13425 LDKRevokeAndACK this_ptr_conv;
13426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13427 this_ptr_conv.is_owned = false;
13428 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13429 memcpy((uint8_t*)(ret_arr + 4), *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
13433 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
13434 LDKRevokeAndACK this_ptr_conv;
13435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13436 this_ptr_conv.is_owned = false;
13437 LDKThirtyTwoBytes val_ref;
13438 CHECK(*((uint32_t*)val) == 32);
13439 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13440 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
13443 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per_commitment_point(uint32_t this_ptr) {
13444 LDKRevokeAndACK this_ptr_conv;
13445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13446 this_ptr_conv.is_owned = false;
13447 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13448 memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13452 void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13453 LDKRevokeAndACK this_ptr_conv;
13454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13455 this_ptr_conv.is_owned = false;
13456 LDKPublicKey val_ref;
13457 CHECK(*((uint32_t*)val) == 33);
13458 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13459 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
13462 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) {
13463 LDKThirtyTwoBytes channel_id_arg_ref;
13464 CHECK(*((uint32_t*)channel_id_arg) == 32);
13465 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13466 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
13467 CHECK(*((uint32_t*)per_commitment_secret_arg) == 32);
13468 memcpy(per_commitment_secret_arg_ref.data, (uint8_t*)(per_commitment_secret_arg + 4), 32);
13469 LDKPublicKey next_per_commitment_point_arg_ref;
13470 CHECK(*((uint32_t*)next_per_commitment_point_arg) == 33);
13471 memcpy(next_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(next_per_commitment_point_arg + 4), 33);
13472 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
13473 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13474 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13475 long ret_ref = (long)ret_var.inner;
13476 if (ret_var.is_owned) {
13482 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_clone(uint32_t orig) {
13483 LDKRevokeAndACK orig_conv;
13484 orig_conv.inner = (void*)(orig & (~1));
13485 orig_conv.is_owned = false;
13486 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
13487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13489 long ret_ref = (long)ret_var.inner;
13490 if (ret_var.is_owned) {
13496 void __attribute__((visibility("default"))) TS_UpdateFee_free(uint32_t this_obj) {
13497 LDKUpdateFee this_obj_conv;
13498 this_obj_conv.inner = (void*)(this_obj & (~1));
13499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13500 UpdateFee_free(this_obj_conv);
13503 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_get_channel_id(uint32_t this_ptr) {
13504 LDKUpdateFee this_ptr_conv;
13505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13506 this_ptr_conv.is_owned = false;
13507 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13508 memcpy((uint8_t*)(ret_arr + 4), *UpdateFee_get_channel_id(&this_ptr_conv), 32);
13512 void __attribute__((visibility("default"))) TS_UpdateFee_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13513 LDKUpdateFee this_ptr_conv;
13514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13515 this_ptr_conv.is_owned = false;
13516 LDKThirtyTwoBytes val_ref;
13517 CHECK(*((uint32_t*)val) == 32);
13518 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13519 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
13522 int32_t __attribute__((visibility("default"))) TS_UpdateFee_get_feerate_per_kw(uint32_t this_ptr) {
13523 LDKUpdateFee this_ptr_conv;
13524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13525 this_ptr_conv.is_owned = false;
13526 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
13530 void __attribute__((visibility("default"))) TS_UpdateFee_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
13531 LDKUpdateFee this_ptr_conv;
13532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13533 this_ptr_conv.is_owned = false;
13534 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
13537 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
13538 LDKThirtyTwoBytes channel_id_arg_ref;
13539 CHECK(*((uint32_t*)channel_id_arg) == 32);
13540 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13541 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
13542 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13543 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13544 long ret_ref = (long)ret_var.inner;
13545 if (ret_var.is_owned) {
13551 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_clone(uint32_t orig) {
13552 LDKUpdateFee orig_conv;
13553 orig_conv.inner = (void*)(orig & (~1));
13554 orig_conv.is_owned = false;
13555 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
13556 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13557 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13558 long ret_ref = (long)ret_var.inner;
13559 if (ret_var.is_owned) {
13565 void __attribute__((visibility("default"))) TS_DataLossProtect_free(uint32_t this_obj) {
13566 LDKDataLossProtect this_obj_conv;
13567 this_obj_conv.inner = (void*)(this_obj & (~1));
13568 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13569 DataLossProtect_free(this_obj_conv);
13572 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_your_last_per_commitment_secret(uint32_t this_ptr) {
13573 LDKDataLossProtect 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(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13577 memcpy((uint8_t*)(ret_arr + 4), *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
13581 void __attribute__((visibility("default"))) TS_DataLossProtect_set_your_last_per_commitment_secret(uint32_t this_ptr, int8_tArray val) {
13582 LDKDataLossProtect this_ptr_conv;
13583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13584 this_ptr_conv.is_owned = false;
13585 LDKThirtyTwoBytes val_ref;
13586 CHECK(*((uint32_t*)val) == 32);
13587 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13588 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
13591 int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_current_per_commitment_point(uint32_t this_ptr) {
13592 LDKDataLossProtect 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), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
13600 void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
13601 LDKDataLossProtect 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 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
13610 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_new(int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
13611 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
13612 CHECK(*((uint32_t*)your_last_per_commitment_secret_arg) == 32);
13613 memcpy(your_last_per_commitment_secret_arg_ref.data, (uint8_t*)(your_last_per_commitment_secret_arg + 4), 32);
13614 LDKPublicKey my_current_per_commitment_point_arg_ref;
13615 CHECK(*((uint32_t*)my_current_per_commitment_point_arg) == 33);
13616 memcpy(my_current_per_commitment_point_arg_ref.compressed_form, (uint8_t*)(my_current_per_commitment_point_arg + 4), 33);
13617 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
13618 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13619 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13620 long ret_ref = (long)ret_var.inner;
13621 if (ret_var.is_owned) {
13627 uint32_t __attribute__((visibility("default"))) TS_DataLossProtect_clone(uint32_t orig) {
13628 LDKDataLossProtect orig_conv;
13629 orig_conv.inner = (void*)(orig & (~1));
13630 orig_conv.is_owned = false;
13631 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
13632 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13633 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13634 long ret_ref = (long)ret_var.inner;
13635 if (ret_var.is_owned) {
13641 void __attribute__((visibility("default"))) TS_ChannelReestablish_free(uint32_t this_obj) {
13642 LDKChannelReestablish this_obj_conv;
13643 this_obj_conv.inner = (void*)(this_obj & (~1));
13644 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13645 ChannelReestablish_free(this_obj_conv);
13648 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_get_channel_id(uint32_t this_ptr) {
13649 LDKChannelReestablish this_ptr_conv;
13650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13651 this_ptr_conv.is_owned = false;
13652 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13653 memcpy((uint8_t*)(ret_arr + 4), *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
13657 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13658 LDKChannelReestablish this_ptr_conv;
13659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13660 this_ptr_conv.is_owned = false;
13661 LDKThirtyTwoBytes val_ref;
13662 CHECK(*((uint32_t*)val) == 32);
13663 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13664 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
13667 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_local_commitment_number(uint32_t this_ptr) {
13668 LDKChannelReestablish this_ptr_conv;
13669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13670 this_ptr_conv.is_owned = false;
13671 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
13675 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_local_commitment_number(uint32_t this_ptr, int64_t val) {
13676 LDKChannelReestablish this_ptr_conv;
13677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13678 this_ptr_conv.is_owned = false;
13679 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
13682 int64_t __attribute__((visibility("default"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint32_t this_ptr) {
13683 LDKChannelReestablish this_ptr_conv;
13684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13685 this_ptr_conv.is_owned = false;
13686 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
13690 void __attribute__((visibility("default"))) TS_ChannelReestablish_set_next_remote_commitment_number(uint32_t this_ptr, int64_t val) {
13691 LDKChannelReestablish this_ptr_conv;
13692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13693 this_ptr_conv.is_owned = false;
13694 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
13697 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_clone(uint32_t orig) {
13698 LDKChannelReestablish orig_conv;
13699 orig_conv.inner = (void*)(orig & (~1));
13700 orig_conv.is_owned = false;
13701 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
13702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13704 long ret_ref = (long)ret_var.inner;
13705 if (ret_var.is_owned) {
13711 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_free(uint32_t this_obj) {
13712 LDKAnnouncementSignatures this_obj_conv;
13713 this_obj_conv.inner = (void*)(this_obj & (~1));
13714 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13715 AnnouncementSignatures_free(this_obj_conv);
13718 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_channel_id(uint32_t this_ptr) {
13719 LDKAnnouncementSignatures this_ptr_conv;
13720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13721 this_ptr_conv.is_owned = false;
13722 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13723 memcpy((uint8_t*)(ret_arr + 4), *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
13727 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_channel_id(uint32_t this_ptr, int8_tArray val) {
13728 LDKAnnouncementSignatures this_ptr_conv;
13729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13730 this_ptr_conv.is_owned = false;
13731 LDKThirtyTwoBytes val_ref;
13732 CHECK(*((uint32_t*)val) == 32);
13733 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13734 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
13737 int64_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_short_channel_id(uint32_t this_ptr) {
13738 LDKAnnouncementSignatures this_ptr_conv;
13739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13740 this_ptr_conv.is_owned = false;
13741 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
13745 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_short_channel_id(uint32_t this_ptr, int64_t val) {
13746 LDKAnnouncementSignatures this_ptr_conv;
13747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13748 this_ptr_conv.is_owned = false;
13749 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
13752 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_node_signature(uint32_t this_ptr) {
13753 LDKAnnouncementSignatures this_ptr_conv;
13754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13755 this_ptr_conv.is_owned = false;
13756 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13757 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
13761 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) {
13762 LDKAnnouncementSignatures this_ptr_conv;
13763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13764 this_ptr_conv.is_owned = false;
13765 LDKSignature val_ref;
13766 CHECK(*((uint32_t*)val) == 64);
13767 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13768 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
13771 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint32_t this_ptr) {
13772 LDKAnnouncementSignatures this_ptr_conv;
13773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13774 this_ptr_conv.is_owned = false;
13775 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
13776 memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
13780 void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) {
13781 LDKAnnouncementSignatures this_ptr_conv;
13782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13783 this_ptr_conv.is_owned = false;
13784 LDKSignature val_ref;
13785 CHECK(*((uint32_t*)val) == 64);
13786 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
13787 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
13790 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) {
13791 LDKThirtyTwoBytes channel_id_arg_ref;
13792 CHECK(*((uint32_t*)channel_id_arg) == 32);
13793 memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
13794 LDKSignature node_signature_arg_ref;
13795 CHECK(*((uint32_t*)node_signature_arg) == 64);
13796 memcpy(node_signature_arg_ref.compact_form, (uint8_t*)(node_signature_arg + 4), 64);
13797 LDKSignature bitcoin_signature_arg_ref;
13798 CHECK(*((uint32_t*)bitcoin_signature_arg) == 64);
13799 memcpy(bitcoin_signature_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_arg + 4), 64);
13800 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
13801 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13802 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13803 long ret_ref = (long)ret_var.inner;
13804 if (ret_var.is_owned) {
13810 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_clone(uint32_t orig) {
13811 LDKAnnouncementSignatures orig_conv;
13812 orig_conv.inner = (void*)(orig & (~1));
13813 orig_conv.is_owned = false;
13814 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
13815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13817 long ret_ref = (long)ret_var.inner;
13818 if (ret_var.is_owned) {
13824 void __attribute__((visibility("default"))) TS_NetAddress_free(uint32_t this_ptr) {
13825 if ((this_ptr & 1) != 0) return;
13826 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
13827 FREE((void*)this_ptr);
13828 NetAddress_free(this_ptr_conv);
13831 uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t orig) {
13832 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
13833 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
13834 *ret_copy = NetAddress_clone(orig_conv);
13835 long ret_ref = (long)ret_copy;
13839 int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) {
13840 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
13841 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
13842 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
13843 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
13844 CVec_u8Z_free(ret_var);
13848 uint32_t __attribute__((visibility("default"))) TS_Result_read(int8_tArray ser) {
13849 LDKu8slice ser_ref;
13850 ser_ref.datalen = *((uint32_t*)ser);
13851 ser_ref.data = (int8_t*)(ser + 4);
13852 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13853 *ret_conv = Result_read(ser_ref);
13854 return (long)ret_conv;
13857 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_free(uint32_t this_obj) {
13858 LDKUnsignedNodeAnnouncement this_obj_conv;
13859 this_obj_conv.inner = (void*)(this_obj & (~1));
13860 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13861 UnsignedNodeAnnouncement_free(this_obj_conv);
13864 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_features(uint32_t this_ptr) {
13865 LDKUnsignedNodeAnnouncement this_ptr_conv;
13866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13867 this_ptr_conv.is_owned = false;
13868 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
13869 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13870 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13871 long ret_ref = (long)ret_var.inner;
13872 if (ret_var.is_owned) {
13878 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
13879 LDKUnsignedNodeAnnouncement this_ptr_conv;
13880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13881 this_ptr_conv.is_owned = false;
13882 LDKNodeFeatures val_conv;
13883 val_conv.inner = (void*)(val & (~1));
13884 val_conv.is_owned = (val & 1) || (val == 0);
13885 val_conv = NodeFeatures_clone(&val_conv);
13886 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
13889 int32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint32_t this_ptr) {
13890 LDKUnsignedNodeAnnouncement this_ptr_conv;
13891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13892 this_ptr_conv.is_owned = false;
13893 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
13897 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint32_t this_ptr, int32_t val) {
13898 LDKUnsignedNodeAnnouncement this_ptr_conv;
13899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13900 this_ptr_conv.is_owned = false;
13901 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
13904 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_node_id(uint32_t this_ptr) {
13905 LDKUnsignedNodeAnnouncement this_ptr_conv;
13906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13907 this_ptr_conv.is_owned = false;
13908 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
13909 memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
13913 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) {
13914 LDKUnsignedNodeAnnouncement this_ptr_conv;
13915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13916 this_ptr_conv.is_owned = false;
13917 LDKPublicKey val_ref;
13918 CHECK(*((uint32_t*)val) == 33);
13919 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
13920 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
13923 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_rgb(uint32_t this_ptr) {
13924 LDKUnsignedNodeAnnouncement this_ptr_conv;
13925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13926 this_ptr_conv.is_owned = false;
13927 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
13928 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
13932 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_rgb(uint32_t this_ptr, int8_tArray val) {
13933 LDKUnsignedNodeAnnouncement this_ptr_conv;
13934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13935 this_ptr_conv.is_owned = false;
13936 LDKThreeBytes val_ref;
13937 CHECK(*((uint32_t*)val) == 3);
13938 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
13939 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
13942 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_get_alias(uint32_t this_ptr) {
13943 LDKUnsignedNodeAnnouncement this_ptr_conv;
13944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13945 this_ptr_conv.is_owned = false;
13946 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
13947 memcpy((uint8_t*)(ret_arr + 4), *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
13951 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_alias(uint32_t this_ptr, int8_tArray val) {
13952 LDKUnsignedNodeAnnouncement this_ptr_conv;
13953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13954 this_ptr_conv.is_owned = false;
13955 LDKThirtyTwoBytes val_ref;
13956 CHECK(*((uint32_t*)val) == 32);
13957 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
13958 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
13961 void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_addresses(uint32_t this_ptr, uint32_tArray val) {
13962 LDKUnsignedNodeAnnouncement this_ptr_conv;
13963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13964 this_ptr_conv.is_owned = false;
13965 LDKCVec_NetAddressZ val_constr;
13966 val_constr.datalen = *((uint32_t*)val);
13967 if (val_constr.datalen > 0)
13968 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
13970 val_constr.data = NULL;
13971 uint32_t* val_vals = (uint32_t*)(val + 4);
13972 for (size_t m = 0; m < val_constr.datalen; m++) {
13973 uint32_t val_conv_12 = val_vals[m];
13974 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
13975 FREE((void*)val_conv_12);
13976 val_constr.data[m] = val_conv_12_conv;
13978 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
13981 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_clone(uint32_t orig) {
13982 LDKUnsignedNodeAnnouncement orig_conv;
13983 orig_conv.inner = (void*)(orig & (~1));
13984 orig_conv.is_owned = false;
13985 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
13986 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13987 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13988 long ret_ref = (long)ret_var.inner;
13989 if (ret_var.is_owned) {
13995 void __attribute__((visibility("default"))) TS_NodeAnnouncement_free(uint32_t this_obj) {
13996 LDKNodeAnnouncement this_obj_conv;
13997 this_obj_conv.inner = (void*)(this_obj & (~1));
13998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13999 NodeAnnouncement_free(this_obj_conv);
14002 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_signature(uint32_t this_ptr) {
14003 LDKNodeAnnouncement this_ptr_conv;
14004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14005 this_ptr_conv.is_owned = false;
14006 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14007 memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
14011 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) {
14012 LDKNodeAnnouncement this_ptr_conv;
14013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14014 this_ptr_conv.is_owned = false;
14015 LDKSignature val_ref;
14016 CHECK(*((uint32_t*)val) == 64);
14017 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14018 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
14021 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_get_contents(uint32_t this_ptr) {
14022 LDKNodeAnnouncement this_ptr_conv;
14023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14024 this_ptr_conv.is_owned = false;
14025 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
14026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14028 long ret_ref = (long)ret_var.inner;
14029 if (ret_var.is_owned) {
14035 void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
14036 LDKNodeAnnouncement this_ptr_conv;
14037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14038 this_ptr_conv.is_owned = false;
14039 LDKUnsignedNodeAnnouncement val_conv;
14040 val_conv.inner = (void*)(val & (~1));
14041 val_conv.is_owned = (val & 1) || (val == 0);
14042 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
14043 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
14046 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint32_t contents_arg) {
14047 LDKSignature signature_arg_ref;
14048 CHECK(*((uint32_t*)signature_arg) == 64);
14049 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
14050 LDKUnsignedNodeAnnouncement contents_arg_conv;
14051 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14052 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14053 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
14054 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
14055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14057 long ret_ref = (long)ret_var.inner;
14058 if (ret_var.is_owned) {
14064 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_clone(uint32_t orig) {
14065 LDKNodeAnnouncement orig_conv;
14066 orig_conv.inner = (void*)(orig & (~1));
14067 orig_conv.is_owned = false;
14068 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
14069 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14070 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14071 long ret_ref = (long)ret_var.inner;
14072 if (ret_var.is_owned) {
14078 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_free(uint32_t this_obj) {
14079 LDKUnsignedChannelAnnouncement this_obj_conv;
14080 this_obj_conv.inner = (void*)(this_obj & (~1));
14081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14082 UnsignedChannelAnnouncement_free(this_obj_conv);
14085 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_features(uint32_t this_ptr) {
14086 LDKUnsignedChannelAnnouncement this_ptr_conv;
14087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14088 this_ptr_conv.is_owned = false;
14089 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
14090 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14091 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14092 long ret_ref = (long)ret_var.inner;
14093 if (ret_var.is_owned) {
14099 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_features(uint32_t this_ptr, uint32_t val) {
14100 LDKUnsignedChannelAnnouncement this_ptr_conv;
14101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14102 this_ptr_conv.is_owned = false;
14103 LDKChannelFeatures val_conv;
14104 val_conv.inner = (void*)(val & (~1));
14105 val_conv.is_owned = (val & 1) || (val == 0);
14106 val_conv = ChannelFeatures_clone(&val_conv);
14107 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
14110 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint32_t this_ptr) {
14111 LDKUnsignedChannelAnnouncement this_ptr_conv;
14112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14113 this_ptr_conv.is_owned = false;
14114 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14115 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
14119 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14120 LDKUnsignedChannelAnnouncement this_ptr_conv;
14121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14122 this_ptr_conv.is_owned = false;
14123 LDKThirtyTwoBytes val_ref;
14124 CHECK(*((uint32_t*)val) == 32);
14125 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14126 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
14129 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint32_t this_ptr) {
14130 LDKUnsignedChannelAnnouncement this_ptr_conv;
14131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14132 this_ptr_conv.is_owned = false;
14133 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
14137 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14138 LDKUnsignedChannelAnnouncement this_ptr_conv;
14139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14140 this_ptr_conv.is_owned = false;
14141 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
14144 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint32_t this_ptr) {
14145 LDKUnsignedChannelAnnouncement this_ptr_conv;
14146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14147 this_ptr_conv.is_owned = false;
14148 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14149 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
14153 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) {
14154 LDKUnsignedChannelAnnouncement this_ptr_conv;
14155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14156 this_ptr_conv.is_owned = false;
14157 LDKPublicKey val_ref;
14158 CHECK(*((uint32_t*)val) == 33);
14159 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14160 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
14163 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint32_t this_ptr) {
14164 LDKUnsignedChannelAnnouncement this_ptr_conv;
14165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14166 this_ptr_conv.is_owned = false;
14167 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14168 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
14172 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) {
14173 LDKUnsignedChannelAnnouncement this_ptr_conv;
14174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14175 this_ptr_conv.is_owned = false;
14176 LDKPublicKey val_ref;
14177 CHECK(*((uint32_t*)val) == 33);
14178 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14179 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
14182 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint32_t this_ptr) {
14183 LDKUnsignedChannelAnnouncement this_ptr_conv;
14184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14185 this_ptr_conv.is_owned = false;
14186 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14187 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
14191 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) {
14192 LDKUnsignedChannelAnnouncement this_ptr_conv;
14193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14194 this_ptr_conv.is_owned = false;
14195 LDKPublicKey val_ref;
14196 CHECK(*((uint32_t*)val) == 33);
14197 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14198 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
14201 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint32_t this_ptr) {
14202 LDKUnsignedChannelAnnouncement this_ptr_conv;
14203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14204 this_ptr_conv.is_owned = false;
14205 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
14206 memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
14210 void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) {
14211 LDKUnsignedChannelAnnouncement this_ptr_conv;
14212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14213 this_ptr_conv.is_owned = false;
14214 LDKPublicKey val_ref;
14215 CHECK(*((uint32_t*)val) == 33);
14216 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
14217 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
14220 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_clone(uint32_t orig) {
14221 LDKUnsignedChannelAnnouncement orig_conv;
14222 orig_conv.inner = (void*)(orig & (~1));
14223 orig_conv.is_owned = false;
14224 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
14225 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14226 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14227 long ret_ref = (long)ret_var.inner;
14228 if (ret_var.is_owned) {
14234 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_free(uint32_t this_obj) {
14235 LDKChannelAnnouncement this_obj_conv;
14236 this_obj_conv.inner = (void*)(this_obj & (~1));
14237 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14238 ChannelAnnouncement_free(this_obj_conv);
14241 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_1(uint32_t this_ptr) {
14242 LDKChannelAnnouncement this_ptr_conv;
14243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14244 this_ptr_conv.is_owned = false;
14245 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14246 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
14250 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) {
14251 LDKChannelAnnouncement this_ptr_conv;
14252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14253 this_ptr_conv.is_owned = false;
14254 LDKSignature val_ref;
14255 CHECK(*((uint32_t*)val) == 64);
14256 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14257 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
14260 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_node_signature_2(uint32_t this_ptr) {
14261 LDKChannelAnnouncement this_ptr_conv;
14262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14263 this_ptr_conv.is_owned = false;
14264 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14265 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
14269 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) {
14270 LDKChannelAnnouncement this_ptr_conv;
14271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14272 this_ptr_conv.is_owned = false;
14273 LDKSignature val_ref;
14274 CHECK(*((uint32_t*)val) == 64);
14275 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14276 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
14279 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint32_t this_ptr) {
14280 LDKChannelAnnouncement this_ptr_conv;
14281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14282 this_ptr_conv.is_owned = false;
14283 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14284 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
14288 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) {
14289 LDKChannelAnnouncement this_ptr_conv;
14290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14291 this_ptr_conv.is_owned = false;
14292 LDKSignature val_ref;
14293 CHECK(*((uint32_t*)val) == 64);
14294 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14295 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
14298 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint32_t this_ptr) {
14299 LDKChannelAnnouncement this_ptr_conv;
14300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14301 this_ptr_conv.is_owned = false;
14302 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14303 memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
14307 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) {
14308 LDKChannelAnnouncement this_ptr_conv;
14309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14310 this_ptr_conv.is_owned = false;
14311 LDKSignature val_ref;
14312 CHECK(*((uint32_t*)val) == 64);
14313 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14314 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
14317 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_contents(uint32_t this_ptr) {
14318 LDKChannelAnnouncement this_ptr_conv;
14319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14320 this_ptr_conv.is_owned = false;
14321 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
14322 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14323 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14324 long ret_ref = (long)ret_var.inner;
14325 if (ret_var.is_owned) {
14331 void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_contents(uint32_t this_ptr, uint32_t val) {
14332 LDKChannelAnnouncement this_ptr_conv;
14333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14334 this_ptr_conv.is_owned = false;
14335 LDKUnsignedChannelAnnouncement val_conv;
14336 val_conv.inner = (void*)(val & (~1));
14337 val_conv.is_owned = (val & 1) || (val == 0);
14338 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
14339 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
14342 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) {
14343 LDKSignature node_signature_1_arg_ref;
14344 CHECK(*((uint32_t*)node_signature_1_arg) == 64);
14345 memcpy(node_signature_1_arg_ref.compact_form, (uint8_t*)(node_signature_1_arg + 4), 64);
14346 LDKSignature node_signature_2_arg_ref;
14347 CHECK(*((uint32_t*)node_signature_2_arg) == 64);
14348 memcpy(node_signature_2_arg_ref.compact_form, (uint8_t*)(node_signature_2_arg + 4), 64);
14349 LDKSignature bitcoin_signature_1_arg_ref;
14350 CHECK(*((uint32_t*)bitcoin_signature_1_arg) == 64);
14351 memcpy(bitcoin_signature_1_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_1_arg + 4), 64);
14352 LDKSignature bitcoin_signature_2_arg_ref;
14353 CHECK(*((uint32_t*)bitcoin_signature_2_arg) == 64);
14354 memcpy(bitcoin_signature_2_arg_ref.compact_form, (uint8_t*)(bitcoin_signature_2_arg + 4), 64);
14355 LDKUnsignedChannelAnnouncement contents_arg_conv;
14356 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14357 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14358 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
14359 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);
14360 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14361 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14362 long ret_ref = (long)ret_var.inner;
14363 if (ret_var.is_owned) {
14369 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_clone(uint32_t orig) {
14370 LDKChannelAnnouncement orig_conv;
14371 orig_conv.inner = (void*)(orig & (~1));
14372 orig_conv.is_owned = false;
14373 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
14374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14376 long ret_ref = (long)ret_var.inner;
14377 if (ret_var.is_owned) {
14383 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_free(uint32_t this_obj) {
14384 LDKUnsignedChannelUpdate this_obj_conv;
14385 this_obj_conv.inner = (void*)(this_obj & (~1));
14386 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14387 UnsignedChannelUpdate_free(this_obj_conv);
14390 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_chain_hash(uint32_t this_ptr) {
14391 LDKUnsignedChannelUpdate this_ptr_conv;
14392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14393 this_ptr_conv.is_owned = false;
14394 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14395 memcpy((uint8_t*)(ret_arr + 4), *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
14399 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14400 LDKUnsignedChannelUpdate this_ptr_conv;
14401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14402 this_ptr_conv.is_owned = false;
14403 LDKThirtyTwoBytes val_ref;
14404 CHECK(*((uint32_t*)val) == 32);
14405 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14406 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
14409 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint32_t this_ptr) {
14410 LDKUnsignedChannelUpdate this_ptr_conv;
14411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14412 this_ptr_conv.is_owned = false;
14413 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
14417 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint32_t this_ptr, int64_t val) {
14418 LDKUnsignedChannelUpdate this_ptr_conv;
14419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14420 this_ptr_conv.is_owned = false;
14421 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
14424 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_timestamp(uint32_t this_ptr) {
14425 LDKUnsignedChannelUpdate this_ptr_conv;
14426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14427 this_ptr_conv.is_owned = false;
14428 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
14432 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_timestamp(uint32_t this_ptr, int32_t val) {
14433 LDKUnsignedChannelUpdate this_ptr_conv;
14434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14435 this_ptr_conv.is_owned = false;
14436 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
14439 int8_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_flags(uint32_t this_ptr) {
14440 LDKUnsignedChannelUpdate this_ptr_conv;
14441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14442 this_ptr_conv.is_owned = false;
14443 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
14447 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_flags(uint32_t this_ptr, int8_t val) {
14448 LDKUnsignedChannelUpdate this_ptr_conv;
14449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14450 this_ptr_conv.is_owned = false;
14451 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
14454 int16_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint32_t this_ptr) {
14455 LDKUnsignedChannelUpdate this_ptr_conv;
14456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14457 this_ptr_conv.is_owned = false;
14458 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
14462 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
14463 LDKUnsignedChannelUpdate this_ptr_conv;
14464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14465 this_ptr_conv.is_owned = false;
14466 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
14469 int64_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint32_t this_ptr) {
14470 LDKUnsignedChannelUpdate this_ptr_conv;
14471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14472 this_ptr_conv.is_owned = false;
14473 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
14477 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
14478 LDKUnsignedChannelUpdate this_ptr_conv;
14479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14480 this_ptr_conv.is_owned = false;
14481 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
14484 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint32_t this_ptr) {
14485 LDKUnsignedChannelUpdate this_ptr_conv;
14486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14487 this_ptr_conv.is_owned = false;
14488 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
14492 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
14493 LDKUnsignedChannelUpdate this_ptr_conv;
14494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14495 this_ptr_conv.is_owned = false;
14496 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
14499 int32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint32_t this_ptr) {
14500 LDKUnsignedChannelUpdate this_ptr_conv;
14501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14502 this_ptr_conv.is_owned = false;
14503 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
14507 void __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
14508 LDKUnsignedChannelUpdate this_ptr_conv;
14509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14510 this_ptr_conv.is_owned = false;
14511 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
14514 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_clone(uint32_t orig) {
14515 LDKUnsignedChannelUpdate orig_conv;
14516 orig_conv.inner = (void*)(orig & (~1));
14517 orig_conv.is_owned = false;
14518 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
14519 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14520 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14521 long ret_ref = (long)ret_var.inner;
14522 if (ret_var.is_owned) {
14528 void __attribute__((visibility("default"))) TS_ChannelUpdate_free(uint32_t this_obj) {
14529 LDKChannelUpdate this_obj_conv;
14530 this_obj_conv.inner = (void*)(this_obj & (~1));
14531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14532 ChannelUpdate_free(this_obj_conv);
14535 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signature(uint32_t this_ptr) {
14536 LDKChannelUpdate this_ptr_conv;
14537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14538 this_ptr_conv.is_owned = false;
14539 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
14540 memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
14544 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) {
14545 LDKChannelUpdate this_ptr_conv;
14546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14547 this_ptr_conv.is_owned = false;
14548 LDKSignature val_ref;
14549 CHECK(*((uint32_t*)val) == 64);
14550 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
14551 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
14554 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_get_contents(uint32_t this_ptr) {
14555 LDKChannelUpdate this_ptr_conv;
14556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14557 this_ptr_conv.is_owned = false;
14558 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
14559 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14560 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14561 long ret_ref = (long)ret_var.inner;
14562 if (ret_var.is_owned) {
14568 void __attribute__((visibility("default"))) TS_ChannelUpdate_set_contents(uint32_t this_ptr, uint32_t val) {
14569 LDKChannelUpdate this_ptr_conv;
14570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14571 this_ptr_conv.is_owned = false;
14572 LDKUnsignedChannelUpdate val_conv;
14573 val_conv.inner = (void*)(val & (~1));
14574 val_conv.is_owned = (val & 1) || (val == 0);
14575 val_conv = UnsignedChannelUpdate_clone(&val_conv);
14576 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
14579 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint32_t contents_arg) {
14580 LDKSignature signature_arg_ref;
14581 CHECK(*((uint32_t*)signature_arg) == 64);
14582 memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
14583 LDKUnsignedChannelUpdate contents_arg_conv;
14584 contents_arg_conv.inner = (void*)(contents_arg & (~1));
14585 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
14586 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
14587 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
14588 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14589 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14590 long ret_ref = (long)ret_var.inner;
14591 if (ret_var.is_owned) {
14597 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_clone(uint32_t orig) {
14598 LDKChannelUpdate orig_conv;
14599 orig_conv.inner = (void*)(orig & (~1));
14600 orig_conv.is_owned = false;
14601 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
14602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14604 long ret_ref = (long)ret_var.inner;
14605 if (ret_var.is_owned) {
14611 void __attribute__((visibility("default"))) TS_QueryChannelRange_free(uint32_t this_obj) {
14612 LDKQueryChannelRange this_obj_conv;
14613 this_obj_conv.inner = (void*)(this_obj & (~1));
14614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14615 QueryChannelRange_free(this_obj_conv);
14618 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_get_chain_hash(uint32_t this_ptr) {
14619 LDKQueryChannelRange this_ptr_conv;
14620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14621 this_ptr_conv.is_owned = false;
14622 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14623 memcpy((uint8_t*)(ret_arr + 4), *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
14627 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14628 LDKQueryChannelRange this_ptr_conv;
14629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14630 this_ptr_conv.is_owned = false;
14631 LDKThirtyTwoBytes val_ref;
14632 CHECK(*((uint32_t*)val) == 32);
14633 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14634 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14637 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_first_blocknum(uint32_t this_ptr) {
14638 LDKQueryChannelRange this_ptr_conv;
14639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14640 this_ptr_conv.is_owned = false;
14641 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
14645 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14646 LDKQueryChannelRange this_ptr_conv;
14647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14648 this_ptr_conv.is_owned = false;
14649 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
14652 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14653 LDKQueryChannelRange this_ptr_conv;
14654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14655 this_ptr_conv.is_owned = false;
14656 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
14660 void __attribute__((visibility("default"))) TS_QueryChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14661 LDKQueryChannelRange this_ptr_conv;
14662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14663 this_ptr_conv.is_owned = false;
14664 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14667 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_new(int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
14668 LDKThirtyTwoBytes chain_hash_arg_ref;
14669 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14670 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14671 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
14672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14674 long ret_ref = (long)ret_var.inner;
14675 if (ret_var.is_owned) {
14681 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_clone(uint32_t orig) {
14682 LDKQueryChannelRange orig_conv;
14683 orig_conv.inner = (void*)(orig & (~1));
14684 orig_conv.is_owned = false;
14685 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
14686 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14687 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14688 long ret_ref = (long)ret_var.inner;
14689 if (ret_var.is_owned) {
14695 void __attribute__((visibility("default"))) TS_ReplyChannelRange_free(uint32_t this_obj) {
14696 LDKReplyChannelRange this_obj_conv;
14697 this_obj_conv.inner = (void*)(this_obj & (~1));
14698 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14699 ReplyChannelRange_free(this_obj_conv);
14702 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_get_chain_hash(uint32_t this_ptr) {
14703 LDKReplyChannelRange this_ptr_conv;
14704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14705 this_ptr_conv.is_owned = false;
14706 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14707 memcpy((uint8_t*)(ret_arr + 4), *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
14711 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14712 LDKReplyChannelRange this_ptr_conv;
14713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14714 this_ptr_conv.is_owned = false;
14715 LDKThirtyTwoBytes val_ref;
14716 CHECK(*((uint32_t*)val) == 32);
14717 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14718 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
14721 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_first_blocknum(uint32_t this_ptr) {
14722 LDKReplyChannelRange this_ptr_conv;
14723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14724 this_ptr_conv.is_owned = false;
14725 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
14729 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_first_blocknum(uint32_t this_ptr, int32_t val) {
14730 LDKReplyChannelRange this_ptr_conv;
14731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14732 this_ptr_conv.is_owned = false;
14733 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
14736 int32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_get_number_of_blocks(uint32_t this_ptr) {
14737 LDKReplyChannelRange this_ptr_conv;
14738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14739 this_ptr_conv.is_owned = false;
14740 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
14744 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_number_of_blocks(uint32_t this_ptr, int32_t val) {
14745 LDKReplyChannelRange this_ptr_conv;
14746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14747 this_ptr_conv.is_owned = false;
14748 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
14751 jboolean __attribute__((visibility("default"))) TS_ReplyChannelRange_get_sync_complete(uint32_t this_ptr) {
14752 LDKReplyChannelRange this_ptr_conv;
14753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14754 this_ptr_conv.is_owned = false;
14755 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
14759 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_sync_complete(uint32_t this_ptr, jboolean val) {
14760 LDKReplyChannelRange this_ptr_conv;
14761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14762 this_ptr_conv.is_owned = false;
14763 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
14766 void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14767 LDKReplyChannelRange this_ptr_conv;
14768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14769 this_ptr_conv.is_owned = false;
14770 LDKCVec_u64Z val_constr;
14771 val_constr.datalen = *((uint32_t*)val);
14772 if (val_constr.datalen > 0)
14773 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14775 val_constr.data = NULL;
14776 int64_t* val_vals = (int64_t*)(val + 4);
14777 for (size_t i = 0; i < val_constr.datalen; i++) {
14778 int64_t val_conv_8 = val_vals[i];
14779 val_constr.data[i] = val_conv_8;
14781 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
14784 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) {
14785 LDKThirtyTwoBytes chain_hash_arg_ref;
14786 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14787 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14788 LDKCVec_u64Z short_channel_ids_arg_constr;
14789 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14790 if (short_channel_ids_arg_constr.datalen > 0)
14791 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14793 short_channel_ids_arg_constr.data = NULL;
14794 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14795 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14796 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14797 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14799 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
14800 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14801 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14802 long ret_ref = (long)ret_var.inner;
14803 if (ret_var.is_owned) {
14809 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_clone(uint32_t orig) {
14810 LDKReplyChannelRange orig_conv;
14811 orig_conv.inner = (void*)(orig & (~1));
14812 orig_conv.is_owned = false;
14813 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
14814 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14815 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14816 long ret_ref = (long)ret_var.inner;
14817 if (ret_var.is_owned) {
14823 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_free(uint32_t this_obj) {
14824 LDKQueryShortChannelIds this_obj_conv;
14825 this_obj_conv.inner = (void*)(this_obj & (~1));
14826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14827 QueryShortChannelIds_free(this_obj_conv);
14830 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_get_chain_hash(uint32_t this_ptr) {
14831 LDKQueryShortChannelIds this_ptr_conv;
14832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14833 this_ptr_conv.is_owned = false;
14834 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14835 memcpy((uint8_t*)(ret_arr + 4), *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
14839 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14840 LDKQueryShortChannelIds this_ptr_conv;
14841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14842 this_ptr_conv.is_owned = false;
14843 LDKThirtyTwoBytes val_ref;
14844 CHECK(*((uint32_t*)val) == 32);
14845 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14846 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
14849 void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_channel_ids(uint32_t this_ptr, int64_tArray val) {
14850 LDKQueryShortChannelIds this_ptr_conv;
14851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14852 this_ptr_conv.is_owned = false;
14853 LDKCVec_u64Z val_constr;
14854 val_constr.datalen = *((uint32_t*)val);
14855 if (val_constr.datalen > 0)
14856 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14858 val_constr.data = NULL;
14859 int64_t* val_vals = (int64_t*)(val + 4);
14860 for (size_t i = 0; i < val_constr.datalen; i++) {
14861 int64_t val_conv_8 = val_vals[i];
14862 val_constr.data[i] = val_conv_8;
14864 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
14867 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
14868 LDKThirtyTwoBytes chain_hash_arg_ref;
14869 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14870 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14871 LDKCVec_u64Z short_channel_ids_arg_constr;
14872 short_channel_ids_arg_constr.datalen = *((uint32_t*)short_channel_ids_arg);
14873 if (short_channel_ids_arg_constr.datalen > 0)
14874 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
14876 short_channel_ids_arg_constr.data = NULL;
14877 int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4);
14878 for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
14879 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
14880 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
14882 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
14883 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14884 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14885 long ret_ref = (long)ret_var.inner;
14886 if (ret_var.is_owned) {
14892 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_clone(uint32_t orig) {
14893 LDKQueryShortChannelIds orig_conv;
14894 orig_conv.inner = (void*)(orig & (~1));
14895 orig_conv.is_owned = false;
14896 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
14897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14899 long ret_ref = (long)ret_var.inner;
14900 if (ret_var.is_owned) {
14906 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_free(uint32_t this_obj) {
14907 LDKReplyShortChannelIdsEnd this_obj_conv;
14908 this_obj_conv.inner = (void*)(this_obj & (~1));
14909 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14910 ReplyShortChannelIdsEnd_free(this_obj_conv);
14913 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint32_t this_ptr) {
14914 LDKReplyShortChannelIdsEnd this_ptr_conv;
14915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14916 this_ptr_conv.is_owned = false;
14917 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14918 memcpy((uint8_t*)(ret_arr + 4), *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
14922 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14923 LDKReplyShortChannelIdsEnd this_ptr_conv;
14924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14925 this_ptr_conv.is_owned = false;
14926 LDKThirtyTwoBytes val_ref;
14927 CHECK(*((uint32_t*)val) == 32);
14928 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14929 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
14932 jboolean __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint32_t this_ptr) {
14933 LDKReplyShortChannelIdsEnd this_ptr_conv;
14934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14935 this_ptr_conv.is_owned = false;
14936 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
14940 void __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint32_t this_ptr, jboolean val) {
14941 LDKReplyShortChannelIdsEnd this_ptr_conv;
14942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14943 this_ptr_conv.is_owned = false;
14944 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
14947 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
14948 LDKThirtyTwoBytes chain_hash_arg_ref;
14949 CHECK(*((uint32_t*)chain_hash_arg) == 32);
14950 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
14951 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
14952 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14953 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14954 long ret_ref = (long)ret_var.inner;
14955 if (ret_var.is_owned) {
14961 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_clone(uint32_t orig) {
14962 LDKReplyShortChannelIdsEnd orig_conv;
14963 orig_conv.inner = (void*)(orig & (~1));
14964 orig_conv.is_owned = false;
14965 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
14966 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14967 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14968 long ret_ref = (long)ret_var.inner;
14969 if (ret_var.is_owned) {
14975 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_free(uint32_t this_obj) {
14976 LDKGossipTimestampFilter this_obj_conv;
14977 this_obj_conv.inner = (void*)(this_obj & (~1));
14978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14979 GossipTimestampFilter_free(this_obj_conv);
14982 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_chain_hash(uint32_t this_ptr) {
14983 LDKGossipTimestampFilter this_ptr_conv;
14984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14985 this_ptr_conv.is_owned = false;
14986 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
14987 memcpy((uint8_t*)(ret_arr + 4), *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
14991 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
14992 LDKGossipTimestampFilter this_ptr_conv;
14993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14994 this_ptr_conv.is_owned = false;
14995 LDKThirtyTwoBytes val_ref;
14996 CHECK(*((uint32_t*)val) == 32);
14997 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
14998 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
15001 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_first_timestamp(uint32_t this_ptr) {
15002 LDKGossipTimestampFilter this_ptr_conv;
15003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15004 this_ptr_conv.is_owned = false;
15005 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
15009 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_first_timestamp(uint32_t this_ptr, int32_t val) {
15010 LDKGossipTimestampFilter this_ptr_conv;
15011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15012 this_ptr_conv.is_owned = false;
15013 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
15016 int32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_get_timestamp_range(uint32_t this_ptr) {
15017 LDKGossipTimestampFilter this_ptr_conv;
15018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15019 this_ptr_conv.is_owned = false;
15020 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
15024 void __attribute__((visibility("default"))) TS_GossipTimestampFilter_set_timestamp_range(uint32_t this_ptr, int32_t val) {
15025 LDKGossipTimestampFilter this_ptr_conv;
15026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15027 this_ptr_conv.is_owned = false;
15028 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
15031 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_new(int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
15032 LDKThirtyTwoBytes chain_hash_arg_ref;
15033 CHECK(*((uint32_t*)chain_hash_arg) == 32);
15034 memcpy(chain_hash_arg_ref.data, (uint8_t*)(chain_hash_arg + 4), 32);
15035 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
15036 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15037 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15038 long ret_ref = (long)ret_var.inner;
15039 if (ret_var.is_owned) {
15045 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_clone(uint32_t orig) {
15046 LDKGossipTimestampFilter orig_conv;
15047 orig_conv.inner = (void*)(orig & (~1));
15048 orig_conv.is_owned = false;
15049 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
15050 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15051 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15052 long ret_ref = (long)ret_var.inner;
15053 if (ret_var.is_owned) {
15059 void __attribute__((visibility("default"))) TS_ErrorAction_free(uint32_t this_ptr) {
15060 if ((this_ptr & 1) != 0) return;
15061 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
15062 FREE((void*)this_ptr);
15063 ErrorAction_free(this_ptr_conv);
15066 uint32_t __attribute__((visibility("default"))) TS_ErrorAction_clone(uint32_t orig) {
15067 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
15068 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15069 *ret_copy = ErrorAction_clone(orig_conv);
15070 long ret_ref = (long)ret_copy;
15074 void __attribute__((visibility("default"))) TS_LightningError_free(uint32_t this_obj) {
15075 LDKLightningError this_obj_conv;
15076 this_obj_conv.inner = (void*)(this_obj & (~1));
15077 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15078 LightningError_free(this_obj_conv);
15081 jstring __attribute__((visibility("default"))) TS_LightningError_get_err(uint32_t this_ptr) {
15082 LDKLightningError this_ptr_conv;
15083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15084 this_ptr_conv.is_owned = false;
15085 LDKStr _str = LightningError_get_err(&this_ptr_conv);
15086 jstring _conv = str_ref_to_ts(_str.chars, _str.len);
15090 void __attribute__((visibility("default"))) TS_LightningError_set_err(uint32_t this_ptr, int8_tArray val) {
15091 LDKLightningError this_ptr_conv;
15092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15093 this_ptr_conv.is_owned = false;
15094 LDKCVec_u8Z val_ref;
15095 val_ref.datalen = *((uint32_t*)val);
15096 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
15097 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
15098 LightningError_set_err(&this_ptr_conv, val_ref);
15101 uint32_t __attribute__((visibility("default"))) TS_LightningError_get_action(uint32_t this_ptr) {
15102 LDKLightningError this_ptr_conv;
15103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15104 this_ptr_conv.is_owned = false;
15105 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
15106 *ret_copy = LightningError_get_action(&this_ptr_conv);
15107 long ret_ref = (long)ret_copy;
15111 void __attribute__((visibility("default"))) TS_LightningError_set_action(uint32_t this_ptr, uint32_t val) {
15112 LDKLightningError this_ptr_conv;
15113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15114 this_ptr_conv.is_owned = false;
15115 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
15117 LightningError_set_action(&this_ptr_conv, val_conv);
15120 uint32_t __attribute__((visibility("default"))) TS_LightningError_new(int8_tArray err_arg, uint32_t action_arg) {
15121 LDKCVec_u8Z err_arg_ref;
15122 err_arg_ref.datalen = *((uint32_t*)err_arg);
15123 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
15124 memcpy(err_arg_ref.data, (uint8_t*)(err_arg + 4), err_arg_ref.datalen);
15125 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
15126 FREE((void*)action_arg);
15127 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
15128 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15129 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15130 long ret_ref = (long)ret_var.inner;
15131 if (ret_var.is_owned) {
15137 uint32_t __attribute__((visibility("default"))) TS_LightningError_clone(uint32_t orig) {
15138 LDKLightningError orig_conv;
15139 orig_conv.inner = (void*)(orig & (~1));
15140 orig_conv.is_owned = false;
15141 LDKLightningError ret_var = LightningError_clone(&orig_conv);
15142 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15143 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15144 long ret_ref = (long)ret_var.inner;
15145 if (ret_var.is_owned) {
15151 void __attribute__((visibility("default"))) TS_CommitmentUpdate_free(uint32_t this_obj) {
15152 LDKCommitmentUpdate this_obj_conv;
15153 this_obj_conv.inner = (void*)(this_obj & (~1));
15154 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15155 CommitmentUpdate_free(this_obj_conv);
15158 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
15159 LDKCommitmentUpdate this_ptr_conv;
15160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15161 this_ptr_conv.is_owned = false;
15162 LDKCVec_UpdateAddHTLCZ val_constr;
15163 val_constr.datalen = *((uint32_t*)val);
15164 if (val_constr.datalen > 0)
15165 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15167 val_constr.data = NULL;
15168 uint32_t* val_vals = (uint32_t*)(val + 4);
15169 for (size_t p = 0; p < val_constr.datalen; p++) {
15170 uint32_t val_conv_15 = val_vals[p];
15171 LDKUpdateAddHTLC val_conv_15_conv;
15172 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
15173 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
15174 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
15175 val_constr.data[p] = val_conv_15_conv;
15177 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
15180 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
15181 LDKCommitmentUpdate this_ptr_conv;
15182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15183 this_ptr_conv.is_owned = false;
15184 LDKCVec_UpdateFulfillHTLCZ val_constr;
15185 val_constr.datalen = *((uint32_t*)val);
15186 if (val_constr.datalen > 0)
15187 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15189 val_constr.data = NULL;
15190 uint32_t* val_vals = (uint32_t*)(val + 4);
15191 for (size_t t = 0; t < val_constr.datalen; t++) {
15192 uint32_t val_conv_19 = val_vals[t];
15193 LDKUpdateFulfillHTLC val_conv_19_conv;
15194 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
15195 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
15196 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
15197 val_constr.data[t] = val_conv_19_conv;
15199 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
15202 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
15203 LDKCommitmentUpdate this_ptr_conv;
15204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15205 this_ptr_conv.is_owned = false;
15206 LDKCVec_UpdateFailHTLCZ val_constr;
15207 val_constr.datalen = *((uint32_t*)val);
15208 if (val_constr.datalen > 0)
15209 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15211 val_constr.data = NULL;
15212 uint32_t* val_vals = (uint32_t*)(val + 4);
15213 for (size_t q = 0; q < val_constr.datalen; q++) {
15214 uint32_t val_conv_16 = val_vals[q];
15215 LDKUpdateFailHTLC val_conv_16_conv;
15216 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
15217 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
15218 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
15219 val_constr.data[q] = val_conv_16_conv;
15221 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
15224 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
15225 LDKCommitmentUpdate this_ptr_conv;
15226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15227 this_ptr_conv.is_owned = false;
15228 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
15229 val_constr.datalen = *((uint32_t*)val);
15230 if (val_constr.datalen > 0)
15231 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15233 val_constr.data = NULL;
15234 uint32_t* val_vals = (uint32_t*)(val + 4);
15235 for (size_t z = 0; z < val_constr.datalen; z++) {
15236 uint32_t val_conv_25 = val_vals[z];
15237 LDKUpdateFailMalformedHTLC val_conv_25_conv;
15238 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
15239 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
15240 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
15241 val_constr.data[z] = val_conv_25_conv;
15243 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
15246 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fee(uint32_t this_ptr) {
15247 LDKCommitmentUpdate this_ptr_conv;
15248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15249 this_ptr_conv.is_owned = false;
15250 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
15251 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15252 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15253 long ret_ref = (long)ret_var.inner;
15254 if (ret_var.is_owned) {
15260 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fee(uint32_t this_ptr, uint32_t val) {
15261 LDKCommitmentUpdate this_ptr_conv;
15262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15263 this_ptr_conv.is_owned = false;
15264 LDKUpdateFee val_conv;
15265 val_conv.inner = (void*)(val & (~1));
15266 val_conv.is_owned = (val & 1) || (val == 0);
15267 val_conv = UpdateFee_clone(&val_conv);
15268 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
15271 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_get_commitment_signed(uint32_t this_ptr) {
15272 LDKCommitmentUpdate this_ptr_conv;
15273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15274 this_ptr_conv.is_owned = false;
15275 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
15276 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15277 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15278 long ret_ref = (long)ret_var.inner;
15279 if (ret_var.is_owned) {
15285 void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_commitment_signed(uint32_t this_ptr, uint32_t val) {
15286 LDKCommitmentUpdate this_ptr_conv;
15287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15288 this_ptr_conv.is_owned = false;
15289 LDKCommitmentSigned val_conv;
15290 val_conv.inner = (void*)(val & (~1));
15291 val_conv.is_owned = (val & 1) || (val == 0);
15292 val_conv = CommitmentSigned_clone(&val_conv);
15293 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
15296 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) {
15297 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
15298 update_add_htlcs_arg_constr.datalen = *((uint32_t*)update_add_htlcs_arg);
15299 if (update_add_htlcs_arg_constr.datalen > 0)
15300 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
15302 update_add_htlcs_arg_constr.data = NULL;
15303 uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4);
15304 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
15305 uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
15306 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
15307 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
15308 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
15309 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
15310 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
15312 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
15313 update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg);
15314 if (update_fulfill_htlcs_arg_constr.datalen > 0)
15315 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
15317 update_fulfill_htlcs_arg_constr.data = NULL;
15318 uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4);
15319 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
15320 uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
15321 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
15322 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
15323 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
15324 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
15325 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
15327 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
15328 update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg);
15329 if (update_fail_htlcs_arg_constr.datalen > 0)
15330 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
15332 update_fail_htlcs_arg_constr.data = NULL;
15333 uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4);
15334 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
15335 uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
15336 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
15337 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
15338 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
15339 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
15340 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
15342 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
15343 update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg);
15344 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
15345 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
15347 update_fail_malformed_htlcs_arg_constr.data = NULL;
15348 uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4);
15349 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
15350 uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
15351 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
15352 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
15353 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);
15354 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
15355 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
15357 LDKUpdateFee update_fee_arg_conv;
15358 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
15359 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
15360 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
15361 LDKCommitmentSigned commitment_signed_arg_conv;
15362 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
15363 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
15364 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
15365 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);
15366 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15367 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15368 long ret_ref = (long)ret_var.inner;
15369 if (ret_var.is_owned) {
15375 uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_clone(uint32_t orig) {
15376 LDKCommitmentUpdate orig_conv;
15377 orig_conv.inner = (void*)(orig & (~1));
15378 orig_conv.is_owned = false;
15379 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
15380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15382 long ret_ref = (long)ret_var.inner;
15383 if (ret_var.is_owned) {
15389 void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
15390 if ((this_ptr & 1) != 0) return;
15391 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
15392 FREE((void*)this_ptr);
15393 HTLCFailChannelUpdate_free(this_ptr_conv);
15396 uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
15397 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
15398 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
15399 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
15400 long ret_ref = (long)ret_copy;
15404 void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
15405 if ((this_ptr & 1) != 0) return;
15406 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
15407 FREE((void*)this_ptr);
15408 ChannelMessageHandler_free(this_ptr_conv);
15411 void __attribute__((visibility("default"))) TS_RoutingMessageHandler_free(uint32_t this_ptr) {
15412 if ((this_ptr & 1) != 0) return;
15413 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
15414 FREE((void*)this_ptr);
15415 RoutingMessageHandler_free(this_ptr_conv);
15418 int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint32_t obj) {
15419 LDKAcceptChannel obj_conv;
15420 obj_conv.inner = (void*)(obj & (~1));
15421 obj_conv.is_owned = false;
15422 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
15423 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15424 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15425 CVec_u8Z_free(ret_var);
15429 uint32_t __attribute__((visibility("default"))) TS_AcceptChannel_read(int8_tArray ser) {
15430 LDKu8slice ser_ref;
15431 ser_ref.datalen = *((uint32_t*)ser);
15432 ser_ref.data = (int8_t*)(ser + 4);
15433 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
15434 *ret_conv = AcceptChannel_read(ser_ref);
15435 return (long)ret_conv;
15438 int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_write(uint32_t obj) {
15439 LDKAnnouncementSignatures obj_conv;
15440 obj_conv.inner = (void*)(obj & (~1));
15441 obj_conv.is_owned = false;
15442 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
15443 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15444 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15445 CVec_u8Z_free(ret_var);
15449 uint32_t __attribute__((visibility("default"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
15450 LDKu8slice ser_ref;
15451 ser_ref.datalen = *((uint32_t*)ser);
15452 ser_ref.data = (int8_t*)(ser + 4);
15453 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
15454 *ret_conv = AnnouncementSignatures_read(ser_ref);
15455 return (long)ret_conv;
15458 int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write(uint32_t obj) {
15459 LDKChannelReestablish obj_conv;
15460 obj_conv.inner = (void*)(obj & (~1));
15461 obj_conv.is_owned = false;
15462 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
15463 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15464 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15465 CVec_u8Z_free(ret_var);
15469 uint32_t __attribute__((visibility("default"))) TS_ChannelReestablish_read(int8_tArray ser) {
15470 LDKu8slice ser_ref;
15471 ser_ref.datalen = *((uint32_t*)ser);
15472 ser_ref.data = (int8_t*)(ser + 4);
15473 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
15474 *ret_conv = ChannelReestablish_read(ser_ref);
15475 return (long)ret_conv;
15478 int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint32_t obj) {
15479 LDKClosingSigned obj_conv;
15480 obj_conv.inner = (void*)(obj & (~1));
15481 obj_conv.is_owned = false;
15482 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
15483 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15484 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15485 CVec_u8Z_free(ret_var);
15489 uint32_t __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArray ser) {
15490 LDKu8slice ser_ref;
15491 ser_ref.datalen = *((uint32_t*)ser);
15492 ser_ref.data = (int8_t*)(ser + 4);
15493 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
15494 *ret_conv = ClosingSigned_read(ser_ref);
15495 return (long)ret_conv;
15498 int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
15499 LDKCommitmentSigned obj_conv;
15500 obj_conv.inner = (void*)(obj & (~1));
15501 obj_conv.is_owned = false;
15502 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
15503 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15504 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15505 CVec_u8Z_free(ret_var);
15509 uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_read(int8_tArray ser) {
15510 LDKu8slice ser_ref;
15511 ser_ref.datalen = *((uint32_t*)ser);
15512 ser_ref.data = (int8_t*)(ser + 4);
15513 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
15514 *ret_conv = CommitmentSigned_read(ser_ref);
15515 return (long)ret_conv;
15518 int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint32_t obj) {
15519 LDKFundingCreated obj_conv;
15520 obj_conv.inner = (void*)(obj & (~1));
15521 obj_conv.is_owned = false;
15522 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
15523 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15524 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15525 CVec_u8Z_free(ret_var);
15529 uint32_t __attribute__((visibility("default"))) TS_FundingCreated_read(int8_tArray ser) {
15530 LDKu8slice ser_ref;
15531 ser_ref.datalen = *((uint32_t*)ser);
15532 ser_ref.data = (int8_t*)(ser + 4);
15533 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
15534 *ret_conv = FundingCreated_read(ser_ref);
15535 return (long)ret_conv;
15538 int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint32_t obj) {
15539 LDKFundingSigned obj_conv;
15540 obj_conv.inner = (void*)(obj & (~1));
15541 obj_conv.is_owned = false;
15542 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
15543 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15544 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15545 CVec_u8Z_free(ret_var);
15549 uint32_t __attribute__((visibility("default"))) TS_FundingSigned_read(int8_tArray ser) {
15550 LDKu8slice ser_ref;
15551 ser_ref.datalen = *((uint32_t*)ser);
15552 ser_ref.data = (int8_t*)(ser + 4);
15553 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
15554 *ret_conv = FundingSigned_read(ser_ref);
15555 return (long)ret_conv;
15558 int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint32_t obj) {
15559 LDKFundingLocked obj_conv;
15560 obj_conv.inner = (void*)(obj & (~1));
15561 obj_conv.is_owned = false;
15562 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
15563 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15564 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15565 CVec_u8Z_free(ret_var);
15569 uint32_t __attribute__((visibility("default"))) TS_FundingLocked_read(int8_tArray ser) {
15570 LDKu8slice ser_ref;
15571 ser_ref.datalen = *((uint32_t*)ser);
15572 ser_ref.data = (int8_t*)(ser + 4);
15573 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
15574 *ret_conv = FundingLocked_read(ser_ref);
15575 return (long)ret_conv;
15578 int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) {
15580 obj_conv.inner = (void*)(obj & (~1));
15581 obj_conv.is_owned = false;
15582 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
15583 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15584 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15585 CVec_u8Z_free(ret_var);
15589 uint32_t __attribute__((visibility("default"))) TS_Init_read(int8_tArray ser) {
15590 LDKu8slice ser_ref;
15591 ser_ref.datalen = *((uint32_t*)ser);
15592 ser_ref.data = (int8_t*)(ser + 4);
15593 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
15594 *ret_conv = Init_read(ser_ref);
15595 return (long)ret_conv;
15598 int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_t obj) {
15599 LDKOpenChannel obj_conv;
15600 obj_conv.inner = (void*)(obj & (~1));
15601 obj_conv.is_owned = false;
15602 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
15603 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15604 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15605 CVec_u8Z_free(ret_var);
15609 uint32_t __attribute__((visibility("default"))) TS_OpenChannel_read(int8_tArray ser) {
15610 LDKu8slice ser_ref;
15611 ser_ref.datalen = *((uint32_t*)ser);
15612 ser_ref.data = (int8_t*)(ser + 4);
15613 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
15614 *ret_conv = OpenChannel_read(ser_ref);
15615 return (long)ret_conv;
15618 int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32_t obj) {
15619 LDKRevokeAndACK obj_conv;
15620 obj_conv.inner = (void*)(obj & (~1));
15621 obj_conv.is_owned = false;
15622 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
15623 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15624 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15625 CVec_u8Z_free(ret_var);
15629 uint32_t __attribute__((visibility("default"))) TS_RevokeAndACK_read(int8_tArray ser) {
15630 LDKu8slice ser_ref;
15631 ser_ref.datalen = *((uint32_t*)ser);
15632 ser_ref.data = (int8_t*)(ser + 4);
15633 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
15634 *ret_conv = RevokeAndACK_read(ser_ref);
15635 return (long)ret_conv;
15638 int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t obj) {
15639 LDKShutdown obj_conv;
15640 obj_conv.inner = (void*)(obj & (~1));
15641 obj_conv.is_owned = false;
15642 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
15643 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15644 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15645 CVec_u8Z_free(ret_var);
15649 uint32_t __attribute__((visibility("default"))) TS_Shutdown_read(int8_tArray ser) {
15650 LDKu8slice ser_ref;
15651 ser_ref.datalen = *((uint32_t*)ser);
15652 ser_ref.data = (int8_t*)(ser + 4);
15653 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
15654 *ret_conv = Shutdown_read(ser_ref);
15655 return (long)ret_conv;
15658 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint32_t obj) {
15659 LDKUpdateFailHTLC obj_conv;
15660 obj_conv.inner = (void*)(obj & (~1));
15661 obj_conv.is_owned = false;
15662 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
15663 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15664 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15665 CVec_u8Z_free(ret_var);
15669 uint32_t __attribute__((visibility("default"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
15670 LDKu8slice ser_ref;
15671 ser_ref.datalen = *((uint32_t*)ser);
15672 ser_ref.data = (int8_t*)(ser + 4);
15673 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
15674 *ret_conv = UpdateFailHTLC_read(ser_ref);
15675 return (long)ret_conv;
15678 int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_write(uint32_t obj) {
15679 LDKUpdateFailMalformedHTLC obj_conv;
15680 obj_conv.inner = (void*)(obj & (~1));
15681 obj_conv.is_owned = false;
15682 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
15683 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15684 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15685 CVec_u8Z_free(ret_var);
15689 uint32_t __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
15690 LDKu8slice ser_ref;
15691 ser_ref.datalen = *((uint32_t*)ser);
15692 ser_ref.data = (int8_t*)(ser + 4);
15693 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
15694 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
15695 return (long)ret_conv;
15698 int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t obj) {
15699 LDKUpdateFee obj_conv;
15700 obj_conv.inner = (void*)(obj & (~1));
15701 obj_conv.is_owned = false;
15702 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
15703 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15704 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15705 CVec_u8Z_free(ret_var);
15709 uint32_t __attribute__((visibility("default"))) TS_UpdateFee_read(int8_tArray ser) {
15710 LDKu8slice ser_ref;
15711 ser_ref.datalen = *((uint32_t*)ser);
15712 ser_ref.data = (int8_t*)(ser + 4);
15713 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
15714 *ret_conv = UpdateFee_read(ser_ref);
15715 return (long)ret_conv;
15718 int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(uint32_t obj) {
15719 LDKUpdateFulfillHTLC obj_conv;
15720 obj_conv.inner = (void*)(obj & (~1));
15721 obj_conv.is_owned = false;
15722 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
15723 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15724 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15725 CVec_u8Z_free(ret_var);
15729 uint32_t __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
15730 LDKu8slice ser_ref;
15731 ser_ref.datalen = *((uint32_t*)ser);
15732 ser_ref.data = (int8_t*)(ser + 4);
15733 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
15734 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
15735 return (long)ret_conv;
15738 int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint32_t obj) {
15739 LDKUpdateAddHTLC obj_conv;
15740 obj_conv.inner = (void*)(obj & (~1));
15741 obj_conv.is_owned = false;
15742 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
15743 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15744 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15745 CVec_u8Z_free(ret_var);
15749 uint32_t __attribute__((visibility("default"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
15750 LDKu8slice ser_ref;
15751 ser_ref.datalen = *((uint32_t*)ser);
15752 ser_ref.data = (int8_t*)(ser + 4);
15753 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
15754 *ret_conv = UpdateAddHTLC_read(ser_ref);
15755 return (long)ret_conv;
15758 int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) {
15760 obj_conv.inner = (void*)(obj & (~1));
15761 obj_conv.is_owned = false;
15762 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
15763 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15764 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15765 CVec_u8Z_free(ret_var);
15769 uint32_t __attribute__((visibility("default"))) TS_Ping_read(int8_tArray ser) {
15770 LDKu8slice ser_ref;
15771 ser_ref.datalen = *((uint32_t*)ser);
15772 ser_ref.data = (int8_t*)(ser + 4);
15773 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
15774 *ret_conv = Ping_read(ser_ref);
15775 return (long)ret_conv;
15778 int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) {
15780 obj_conv.inner = (void*)(obj & (~1));
15781 obj_conv.is_owned = false;
15782 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
15783 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15784 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15785 CVec_u8Z_free(ret_var);
15789 uint32_t __attribute__((visibility("default"))) TS_Pong_read(int8_tArray ser) {
15790 LDKu8slice ser_ref;
15791 ser_ref.datalen = *((uint32_t*)ser);
15792 ser_ref.data = (int8_t*)(ser + 4);
15793 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
15794 *ret_conv = Pong_read(ser_ref);
15795 return (long)ret_conv;
15798 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_write(uint32_t obj) {
15799 LDKUnsignedChannelAnnouncement obj_conv;
15800 obj_conv.inner = (void*)(obj & (~1));
15801 obj_conv.is_owned = false;
15802 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
15803 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15804 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15805 CVec_u8Z_free(ret_var);
15809 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
15810 LDKu8slice ser_ref;
15811 ser_ref.datalen = *((uint32_t*)ser);
15812 ser_ref.data = (int8_t*)(ser + 4);
15813 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
15814 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
15815 return (long)ret_conv;
15818 int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write(uint32_t obj) {
15819 LDKChannelAnnouncement obj_conv;
15820 obj_conv.inner = (void*)(obj & (~1));
15821 obj_conv.is_owned = false;
15822 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
15823 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15824 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15825 CVec_u8Z_free(ret_var);
15829 uint32_t __attribute__((visibility("default"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
15830 LDKu8slice ser_ref;
15831 ser_ref.datalen = *((uint32_t*)ser);
15832 ser_ref.data = (int8_t*)(ser + 4);
15833 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
15834 *ret_conv = ChannelAnnouncement_read(ser_ref);
15835 return (long)ret_conv;
15838 int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_write(uint32_t obj) {
15839 LDKUnsignedChannelUpdate obj_conv;
15840 obj_conv.inner = (void*)(obj & (~1));
15841 obj_conv.is_owned = false;
15842 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
15843 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15844 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15845 CVec_u8Z_free(ret_var);
15849 uint32_t __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
15850 LDKu8slice ser_ref;
15851 ser_ref.datalen = *((uint32_t*)ser);
15852 ser_ref.data = (int8_t*)(ser + 4);
15853 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
15854 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
15855 return (long)ret_conv;
15858 int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint32_t obj) {
15859 LDKChannelUpdate obj_conv;
15860 obj_conv.inner = (void*)(obj & (~1));
15861 obj_conv.is_owned = false;
15862 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
15863 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15864 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15865 CVec_u8Z_free(ret_var);
15869 uint32_t __attribute__((visibility("default"))) TS_ChannelUpdate_read(int8_tArray ser) {
15870 LDKu8slice ser_ref;
15871 ser_ref.datalen = *((uint32_t*)ser);
15872 ser_ref.data = (int8_t*)(ser + 4);
15873 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
15874 *ret_conv = ChannelUpdate_read(ser_ref);
15875 return (long)ret_conv;
15878 int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32_t obj) {
15879 LDKErrorMessage obj_conv;
15880 obj_conv.inner = (void*)(obj & (~1));
15881 obj_conv.is_owned = false;
15882 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
15883 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15884 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15885 CVec_u8Z_free(ret_var);
15889 uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_read(int8_tArray ser) {
15890 LDKu8slice ser_ref;
15891 ser_ref.datalen = *((uint32_t*)ser);
15892 ser_ref.data = (int8_t*)(ser + 4);
15893 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
15894 *ret_conv = ErrorMessage_read(ser_ref);
15895 return (long)ret_conv;
15898 int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_write(uint32_t obj) {
15899 LDKUnsignedNodeAnnouncement obj_conv;
15900 obj_conv.inner = (void*)(obj & (~1));
15901 obj_conv.is_owned = false;
15902 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
15903 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15904 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15905 CVec_u8Z_free(ret_var);
15909 uint32_t __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
15910 LDKu8slice ser_ref;
15911 ser_ref.datalen = *((uint32_t*)ser);
15912 ser_ref.data = (int8_t*)(ser + 4);
15913 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
15914 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
15915 return (long)ret_conv;
15918 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(uint32_t obj) {
15919 LDKNodeAnnouncement obj_conv;
15920 obj_conv.inner = (void*)(obj & (~1));
15921 obj_conv.is_owned = false;
15922 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
15923 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15924 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15925 CVec_u8Z_free(ret_var);
15929 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncement_read(int8_tArray ser) {
15930 LDKu8slice ser_ref;
15931 ser_ref.datalen = *((uint32_t*)ser);
15932 ser_ref.data = (int8_t*)(ser + 4);
15933 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
15934 *ret_conv = NodeAnnouncement_read(ser_ref);
15935 return (long)ret_conv;
15938 uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
15939 LDKu8slice ser_ref;
15940 ser_ref.datalen = *((uint32_t*)ser);
15941 ser_ref.data = (int8_t*)(ser + 4);
15942 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
15943 *ret_conv = QueryShortChannelIds_read(ser_ref);
15944 return (long)ret_conv;
15947 int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_write(uint32_t obj) {
15948 LDKQueryShortChannelIds obj_conv;
15949 obj_conv.inner = (void*)(obj & (~1));
15950 obj_conv.is_owned = false;
15951 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
15952 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15953 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15954 CVec_u8Z_free(ret_var);
15958 uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
15959 LDKu8slice ser_ref;
15960 ser_ref.datalen = *((uint32_t*)ser);
15961 ser_ref.data = (int8_t*)(ser + 4);
15962 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
15963 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
15964 return (long)ret_conv;
15967 int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
15968 LDKReplyShortChannelIdsEnd obj_conv;
15969 obj_conv.inner = (void*)(obj & (~1));
15970 obj_conv.is_owned = false;
15971 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
15972 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
15973 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
15974 CVec_u8Z_free(ret_var);
15978 int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
15979 LDKQueryChannelRange this_arg_conv;
15980 this_arg_conv.inner = (void*)(this_arg & (~1));
15981 this_arg_conv.is_owned = false;
15982 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
15986 uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
15987 LDKu8slice ser_ref;
15988 ser_ref.datalen = *((uint32_t*)ser);
15989 ser_ref.data = (int8_t*)(ser + 4);
15990 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
15991 *ret_conv = QueryChannelRange_read(ser_ref);
15992 return (long)ret_conv;
15995 int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
15996 LDKQueryChannelRange obj_conv;
15997 obj_conv.inner = (void*)(obj & (~1));
15998 obj_conv.is_owned = false;
15999 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
16000 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16001 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16002 CVec_u8Z_free(ret_var);
16006 uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
16007 LDKu8slice ser_ref;
16008 ser_ref.datalen = *((uint32_t*)ser);
16009 ser_ref.data = (int8_t*)(ser + 4);
16010 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
16011 *ret_conv = ReplyChannelRange_read(ser_ref);
16012 return (long)ret_conv;
16015 int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(uint32_t obj) {
16016 LDKReplyChannelRange obj_conv;
16017 obj_conv.inner = (void*)(obj & (~1));
16018 obj_conv.is_owned = false;
16019 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
16020 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16021 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16022 CVec_u8Z_free(ret_var);
16026 uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
16027 LDKu8slice ser_ref;
16028 ser_ref.datalen = *((uint32_t*)ser);
16029 ser_ref.data = (int8_t*)(ser + 4);
16030 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
16031 *ret_conv = GossipTimestampFilter_read(ser_ref);
16032 return (long)ret_conv;
16035 int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
16036 LDKGossipTimestampFilter obj_conv;
16037 obj_conv.inner = (void*)(obj & (~1));
16038 obj_conv.is_owned = false;
16039 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
16040 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16041 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16042 CVec_u8Z_free(ret_var);
16046 void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
16047 LDKIgnoringMessageHandler this_obj_conv;
16048 this_obj_conv.inner = (void*)(this_obj & (~1));
16049 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16050 IgnoringMessageHandler_free(this_obj_conv);
16053 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_new() {
16054 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
16055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16057 long ret_ref = (long)ret_var.inner;
16058 if (ret_var.is_owned) {
16064 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
16065 LDKIgnoringMessageHandler this_arg_conv;
16066 this_arg_conv.inner = (void*)(this_arg & (~1));
16067 this_arg_conv.is_owned = false;
16068 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16069 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16073 uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
16074 LDKIgnoringMessageHandler this_arg_conv;
16075 this_arg_conv.inner = (void*)(this_arg & (~1));
16076 this_arg_conv.is_owned = false;
16077 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16078 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
16082 void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
16083 LDKErroringMessageHandler this_obj_conv;
16084 this_obj_conv.inner = (void*)(this_obj & (~1));
16085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16086 ErroringMessageHandler_free(this_obj_conv);
16089 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_new() {
16090 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
16091 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16092 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16093 long ret_ref = (long)ret_var.inner;
16094 if (ret_var.is_owned) {
16100 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
16101 LDKErroringMessageHandler this_arg_conv;
16102 this_arg_conv.inner = (void*)(this_arg & (~1));
16103 this_arg_conv.is_owned = false;
16104 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16105 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
16109 uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
16110 LDKErroringMessageHandler this_arg_conv;
16111 this_arg_conv.inner = (void*)(this_arg & (~1));
16112 this_arg_conv.is_owned = false;
16113 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16114 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
16118 void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
16119 LDKMessageHandler this_obj_conv;
16120 this_obj_conv.inner = (void*)(this_obj & (~1));
16121 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16122 MessageHandler_free(this_obj_conv);
16125 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_chan_handler(uint32_t this_ptr) {
16126 LDKMessageHandler this_ptr_conv;
16127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16128 this_ptr_conv.is_owned = false;
16129 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
16133 void __attribute__((visibility("default"))) TS_MessageHandler_set_chan_handler(uint32_t this_ptr, uint32_t val) {
16134 LDKMessageHandler this_ptr_conv;
16135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16136 this_ptr_conv.is_owned = false;
16137 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
16138 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
16141 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_get_route_handler(uint32_t this_ptr) {
16142 LDKMessageHandler this_ptr_conv;
16143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16144 this_ptr_conv.is_owned = false;
16145 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
16149 void __attribute__((visibility("default"))) TS_MessageHandler_set_route_handler(uint32_t this_ptr, uint32_t val) {
16150 LDKMessageHandler this_ptr_conv;
16151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16152 this_ptr_conv.is_owned = false;
16153 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
16154 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
16157 uint32_t __attribute__((visibility("default"))) TS_MessageHandler_new(uint32_t chan_handler_arg, uint32_t route_handler_arg) {
16158 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
16159 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
16160 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
16161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16163 long ret_ref = (long)ret_var.inner;
16164 if (ret_var.is_owned) {
16170 uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
16171 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
16172 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
16173 *ret = SocketDescriptor_clone(orig_conv);
16177 void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
16178 if ((this_ptr & 1) != 0) return;
16179 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
16180 FREE((void*)this_ptr);
16181 SocketDescriptor_free(this_ptr_conv);
16184 void __attribute__((visibility("default"))) TS_PeerHandleError_free(uint32_t this_obj) {
16185 LDKPeerHandleError this_obj_conv;
16186 this_obj_conv.inner = (void*)(this_obj & (~1));
16187 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16188 PeerHandleError_free(this_obj_conv);
16191 jboolean __attribute__((visibility("default"))) TS_PeerHandleError_get_no_connection_possible(uint32_t this_ptr) {
16192 LDKPeerHandleError this_ptr_conv;
16193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16194 this_ptr_conv.is_owned = false;
16195 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
16199 void __attribute__((visibility("default"))) TS_PeerHandleError_set_no_connection_possible(uint32_t this_ptr, jboolean val) {
16200 LDKPeerHandleError this_ptr_conv;
16201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16202 this_ptr_conv.is_owned = false;
16203 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
16206 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
16207 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
16208 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16209 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16210 long ret_ref = (long)ret_var.inner;
16211 if (ret_var.is_owned) {
16217 uint32_t __attribute__((visibility("default"))) TS_PeerHandleError_clone(uint32_t orig) {
16218 LDKPeerHandleError orig_conv;
16219 orig_conv.inner = (void*)(orig & (~1));
16220 orig_conv.is_owned = false;
16221 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
16222 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16223 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16224 long ret_ref = (long)ret_var.inner;
16225 if (ret_var.is_owned) {
16231 void __attribute__((visibility("default"))) TS_PeerManager_free(uint32_t this_obj) {
16232 LDKPeerManager this_obj_conv;
16233 this_obj_conv.inner = (void*)(this_obj & (~1));
16234 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16235 PeerManager_free(this_obj_conv);
16238 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) {
16239 LDKMessageHandler message_handler_conv;
16240 message_handler_conv.inner = (void*)(message_handler & (~1));
16241 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
16242 // Warning: we need a move here but no clone is available for LDKMessageHandler
16243 LDKSecretKey our_node_secret_ref;
16244 CHECK(*((uint32_t*)our_node_secret) == 32);
16245 memcpy(our_node_secret_ref.bytes, (uint8_t*)(our_node_secret + 4), 32);
16246 unsigned char ephemeral_random_data_arr[32];
16247 CHECK(*((uint32_t*)ephemeral_random_data) == 32);
16248 memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
16249 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
16250 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16251 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
16252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16254 long ret_ref = (long)ret_var.inner;
16255 if (ret_var.is_owned) {
16261 ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_ids(uint32_t this_arg) {
16262 LDKPeerManager this_arg_conv;
16263 this_arg_conv.inner = (void*)(this_arg & (~1));
16264 this_arg_conv.is_owned = false;
16265 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
16266 ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
16267 int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4);
16268 for (size_t m = 0; m < ret_var.datalen; m++) {
16269 int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16270 memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33);
16271 ret_arr_ptr[m] = ret_conv_12_arr;
16273 FREE(ret_var.data);
16277 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_outbound_connection(uint32_t this_arg, int8_tArray their_node_id, uint32_t descriptor) {
16278 LDKPeerManager this_arg_conv;
16279 this_arg_conv.inner = (void*)(this_arg & (~1));
16280 this_arg_conv.is_owned = false;
16281 LDKPublicKey their_node_id_ref;
16282 CHECK(*((uint32_t*)their_node_id) == 33);
16283 memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33);
16284 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16285 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
16286 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
16287 return (long)ret_conv;
16290 uint32_t __attribute__((visibility("default"))) TS_PeerManager_new_inbound_connection(uint32_t this_arg, uint32_t descriptor) {
16291 LDKPeerManager this_arg_conv;
16292 this_arg_conv.inner = (void*)(this_arg & (~1));
16293 this_arg_conv.is_owned = false;
16294 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16295 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16296 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
16297 return (long)ret_conv;
16300 uint32_t __attribute__((visibility("default"))) TS_PeerManager_write_buffer_space_avail(uint32_t this_arg, uint32_t descriptor) {
16301 LDKPeerManager this_arg_conv;
16302 this_arg_conv.inner = (void*)(this_arg & (~1));
16303 this_arg_conv.is_owned = false;
16304 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16305 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
16306 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
16307 return (long)ret_conv;
16310 uint32_t __attribute__((visibility("default"))) TS_PeerManager_read_event(uint32_t this_arg, uint32_t peer_descriptor, int8_tArray data) {
16311 LDKPeerManager this_arg_conv;
16312 this_arg_conv.inner = (void*)(this_arg & (~1));
16313 this_arg_conv.is_owned = false;
16314 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
16315 LDKu8slice data_ref;
16316 data_ref.datalen = *((uint32_t*)data);
16317 data_ref.data = (int8_t*)(data + 4);
16318 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
16319 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
16320 return (long)ret_conv;
16323 void __attribute__((visibility("default"))) TS_PeerManager_process_events(uint32_t this_arg) {
16324 LDKPeerManager this_arg_conv;
16325 this_arg_conv.inner = (void*)(this_arg & (~1));
16326 this_arg_conv.is_owned = false;
16327 PeerManager_process_events(&this_arg_conv);
16330 void __attribute__((visibility("default"))) TS_PeerManager_socket_disconnected(uint32_t this_arg, uint32_t descriptor) {
16331 LDKPeerManager this_arg_conv;
16332 this_arg_conv.inner = (void*)(this_arg & (~1));
16333 this_arg_conv.is_owned = false;
16334 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
16335 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
16338 void __attribute__((visibility("default"))) TS_PeerManager_disconnect_by_node_id(uint32_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
16339 LDKPeerManager this_arg_conv;
16340 this_arg_conv.inner = (void*)(this_arg & (~1));
16341 this_arg_conv.is_owned = false;
16342 LDKPublicKey node_id_ref;
16343 CHECK(*((uint32_t*)node_id) == 33);
16344 memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
16345 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
16348 void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred(uint32_t this_arg) {
16349 LDKPeerManager this_arg_conv;
16350 this_arg_conv.inner = (void*)(this_arg & (~1));
16351 this_arg_conv.is_owned = false;
16352 PeerManager_timer_tick_occurred(&this_arg_conv);
16355 int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
16356 unsigned char commitment_seed_arr[32];
16357 CHECK(*((uint32_t*)commitment_seed) == 32);
16358 memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32);
16359 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
16360 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16361 memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32);
16365 uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
16366 LDKPublicKey per_commitment_point_ref;
16367 CHECK(*((uint32_t*)per_commitment_point) == 33);
16368 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16369 unsigned char base_secret_arr[32];
16370 CHECK(*((uint32_t*)base_secret) == 32);
16371 memcpy(base_secret_arr, (uint8_t*)(base_secret + 4), 32);
16372 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
16373 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16374 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
16375 return (long)ret_conv;
16378 uint32_t __attribute__((visibility("default"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
16379 LDKPublicKey per_commitment_point_ref;
16380 CHECK(*((uint32_t*)per_commitment_point) == 33);
16381 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16382 LDKPublicKey base_point_ref;
16383 CHECK(*((uint32_t*)base_point) == 33);
16384 memcpy(base_point_ref.compressed_form, (uint8_t*)(base_point + 4), 33);
16385 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16386 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
16387 return (long)ret_conv;
16390 uint32_t __attribute__((visibility("default"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
16391 unsigned char per_commitment_secret_arr[32];
16392 CHECK(*((uint32_t*)per_commitment_secret) == 32);
16393 memcpy(per_commitment_secret_arr, (uint8_t*)(per_commitment_secret + 4), 32);
16394 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
16395 unsigned char countersignatory_revocation_base_secret_arr[32];
16396 CHECK(*((uint32_t*)countersignatory_revocation_base_secret) == 32);
16397 memcpy(countersignatory_revocation_base_secret_arr, (uint8_t*)(countersignatory_revocation_base_secret + 4), 32);
16398 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
16399 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
16400 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
16401 return (long)ret_conv;
16404 uint32_t __attribute__((visibility("default"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
16405 LDKPublicKey per_commitment_point_ref;
16406 CHECK(*((uint32_t*)per_commitment_point) == 33);
16407 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16408 LDKPublicKey countersignatory_revocation_base_point_ref;
16409 CHECK(*((uint32_t*)countersignatory_revocation_base_point) == 33);
16410 memcpy(countersignatory_revocation_base_point_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base_point + 4), 33);
16411 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
16412 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
16413 return (long)ret_conv;
16416 void __attribute__((visibility("default"))) TS_TxCreationKeys_free(uint32_t this_obj) {
16417 LDKTxCreationKeys this_obj_conv;
16418 this_obj_conv.inner = (void*)(this_obj & (~1));
16419 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16420 TxCreationKeys_free(this_obj_conv);
16423 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_commitment_point(uint32_t this_ptr) {
16424 LDKTxCreationKeys this_ptr_conv;
16425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16426 this_ptr_conv.is_owned = false;
16427 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16428 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
16432 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) {
16433 LDKTxCreationKeys this_ptr_conv;
16434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16435 this_ptr_conv.is_owned = false;
16436 LDKPublicKey val_ref;
16437 CHECK(*((uint32_t*)val) == 33);
16438 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16439 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
16442 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revocation_key(uint32_t this_ptr) {
16443 LDKTxCreationKeys this_ptr_conv;
16444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16445 this_ptr_conv.is_owned = false;
16446 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16447 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
16451 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) {
16452 LDKTxCreationKeys this_ptr_conv;
16453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16454 this_ptr_conv.is_owned = false;
16455 LDKPublicKey val_ref;
16456 CHECK(*((uint32_t*)val) == 33);
16457 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16458 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
16461 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint32_t this_ptr) {
16462 LDKTxCreationKeys this_ptr_conv;
16463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16464 this_ptr_conv.is_owned = false;
16465 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16466 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
16470 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) {
16471 LDKTxCreationKeys this_ptr_conv;
16472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16473 this_ptr_conv.is_owned = false;
16474 LDKPublicKey val_ref;
16475 CHECK(*((uint32_t*)val) == 33);
16476 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16477 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
16480 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint32_t this_ptr) {
16481 LDKTxCreationKeys this_ptr_conv;
16482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16483 this_ptr_conv.is_owned = false;
16484 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16485 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
16489 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) {
16490 LDKTxCreationKeys this_ptr_conv;
16491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16492 this_ptr_conv.is_owned = false;
16493 LDKPublicKey val_ref;
16494 CHECK(*((uint32_t*)val) == 33);
16495 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16496 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
16499 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint32_t this_ptr) {
16500 LDKTxCreationKeys this_ptr_conv;
16501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16502 this_ptr_conv.is_owned = false;
16503 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16504 memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
16508 void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) {
16509 LDKTxCreationKeys this_ptr_conv;
16510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16511 this_ptr_conv.is_owned = false;
16512 LDKPublicKey val_ref;
16513 CHECK(*((uint32_t*)val) == 33);
16514 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16515 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
16518 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) {
16519 LDKPublicKey per_commitment_point_arg_ref;
16520 CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
16521 memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
16522 LDKPublicKey revocation_key_arg_ref;
16523 CHECK(*((uint32_t*)revocation_key_arg) == 33);
16524 memcpy(revocation_key_arg_ref.compressed_form, (uint8_t*)(revocation_key_arg + 4), 33);
16525 LDKPublicKey broadcaster_htlc_key_arg_ref;
16526 CHECK(*((uint32_t*)broadcaster_htlc_key_arg) == 33);
16527 memcpy(broadcaster_htlc_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_htlc_key_arg + 4), 33);
16528 LDKPublicKey countersignatory_htlc_key_arg_ref;
16529 CHECK(*((uint32_t*)countersignatory_htlc_key_arg) == 33);
16530 memcpy(countersignatory_htlc_key_arg_ref.compressed_form, (uint8_t*)(countersignatory_htlc_key_arg + 4), 33);
16531 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
16532 CHECK(*((uint32_t*)broadcaster_delayed_payment_key_arg) == 33);
16533 memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key_arg + 4), 33);
16534 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);
16535 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16536 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16537 long ret_ref = (long)ret_var.inner;
16538 if (ret_var.is_owned) {
16544 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_clone(uint32_t orig) {
16545 LDKTxCreationKeys orig_conv;
16546 orig_conv.inner = (void*)(orig & (~1));
16547 orig_conv.is_owned = false;
16548 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
16549 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16550 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16551 long ret_ref = (long)ret_var.inner;
16552 if (ret_var.is_owned) {
16558 int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint32_t obj) {
16559 LDKTxCreationKeys obj_conv;
16560 obj_conv.inner = (void*)(obj & (~1));
16561 obj_conv.is_owned = false;
16562 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
16563 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16564 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16565 CVec_u8Z_free(ret_var);
16569 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_read(int8_tArray ser) {
16570 LDKu8slice ser_ref;
16571 ser_ref.datalen = *((uint32_t*)ser);
16572 ser_ref.data = (int8_t*)(ser + 4);
16573 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
16574 *ret_conv = TxCreationKeys_read(ser_ref);
16575 return (long)ret_conv;
16578 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_free(uint32_t this_obj) {
16579 LDKChannelPublicKeys this_obj_conv;
16580 this_obj_conv.inner = (void*)(this_obj & (~1));
16581 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16582 ChannelPublicKeys_free(this_obj_conv);
16585 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_funding_pubkey(uint32_t this_ptr) {
16586 LDKChannelPublicKeys this_ptr_conv;
16587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16588 this_ptr_conv.is_owned = false;
16589 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16590 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
16594 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
16595 LDKChannelPublicKeys this_ptr_conv;
16596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16597 this_ptr_conv.is_owned = false;
16598 LDKPublicKey val_ref;
16599 CHECK(*((uint32_t*)val) == 33);
16600 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16601 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
16604 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint32_t this_ptr) {
16605 LDKChannelPublicKeys this_ptr_conv;
16606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16607 this_ptr_conv.is_owned = false;
16608 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16609 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
16613 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
16614 LDKChannelPublicKeys this_ptr_conv;
16615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16616 this_ptr_conv.is_owned = false;
16617 LDKPublicKey val_ref;
16618 CHECK(*((uint32_t*)val) == 33);
16619 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16620 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
16623 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_payment_point(uint32_t this_ptr) {
16624 LDKChannelPublicKeys this_ptr_conv;
16625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16626 this_ptr_conv.is_owned = false;
16627 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16628 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
16632 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) {
16633 LDKChannelPublicKeys this_ptr_conv;
16634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16635 this_ptr_conv.is_owned = false;
16636 LDKPublicKey val_ref;
16637 CHECK(*((uint32_t*)val) == 33);
16638 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16639 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
16642 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint32_t this_ptr) {
16643 LDKChannelPublicKeys this_ptr_conv;
16644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16645 this_ptr_conv.is_owned = false;
16646 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16647 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
16651 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) {
16652 LDKChannelPublicKeys this_ptr_conv;
16653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16654 this_ptr_conv.is_owned = false;
16655 LDKPublicKey val_ref;
16656 CHECK(*((uint32_t*)val) == 33);
16657 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16658 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16661 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint32_t this_ptr) {
16662 LDKChannelPublicKeys this_ptr_conv;
16663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16664 this_ptr_conv.is_owned = false;
16665 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
16666 memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
16670 void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) {
16671 LDKChannelPublicKeys this_ptr_conv;
16672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16673 this_ptr_conv.is_owned = false;
16674 LDKPublicKey val_ref;
16675 CHECK(*((uint32_t*)val) == 33);
16676 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
16677 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
16680 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) {
16681 LDKPublicKey funding_pubkey_arg_ref;
16682 CHECK(*((uint32_t*)funding_pubkey_arg) == 33);
16683 memcpy(funding_pubkey_arg_ref.compressed_form, (uint8_t*)(funding_pubkey_arg + 4), 33);
16684 LDKPublicKey revocation_basepoint_arg_ref;
16685 CHECK(*((uint32_t*)revocation_basepoint_arg) == 33);
16686 memcpy(revocation_basepoint_arg_ref.compressed_form, (uint8_t*)(revocation_basepoint_arg + 4), 33);
16687 LDKPublicKey payment_point_arg_ref;
16688 CHECK(*((uint32_t*)payment_point_arg) == 33);
16689 memcpy(payment_point_arg_ref.compressed_form, (uint8_t*)(payment_point_arg + 4), 33);
16690 LDKPublicKey delayed_payment_basepoint_arg_ref;
16691 CHECK(*((uint32_t*)delayed_payment_basepoint_arg) == 33);
16692 memcpy(delayed_payment_basepoint_arg_ref.compressed_form, (uint8_t*)(delayed_payment_basepoint_arg + 4), 33);
16693 LDKPublicKey htlc_basepoint_arg_ref;
16694 CHECK(*((uint32_t*)htlc_basepoint_arg) == 33);
16695 memcpy(htlc_basepoint_arg_ref.compressed_form, (uint8_t*)(htlc_basepoint_arg + 4), 33);
16696 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);
16697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16699 long ret_ref = (long)ret_var.inner;
16700 if (ret_var.is_owned) {
16706 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_clone(uint32_t orig) {
16707 LDKChannelPublicKeys orig_conv;
16708 orig_conv.inner = (void*)(orig & (~1));
16709 orig_conv.is_owned = false;
16710 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
16711 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16712 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16713 long ret_ref = (long)ret_var.inner;
16714 if (ret_var.is_owned) {
16720 int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(uint32_t obj) {
16721 LDKChannelPublicKeys obj_conv;
16722 obj_conv.inner = (void*)(obj & (~1));
16723 obj_conv.is_owned = false;
16724 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
16725 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16726 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16727 CVec_u8Z_free(ret_var);
16731 uint32_t __attribute__((visibility("default"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
16732 LDKu8slice ser_ref;
16733 ser_ref.datalen = *((uint32_t*)ser);
16734 ser_ref.data = (int8_t*)(ser + 4);
16735 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
16736 *ret_conv = ChannelPublicKeys_read(ser_ref);
16737 return (long)ret_conv;
16740 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) {
16741 LDKPublicKey per_commitment_point_ref;
16742 CHECK(*((uint32_t*)per_commitment_point) == 33);
16743 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16744 LDKPublicKey broadcaster_delayed_payment_base_ref;
16745 CHECK(*((uint32_t*)broadcaster_delayed_payment_base) == 33);
16746 memcpy(broadcaster_delayed_payment_base_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_base + 4), 33);
16747 LDKPublicKey broadcaster_htlc_base_ref;
16748 CHECK(*((uint32_t*)broadcaster_htlc_base) == 33);
16749 memcpy(broadcaster_htlc_base_ref.compressed_form, (uint8_t*)(broadcaster_htlc_base + 4), 33);
16750 LDKPublicKey countersignatory_revocation_base_ref;
16751 CHECK(*((uint32_t*)countersignatory_revocation_base) == 33);
16752 memcpy(countersignatory_revocation_base_ref.compressed_form, (uint8_t*)(countersignatory_revocation_base + 4), 33);
16753 LDKPublicKey countersignatory_htlc_base_ref;
16754 CHECK(*((uint32_t*)countersignatory_htlc_base) == 33);
16755 memcpy(countersignatory_htlc_base_ref.compressed_form, (uint8_t*)(countersignatory_htlc_base + 4), 33);
16756 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16757 *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);
16758 return (long)ret_conv;
16761 uint32_t __attribute__((visibility("default"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
16762 LDKPublicKey per_commitment_point_ref;
16763 CHECK(*((uint32_t*)per_commitment_point) == 33);
16764 memcpy(per_commitment_point_ref.compressed_form, (uint8_t*)(per_commitment_point + 4), 33);
16765 LDKChannelPublicKeys broadcaster_keys_conv;
16766 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
16767 broadcaster_keys_conv.is_owned = false;
16768 LDKChannelPublicKeys countersignatory_keys_conv;
16769 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
16770 countersignatory_keys_conv.is_owned = false;
16771 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
16772 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
16773 return (long)ret_conv;
16776 int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
16777 LDKPublicKey revocation_key_ref;
16778 CHECK(*((uint32_t*)revocation_key) == 33);
16779 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16780 LDKPublicKey broadcaster_delayed_payment_key_ref;
16781 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16782 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16783 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
16784 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16785 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16786 CVec_u8Z_free(ret_var);
16790 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_obj) {
16791 LDKHTLCOutputInCommitment this_obj_conv;
16792 this_obj_conv.inner = (void*)(this_obj & (~1));
16793 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16794 HTLCOutputInCommitment_free(this_obj_conv);
16797 jboolean __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_offered(uint32_t this_ptr) {
16798 LDKHTLCOutputInCommitment this_ptr_conv;
16799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16800 this_ptr_conv.is_owned = false;
16801 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
16805 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_offered(uint32_t this_ptr, jboolean val) {
16806 LDKHTLCOutputInCommitment this_ptr_conv;
16807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16808 this_ptr_conv.is_owned = false;
16809 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
16812 int64_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_amount_msat(uint32_t this_ptr) {
16813 LDKHTLCOutputInCommitment this_ptr_conv;
16814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16815 this_ptr_conv.is_owned = false;
16816 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
16820 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_amount_msat(uint32_t this_ptr, int64_t val) {
16821 LDKHTLCOutputInCommitment this_ptr_conv;
16822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16823 this_ptr_conv.is_owned = false;
16824 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
16827 int32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint32_t this_ptr) {
16828 LDKHTLCOutputInCommitment this_ptr_conv;
16829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16830 this_ptr_conv.is_owned = false;
16831 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
16835 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint32_t this_ptr, int32_t val) {
16836 LDKHTLCOutputInCommitment this_ptr_conv;
16837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16838 this_ptr_conv.is_owned = false;
16839 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
16842 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_payment_hash(uint32_t this_ptr) {
16843 LDKHTLCOutputInCommitment this_ptr_conv;
16844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16845 this_ptr_conv.is_owned = false;
16846 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
16847 memcpy((uint8_t*)(ret_arr + 4), *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
16851 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_payment_hash(uint32_t this_ptr, int8_tArray val) {
16852 LDKHTLCOutputInCommitment this_ptr_conv;
16853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16854 this_ptr_conv.is_owned = false;
16855 LDKThirtyTwoBytes val_ref;
16856 CHECK(*((uint32_t*)val) == 32);
16857 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
16858 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
16861 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint32_t this_ptr) {
16862 LDKHTLCOutputInCommitment this_ptr_conv;
16863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16864 this_ptr_conv.is_owned = false;
16865 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16866 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
16867 long ret_ref = (long)ret_copy;
16871 void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint32_t this_ptr, uint32_t val) {
16872 LDKHTLCOutputInCommitment this_ptr_conv;
16873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16874 this_ptr_conv.is_owned = false;
16875 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
16877 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
16880 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_new(jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, uint32_t transaction_output_index_arg) {
16881 LDKThirtyTwoBytes payment_hash_arg_ref;
16882 CHECK(*((uint32_t*)payment_hash_arg) == 32);
16883 memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
16884 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
16885 FREE((void*)transaction_output_index_arg);
16886 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
16887 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16888 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16889 long ret_ref = (long)ret_var.inner;
16890 if (ret_var.is_owned) {
16896 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_clone(uint32_t orig) {
16897 LDKHTLCOutputInCommitment orig_conv;
16898 orig_conv.inner = (void*)(orig & (~1));
16899 orig_conv.is_owned = false;
16900 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
16901 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16902 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16903 long ret_ref = (long)ret_var.inner;
16904 if (ret_var.is_owned) {
16910 int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_write(uint32_t obj) {
16911 LDKHTLCOutputInCommitment obj_conv;
16912 obj_conv.inner = (void*)(obj & (~1));
16913 obj_conv.is_owned = false;
16914 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
16915 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16916 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16917 CVec_u8Z_free(ret_var);
16921 uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
16922 LDKu8slice ser_ref;
16923 ser_ref.datalen = *((uint32_t*)ser);
16924 ser_ref.data = (int8_t*)(ser + 4);
16925 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
16926 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
16927 return (long)ret_conv;
16930 int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) {
16931 LDKHTLCOutputInCommitment htlc_conv;
16932 htlc_conv.inner = (void*)(htlc & (~1));
16933 htlc_conv.is_owned = false;
16934 LDKTxCreationKeys keys_conv;
16935 keys_conv.inner = (void*)(keys & (~1));
16936 keys_conv.is_owned = false;
16937 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
16938 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16939 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16940 CVec_u8Z_free(ret_var);
16944 int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
16945 LDKPublicKey broadcaster_ref;
16946 CHECK(*((uint32_t*)broadcaster) == 33);
16947 memcpy(broadcaster_ref.compressed_form, (uint8_t*)(broadcaster + 4), 33);
16948 LDKPublicKey countersignatory_ref;
16949 CHECK(*((uint32_t*)countersignatory) == 33);
16950 memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33);
16951 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
16952 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16953 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16954 CVec_u8Z_free(ret_var);
16958 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) {
16959 unsigned char prev_hash_arr[32];
16960 CHECK(*((uint32_t*)prev_hash) == 32);
16961 memcpy(prev_hash_arr, (uint8_t*)(prev_hash + 4), 32);
16962 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
16963 LDKHTLCOutputInCommitment htlc_conv;
16964 htlc_conv.inner = (void*)(htlc & (~1));
16965 htlc_conv.is_owned = false;
16966 LDKPublicKey broadcaster_delayed_payment_key_ref;
16967 CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33);
16968 memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33);
16969 LDKPublicKey revocation_key_ref;
16970 CHECK(*((uint32_t*)revocation_key) == 33);
16971 memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33);
16972 LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
16973 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
16974 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
16975 Transaction_free(ret_var);
16979 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) {
16980 LDKChannelTransactionParameters this_obj_conv;
16981 this_obj_conv.inner = (void*)(this_obj & (~1));
16982 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16983 ChannelTransactionParameters_free(this_obj_conv);
16986 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint32_t this_ptr) {
16987 LDKChannelTransactionParameters this_ptr_conv;
16988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16989 this_ptr_conv.is_owned = false;
16990 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
16991 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16992 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16993 long ret_ref = (long)ret_var.inner;
16994 if (ret_var.is_owned) {
17000 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint32_t this_ptr, uint32_t val) {
17001 LDKChannelTransactionParameters this_ptr_conv;
17002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17003 this_ptr_conv.is_owned = false;
17004 LDKChannelPublicKeys val_conv;
17005 val_conv.inner = (void*)(val & (~1));
17006 val_conv.is_owned = (val & 1) || (val == 0);
17007 val_conv = ChannelPublicKeys_clone(&val_conv);
17008 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
17011 int16_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint32_t this_ptr) {
17012 LDKChannelTransactionParameters this_ptr_conv;
17013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17014 this_ptr_conv.is_owned = false;
17015 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
17019 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_holder_selected_contest_delay(uint32_t this_ptr, int16_t val) {
17020 LDKChannelTransactionParameters this_ptr_conv;
17021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17022 this_ptr_conv.is_owned = false;
17023 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
17026 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint32_t this_ptr) {
17027 LDKChannelTransactionParameters this_ptr_conv;
17028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17029 this_ptr_conv.is_owned = false;
17030 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
17034 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint32_t this_ptr, jboolean val) {
17035 LDKChannelTransactionParameters this_ptr_conv;
17036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17037 this_ptr_conv.is_owned = false;
17038 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
17041 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint32_t this_ptr) {
17042 LDKChannelTransactionParameters this_ptr_conv;
17043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17044 this_ptr_conv.is_owned = false;
17045 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
17046 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17047 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17048 long ret_ref = (long)ret_var.inner;
17049 if (ret_var.is_owned) {
17055 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint32_t this_ptr, uint32_t val) {
17056 LDKChannelTransactionParameters this_ptr_conv;
17057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17058 this_ptr_conv.is_owned = false;
17059 LDKCounterpartyChannelTransactionParameters val_conv;
17060 val_conv.inner = (void*)(val & (~1));
17061 val_conv.is_owned = (val & 1) || (val == 0);
17062 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
17063 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
17066 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint32_t this_ptr) {
17067 LDKChannelTransactionParameters this_ptr_conv;
17068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17069 this_ptr_conv.is_owned = false;
17070 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
17071 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17072 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17073 long ret_ref = (long)ret_var.inner;
17074 if (ret_var.is_owned) {
17080 void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint32_t this_ptr, uint32_t val) {
17081 LDKChannelTransactionParameters this_ptr_conv;
17082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17083 this_ptr_conv.is_owned = false;
17084 LDKOutPoint val_conv;
17085 val_conv.inner = (void*)(val & (~1));
17086 val_conv.is_owned = (val & 1) || (val == 0);
17087 val_conv = OutPoint_clone(&val_conv);
17088 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
17091 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) {
17092 LDKChannelPublicKeys holder_pubkeys_arg_conv;
17093 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
17094 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
17095 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
17096 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
17097 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
17098 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
17099 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
17100 LDKOutPoint funding_outpoint_arg_conv;
17101 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
17102 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
17103 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
17104 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);
17105 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17106 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17107 long ret_ref = (long)ret_var.inner;
17108 if (ret_var.is_owned) {
17114 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_clone(uint32_t orig) {
17115 LDKChannelTransactionParameters orig_conv;
17116 orig_conv.inner = (void*)(orig & (~1));
17117 orig_conv.is_owned = false;
17118 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
17119 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17120 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17121 long ret_ref = (long)ret_var.inner;
17122 if (ret_var.is_owned) {
17128 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_free(uint32_t this_obj) {
17129 LDKCounterpartyChannelTransactionParameters this_obj_conv;
17130 this_obj_conv.inner = (void*)(this_obj & (~1));
17131 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17132 CounterpartyChannelTransactionParameters_free(this_obj_conv);
17135 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint32_t this_ptr) {
17136 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17138 this_ptr_conv.is_owned = false;
17139 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
17140 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17141 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17142 long ret_ref = (long)ret_var.inner;
17143 if (ret_var.is_owned) {
17149 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint32_t this_ptr, uint32_t val) {
17150 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17152 this_ptr_conv.is_owned = false;
17153 LDKChannelPublicKeys val_conv;
17154 val_conv.inner = (void*)(val & (~1));
17155 val_conv.is_owned = (val & 1) || (val == 0);
17156 val_conv = ChannelPublicKeys_clone(&val_conv);
17157 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
17160 int16_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint32_t this_ptr) {
17161 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17163 this_ptr_conv.is_owned = false;
17164 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
17168 void __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint32_t this_ptr, int16_t val) {
17169 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
17170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17171 this_ptr_conv.is_owned = false;
17172 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
17175 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_new(uint32_t pubkeys_arg, int16_t selected_contest_delay_arg) {
17176 LDKChannelPublicKeys pubkeys_arg_conv;
17177 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
17178 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
17179 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
17180 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
17181 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17182 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17183 long ret_ref = (long)ret_var.inner;
17184 if (ret_var.is_owned) {
17190 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_clone(uint32_t orig) {
17191 LDKCounterpartyChannelTransactionParameters orig_conv;
17192 orig_conv.inner = (void*)(orig & (~1));
17193 orig_conv.is_owned = false;
17194 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
17195 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17196 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17197 long ret_ref = (long)ret_var.inner;
17198 if (ret_var.is_owned) {
17204 jboolean __attribute__((visibility("default"))) TS_ChannelTransactionParameters_is_populated(uint32_t this_arg) {
17205 LDKChannelTransactionParameters this_arg_conv;
17206 this_arg_conv.inner = (void*)(this_arg & (~1));
17207 this_arg_conv.is_owned = false;
17208 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
17212 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint32_t this_arg) {
17213 LDKChannelTransactionParameters this_arg_conv;
17214 this_arg_conv.inner = (void*)(this_arg & (~1));
17215 this_arg_conv.is_owned = false;
17216 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
17217 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17218 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17219 long ret_ref = (long)ret_var.inner;
17220 if (ret_var.is_owned) {
17226 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint32_t this_arg) {
17227 LDKChannelTransactionParameters this_arg_conv;
17228 this_arg_conv.inner = (void*)(this_arg & (~1));
17229 this_arg_conv.is_owned = false;
17230 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
17231 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17232 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17233 long ret_ref = (long)ret_var.inner;
17234 if (ret_var.is_owned) {
17240 int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_write(uint32_t obj) {
17241 LDKCounterpartyChannelTransactionParameters obj_conv;
17242 obj_conv.inner = (void*)(obj & (~1));
17243 obj_conv.is_owned = false;
17244 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
17245 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17246 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17247 CVec_u8Z_free(ret_var);
17251 uint32_t __attribute__((visibility("default"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
17252 LDKu8slice ser_ref;
17253 ser_ref.datalen = *((uint32_t*)ser);
17254 ser_ref.data = (int8_t*)(ser + 4);
17255 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
17256 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
17257 return (long)ret_conv;
17260 int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParameters_write(uint32_t obj) {
17261 LDKChannelTransactionParameters obj_conv;
17262 obj_conv.inner = (void*)(obj & (~1));
17263 obj_conv.is_owned = false;
17264 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
17265 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17266 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17267 CVec_u8Z_free(ret_var);
17271 uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
17272 LDKu8slice ser_ref;
17273 ser_ref.datalen = *((uint32_t*)ser);
17274 ser_ref.data = (int8_t*)(ser + 4);
17275 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
17276 *ret_conv = ChannelTransactionParameters_read(ser_ref);
17277 return (long)ret_conv;
17280 void __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_free(uint32_t this_obj) {
17281 LDKDirectedChannelTransactionParameters this_obj_conv;
17282 this_obj_conv.inner = (void*)(this_obj & (~1));
17283 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17284 DirectedChannelTransactionParameters_free(this_obj_conv);
17287 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint32_t this_arg) {
17288 LDKDirectedChannelTransactionParameters this_arg_conv;
17289 this_arg_conv.inner = (void*)(this_arg & (~1));
17290 this_arg_conv.is_owned = false;
17291 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
17292 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17293 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17294 long ret_ref = (long)ret_var.inner;
17295 if (ret_var.is_owned) {
17301 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint32_t this_arg) {
17302 LDKDirectedChannelTransactionParameters this_arg_conv;
17303 this_arg_conv.inner = (void*)(this_arg & (~1));
17304 this_arg_conv.is_owned = false;
17305 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
17306 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17307 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17308 long ret_ref = (long)ret_var.inner;
17309 if (ret_var.is_owned) {
17315 int16_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_contest_delay(uint32_t this_arg) {
17316 LDKDirectedChannelTransactionParameters this_arg_conv;
17317 this_arg_conv.inner = (void*)(this_arg & (~1));
17318 this_arg_conv.is_owned = false;
17319 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
17323 jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_is_outbound(uint32_t this_arg) {
17324 LDKDirectedChannelTransactionParameters this_arg_conv;
17325 this_arg_conv.inner = (void*)(this_arg & (~1));
17326 this_arg_conv.is_owned = false;
17327 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
17331 uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint32_t this_arg) {
17332 LDKDirectedChannelTransactionParameters this_arg_conv;
17333 this_arg_conv.inner = (void*)(this_arg & (~1));
17334 this_arg_conv.is_owned = false;
17335 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
17336 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17337 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17338 long ret_ref = (long)ret_var.inner;
17339 if (ret_var.is_owned) {
17345 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) {
17346 LDKHolderCommitmentTransaction this_obj_conv;
17347 this_obj_conv.inner = (void*)(this_obj & (~1));
17348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17349 HolderCommitmentTransaction_free(this_obj_conv);
17352 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint32_t this_ptr) {
17353 LDKHolderCommitmentTransaction this_ptr_conv;
17354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17355 this_ptr_conv.is_owned = false;
17356 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17357 memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
17361 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) {
17362 LDKHolderCommitmentTransaction this_ptr_conv;
17363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17364 this_ptr_conv.is_owned = false;
17365 LDKSignature val_ref;
17366 CHECK(*((uint32_t*)val) == 64);
17367 memcpy(val_ref.compact_form, (uint8_t*)(val + 4), 64);
17368 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
17371 void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint32_t this_ptr, ptrArray val) {
17372 LDKHolderCommitmentTransaction this_ptr_conv;
17373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17374 this_ptr_conv.is_owned = false;
17375 LDKCVec_SignatureZ val_constr;
17376 val_constr.datalen = *((uint32_t*)val);
17377 if (val_constr.datalen > 0)
17378 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17380 val_constr.data = NULL;
17381 int8_tArray* val_vals = (int8_tArray*)(val + 4);
17382 for (size_t m = 0; m < val_constr.datalen; m++) {
17383 int8_tArray val_conv_12 = val_vals[m];
17384 LDKSignature val_conv_12_ref;
17385 CHECK(*((uint32_t*)val_conv_12) == 64);
17386 memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64);
17387 val_constr.data[m] = val_conv_12_ref;
17389 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
17392 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_clone(uint32_t orig) {
17393 LDKHolderCommitmentTransaction orig_conv;
17394 orig_conv.inner = (void*)(orig & (~1));
17395 orig_conv.is_owned = false;
17396 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
17397 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17398 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17399 long ret_ref = (long)ret_var.inner;
17400 if (ret_var.is_owned) {
17406 int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_write(uint32_t obj) {
17407 LDKHolderCommitmentTransaction obj_conv;
17408 obj_conv.inner = (void*)(obj & (~1));
17409 obj_conv.is_owned = false;
17410 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
17411 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17412 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17413 CVec_u8Z_free(ret_var);
17417 uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
17418 LDKu8slice ser_ref;
17419 ser_ref.datalen = *((uint32_t*)ser);
17420 ser_ref.data = (int8_t*)(ser + 4);
17421 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
17422 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
17423 return (long)ret_conv;
17426 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) {
17427 LDKCommitmentTransaction commitment_tx_conv;
17428 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
17429 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
17430 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
17431 LDKSignature counterparty_sig_ref;
17432 CHECK(*((uint32_t*)counterparty_sig) == 64);
17433 memcpy(counterparty_sig_ref.compact_form, (uint8_t*)(counterparty_sig + 4), 64);
17434 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
17435 counterparty_htlc_sigs_constr.datalen = *((uint32_t*)counterparty_htlc_sigs);
17436 if (counterparty_htlc_sigs_constr.datalen > 0)
17437 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17439 counterparty_htlc_sigs_constr.data = NULL;
17440 int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4);
17441 for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
17442 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
17443 LDKSignature counterparty_htlc_sigs_conv_12_ref;
17444 CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64);
17445 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64);
17446 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
17448 LDKPublicKey holder_funding_key_ref;
17449 CHECK(*((uint32_t*)holder_funding_key) == 33);
17450 memcpy(holder_funding_key_ref.compressed_form, (uint8_t*)(holder_funding_key + 4), 33);
17451 LDKPublicKey counterparty_funding_key_ref;
17452 CHECK(*((uint32_t*)counterparty_funding_key) == 33);
17453 memcpy(counterparty_funding_key_ref.compressed_form, (uint8_t*)(counterparty_funding_key + 4), 33);
17454 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
17455 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17456 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17457 long ret_ref = (long)ret_var.inner;
17458 if (ret_var.is_owned) {
17464 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_free(uint32_t this_obj) {
17465 LDKBuiltCommitmentTransaction this_obj_conv;
17466 this_obj_conv.inner = (void*)(this_obj & (~1));
17467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17468 BuiltCommitmentTransaction_free(this_obj_conv);
17471 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_transaction(uint32_t this_ptr) {
17472 LDKBuiltCommitmentTransaction this_ptr_conv;
17473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17474 this_ptr_conv.is_owned = false;
17475 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
17476 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17477 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17478 Transaction_free(ret_var);
17482 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) {
17483 LDKBuiltCommitmentTransaction this_ptr_conv;
17484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17485 this_ptr_conv.is_owned = false;
17486 LDKTransaction val_ref;
17487 val_ref.datalen = *((uint32_t*)val);
17488 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
17489 memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
17490 val_ref.data_is_owned = true;
17491 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
17494 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_txid(uint32_t this_ptr) {
17495 LDKBuiltCommitmentTransaction this_ptr_conv;
17496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17497 this_ptr_conv.is_owned = false;
17498 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17499 memcpy((uint8_t*)(ret_arr + 4), *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
17503 void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_txid(uint32_t this_ptr, int8_tArray val) {
17504 LDKBuiltCommitmentTransaction this_ptr_conv;
17505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17506 this_ptr_conv.is_owned = false;
17507 LDKThirtyTwoBytes val_ref;
17508 CHECK(*((uint32_t*)val) == 32);
17509 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
17510 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
17513 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
17514 LDKTransaction transaction_arg_ref;
17515 transaction_arg_ref.datalen = *((uint32_t*)transaction_arg);
17516 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
17517 memcpy(transaction_arg_ref.data, (uint8_t*)(transaction_arg + 4), transaction_arg_ref.datalen);
17518 transaction_arg_ref.data_is_owned = true;
17519 LDKThirtyTwoBytes txid_arg_ref;
17520 CHECK(*((uint32_t*)txid_arg) == 32);
17521 memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32);
17522 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
17523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17525 long ret_ref = (long)ret_var.inner;
17526 if (ret_var.is_owned) {
17532 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_clone(uint32_t orig) {
17533 LDKBuiltCommitmentTransaction orig_conv;
17534 orig_conv.inner = (void*)(orig & (~1));
17535 orig_conv.is_owned = false;
17536 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
17537 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17538 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17539 long ret_ref = (long)ret_var.inner;
17540 if (ret_var.is_owned) {
17546 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_write(uint32_t obj) {
17547 LDKBuiltCommitmentTransaction obj_conv;
17548 obj_conv.inner = (void*)(obj & (~1));
17549 obj_conv.is_owned = false;
17550 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
17551 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17552 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17553 CVec_u8Z_free(ret_var);
17557 uint32_t __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
17558 LDKu8slice ser_ref;
17559 ser_ref.datalen = *((uint32_t*)ser);
17560 ser_ref.data = (int8_t*)(ser + 4);
17561 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
17562 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
17563 return (long)ret_conv;
17566 int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
17567 LDKBuiltCommitmentTransaction this_arg_conv;
17568 this_arg_conv.inner = (void*)(this_arg & (~1));
17569 this_arg_conv.is_owned = false;
17570 LDKu8slice funding_redeemscript_ref;
17571 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
17572 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
17573 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17574 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
17578 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) {
17579 LDKBuiltCommitmentTransaction this_arg_conv;
17580 this_arg_conv.inner = (void*)(this_arg & (~1));
17581 this_arg_conv.is_owned = false;
17582 unsigned char funding_key_arr[32];
17583 CHECK(*((uint32_t*)funding_key) == 32);
17584 memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
17585 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
17586 LDKu8slice funding_redeemscript_ref;
17587 funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
17588 funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
17589 int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
17590 memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
17594 void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
17595 LDKCommitmentTransaction this_obj_conv;
17596 this_obj_conv.inner = (void*)(this_obj & (~1));
17597 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17598 CommitmentTransaction_free(this_obj_conv);
17601 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_clone(uint32_t orig) {
17602 LDKCommitmentTransaction orig_conv;
17603 orig_conv.inner = (void*)(orig & (~1));
17604 orig_conv.is_owned = false;
17605 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
17606 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17607 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17608 long ret_ref = (long)ret_var.inner;
17609 if (ret_var.is_owned) {
17615 int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_write(uint32_t obj) {
17616 LDKCommitmentTransaction obj_conv;
17617 obj_conv.inner = (void*)(obj & (~1));
17618 obj_conv.is_owned = false;
17619 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
17620 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17621 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17622 CVec_u8Z_free(ret_var);
17626 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_read(int8_tArray ser) {
17627 LDKu8slice ser_ref;
17628 ser_ref.datalen = *((uint32_t*)ser);
17629 ser_ref.data = (int8_t*)(ser + 4);
17630 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
17631 *ret_conv = CommitmentTransaction_read(ser_ref);
17632 return (long)ret_conv;
17635 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_commitment_number(uint32_t this_arg) {
17636 LDKCommitmentTransaction this_arg_conv;
17637 this_arg_conv.inner = (void*)(this_arg & (~1));
17638 this_arg_conv.is_owned = false;
17639 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
17643 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint32_t this_arg) {
17644 LDKCommitmentTransaction this_arg_conv;
17645 this_arg_conv.inner = (void*)(this_arg & (~1));
17646 this_arg_conv.is_owned = false;
17647 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
17651 int64_t __attribute__((visibility("default"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint32_t this_arg) {
17652 LDKCommitmentTransaction this_arg_conv;
17653 this_arg_conv.inner = (void*)(this_arg & (~1));
17654 this_arg_conv.is_owned = false;
17655 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
17659 int32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_feerate_per_kw(uint32_t this_arg) {
17660 LDKCommitmentTransaction this_arg_conv;
17661 this_arg_conv.inner = (void*)(this_arg & (~1));
17662 this_arg_conv.is_owned = false;
17663 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
17667 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_trust(uint32_t this_arg) {
17668 LDKCommitmentTransaction this_arg_conv;
17669 this_arg_conv.inner = (void*)(this_arg & (~1));
17670 this_arg_conv.is_owned = false;
17671 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
17672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17674 long ret_ref = (long)ret_var.inner;
17675 if (ret_var.is_owned) {
17681 uint32_t __attribute__((visibility("default"))) TS_CommitmentTransaction_verify(uint32_t this_arg, uint32_t channel_parameters, uint32_t broadcaster_keys, uint32_t countersignatory_keys) {
17682 LDKCommitmentTransaction this_arg_conv;
17683 this_arg_conv.inner = (void*)(this_arg & (~1));
17684 this_arg_conv.is_owned = false;
17685 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17686 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17687 channel_parameters_conv.is_owned = false;
17688 LDKChannelPublicKeys broadcaster_keys_conv;
17689 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
17690 broadcaster_keys_conv.is_owned = false;
17691 LDKChannelPublicKeys countersignatory_keys_conv;
17692 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
17693 countersignatory_keys_conv.is_owned = false;
17694 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
17695 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
17696 return (long)ret_conv;
17699 void __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_free(uint32_t this_obj) {
17700 LDKTrustedCommitmentTransaction this_obj_conv;
17701 this_obj_conv.inner = (void*)(this_obj & (~1));
17702 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17703 TrustedCommitmentTransaction_free(this_obj_conv);
17706 int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_txid(uint32_t this_arg) {
17707 LDKTrustedCommitmentTransaction this_arg_conv;
17708 this_arg_conv.inner = (void*)(this_arg & (~1));
17709 this_arg_conv.is_owned = false;
17710 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
17711 memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
17715 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) {
17716 LDKTrustedCommitmentTransaction this_arg_conv;
17717 this_arg_conv.inner = (void*)(this_arg & (~1));
17718 this_arg_conv.is_owned = false;
17719 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
17720 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17721 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17722 long ret_ref = (long)ret_var.inner;
17723 if (ret_var.is_owned) {
17729 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_keys(uint32_t this_arg) {
17730 LDKTrustedCommitmentTransaction this_arg_conv;
17731 this_arg_conv.inner = (void*)(this_arg & (~1));
17732 this_arg_conv.is_owned = false;
17733 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
17734 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17735 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17736 long ret_ref = (long)ret_var.inner;
17737 if (ret_var.is_owned) {
17743 uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) {
17744 LDKTrustedCommitmentTransaction this_arg_conv;
17745 this_arg_conv.inner = (void*)(this_arg & (~1));
17746 this_arg_conv.is_owned = false;
17747 unsigned char htlc_base_key_arr[32];
17748 CHECK(*((uint32_t*)htlc_base_key) == 32);
17749 memcpy(htlc_base_key_arr, (uint8_t*)(htlc_base_key + 4), 32);
17750 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
17751 LDKDirectedChannelTransactionParameters channel_parameters_conv;
17752 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
17753 channel_parameters_conv.is_owned = false;
17754 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
17755 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
17756 return (long)ret_conv;
17759 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) {
17760 LDKPublicKey broadcaster_payment_basepoint_ref;
17761 CHECK(*((uint32_t*)broadcaster_payment_basepoint) == 33);
17762 memcpy(broadcaster_payment_basepoint_ref.compressed_form, (uint8_t*)(broadcaster_payment_basepoint + 4), 33);
17763 LDKPublicKey countersignatory_payment_basepoint_ref;
17764 CHECK(*((uint32_t*)countersignatory_payment_basepoint) == 33);
17765 memcpy(countersignatory_payment_basepoint_ref.compressed_form, (uint8_t*)(countersignatory_payment_basepoint + 4), 33);
17766 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
17770 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_clone(uint32_t orig) {
17771 LDKInitFeatures orig_conv;
17772 orig_conv.inner = (void*)(orig & (~1));
17773 orig_conv.is_owned = false;
17774 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
17775 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17776 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17777 long ret_ref = (long)ret_var.inner;
17778 if (ret_var.is_owned) {
17784 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_clone(uint32_t orig) {
17785 LDKNodeFeatures orig_conv;
17786 orig_conv.inner = (void*)(orig & (~1));
17787 orig_conv.is_owned = false;
17788 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
17789 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17790 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17791 long ret_ref = (long)ret_var.inner;
17792 if (ret_var.is_owned) {
17798 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_clone(uint32_t orig) {
17799 LDKChannelFeatures orig_conv;
17800 orig_conv.inner = (void*)(orig & (~1));
17801 orig_conv.is_owned = false;
17802 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
17803 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17804 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17805 long ret_ref = (long)ret_var.inner;
17806 if (ret_var.is_owned) {
17812 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32_t orig) {
17813 LDKInvoiceFeatures orig_conv;
17814 orig_conv.inner = (void*)(orig & (~1));
17815 orig_conv.is_owned = false;
17816 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
17817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17819 long ret_ref = (long)ret_var.inner;
17820 if (ret_var.is_owned) {
17826 void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) {
17827 LDKInitFeatures this_obj_conv;
17828 this_obj_conv.inner = (void*)(this_obj & (~1));
17829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17830 InitFeatures_free(this_obj_conv);
17833 void __attribute__((visibility("default"))) TS_NodeFeatures_free(uint32_t this_obj) {
17834 LDKNodeFeatures this_obj_conv;
17835 this_obj_conv.inner = (void*)(this_obj & (~1));
17836 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17837 NodeFeatures_free(this_obj_conv);
17840 void __attribute__((visibility("default"))) TS_ChannelFeatures_free(uint32_t this_obj) {
17841 LDKChannelFeatures this_obj_conv;
17842 this_obj_conv.inner = (void*)(this_obj & (~1));
17843 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17844 ChannelFeatures_free(this_obj_conv);
17847 void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t this_obj) {
17848 LDKInvoiceFeatures this_obj_conv;
17849 this_obj_conv.inner = (void*)(this_obj & (~1));
17850 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17851 InvoiceFeatures_free(this_obj_conv);
17854 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() {
17855 LDKInitFeatures ret_var = InitFeatures_empty();
17856 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17857 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17858 long ret_ref = (long)ret_var.inner;
17859 if (ret_var.is_owned) {
17865 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_known() {
17866 LDKInitFeatures ret_var = InitFeatures_known();
17867 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17868 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17869 long ret_ref = (long)ret_var.inner;
17870 if (ret_var.is_owned) {
17876 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
17877 LDKNodeFeatures ret_var = NodeFeatures_empty();
17878 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17879 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17880 long ret_ref = (long)ret_var.inner;
17881 if (ret_var.is_owned) {
17887 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_known() {
17888 LDKNodeFeatures ret_var = NodeFeatures_known();
17889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17891 long ret_ref = (long)ret_var.inner;
17892 if (ret_var.is_owned) {
17898 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
17899 LDKChannelFeatures ret_var = ChannelFeatures_empty();
17900 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17901 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17902 long ret_ref = (long)ret_var.inner;
17903 if (ret_var.is_owned) {
17909 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_known() {
17910 LDKChannelFeatures ret_var = ChannelFeatures_known();
17911 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17912 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17913 long ret_ref = (long)ret_var.inner;
17914 if (ret_var.is_owned) {
17920 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
17921 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
17922 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17923 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17924 long ret_ref = (long)ret_var.inner;
17925 if (ret_var.is_owned) {
17931 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_known() {
17932 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
17933 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17934 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17935 long ret_ref = (long)ret_var.inner;
17936 if (ret_var.is_owned) {
17942 int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32_t obj) {
17943 LDKInitFeatures obj_conv;
17944 obj_conv.inner = (void*)(obj & (~1));
17945 obj_conv.is_owned = false;
17946 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
17947 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17948 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17949 CVec_u8Z_free(ret_var);
17953 int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) {
17954 LDKNodeFeatures obj_conv;
17955 obj_conv.inner = (void*)(obj & (~1));
17956 obj_conv.is_owned = false;
17957 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
17958 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17959 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17960 CVec_u8Z_free(ret_var);
17964 int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) {
17965 LDKChannelFeatures obj_conv;
17966 obj_conv.inner = (void*)(obj & (~1));
17967 obj_conv.is_owned = false;
17968 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
17969 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17970 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17971 CVec_u8Z_free(ret_var);
17975 int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) {
17976 LDKInvoiceFeatures obj_conv;
17977 obj_conv.inner = (void*)(obj & (~1));
17978 obj_conv.is_owned = false;
17979 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
17980 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
17981 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
17982 CVec_u8Z_free(ret_var);
17986 uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) {
17987 LDKu8slice ser_ref;
17988 ser_ref.datalen = *((uint32_t*)ser);
17989 ser_ref.data = (int8_t*)(ser + 4);
17990 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
17991 *ret_conv = InitFeatures_read(ser_ref);
17992 return (long)ret_conv;
17995 uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) {
17996 LDKu8slice ser_ref;
17997 ser_ref.datalen = *((uint32_t*)ser);
17998 ser_ref.data = (int8_t*)(ser + 4);
17999 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18000 *ret_conv = NodeFeatures_read(ser_ref);
18001 return (long)ret_conv;
18004 uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) {
18005 LDKu8slice ser_ref;
18006 ser_ref.datalen = *((uint32_t*)ser);
18007 ser_ref.data = (int8_t*)(ser + 4);
18008 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18009 *ret_conv = ChannelFeatures_read(ser_ref);
18010 return (long)ret_conv;
18013 uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) {
18014 LDKu8slice ser_ref;
18015 ser_ref.datalen = *((uint32_t*)ser);
18016 ser_ref.data = (int8_t*)(ser + 4);
18017 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
18018 *ret_conv = InvoiceFeatures_read(ser_ref);
18019 return (long)ret_conv;
18022 void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
18023 LDKRouteHop this_obj_conv;
18024 this_obj_conv.inner = (void*)(this_obj & (~1));
18025 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18026 RouteHop_free(this_obj_conv);
18029 int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
18030 LDKRouteHop this_ptr_conv;
18031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18032 this_ptr_conv.is_owned = false;
18033 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18034 memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
18038 void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
18039 LDKRouteHop this_ptr_conv;
18040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18041 this_ptr_conv.is_owned = false;
18042 LDKPublicKey val_ref;
18043 CHECK(*((uint32_t*)val) == 33);
18044 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18045 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
18048 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
18049 LDKRouteHop this_ptr_conv;
18050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18051 this_ptr_conv.is_owned = false;
18052 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
18053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18055 long ret_ref = (long)ret_var.inner;
18056 if (ret_var.is_owned) {
18062 void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
18063 LDKRouteHop this_ptr_conv;
18064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18065 this_ptr_conv.is_owned = false;
18066 LDKNodeFeatures val_conv;
18067 val_conv.inner = (void*)(val & (~1));
18068 val_conv.is_owned = (val & 1) || (val == 0);
18069 val_conv = NodeFeatures_clone(&val_conv);
18070 RouteHop_set_node_features(&this_ptr_conv, val_conv);
18073 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
18074 LDKRouteHop this_ptr_conv;
18075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18076 this_ptr_conv.is_owned = false;
18077 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
18081 void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18082 LDKRouteHop this_ptr_conv;
18083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18084 this_ptr_conv.is_owned = false;
18085 RouteHop_set_short_channel_id(&this_ptr_conv, val);
18088 uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
18089 LDKRouteHop this_ptr_conv;
18090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18091 this_ptr_conv.is_owned = false;
18092 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
18093 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18094 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18095 long ret_ref = (long)ret_var.inner;
18096 if (ret_var.is_owned) {
18102 void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
18103 LDKRouteHop this_ptr_conv;
18104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18105 this_ptr_conv.is_owned = false;
18106 LDKChannelFeatures val_conv;
18107 val_conv.inner = (void*)(val & (~1));
18108 val_conv.is_owned = (val & 1) || (val == 0);
18109 val_conv = ChannelFeatures_clone(&val_conv);
18110 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
18113 int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
18114 LDKRouteHop this_ptr_conv;
18115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18116 this_ptr_conv.is_owned = false;
18117 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
18121 void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
18122 LDKRouteHop this_ptr_conv;
18123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18124 this_ptr_conv.is_owned = false;
18125 RouteHop_set_fee_msat(&this_ptr_conv, val);
18128 int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
18129 LDKRouteHop this_ptr_conv;
18130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18131 this_ptr_conv.is_owned = false;
18132 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
18136 void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
18137 LDKRouteHop this_ptr_conv;
18138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18139 this_ptr_conv.is_owned = false;
18140 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
18143 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) {
18144 LDKPublicKey pubkey_arg_ref;
18145 CHECK(*((uint32_t*)pubkey_arg) == 33);
18146 memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
18147 LDKNodeFeatures node_features_arg_conv;
18148 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
18149 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
18150 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
18151 LDKChannelFeatures channel_features_arg_conv;
18152 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
18153 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
18154 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
18155 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);
18156 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18157 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18158 long ret_ref = (long)ret_var.inner;
18159 if (ret_var.is_owned) {
18165 uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
18166 LDKRouteHop orig_conv;
18167 orig_conv.inner = (void*)(orig & (~1));
18168 orig_conv.is_owned = false;
18169 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
18170 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18171 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18172 long ret_ref = (long)ret_var.inner;
18173 if (ret_var.is_owned) {
18179 void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
18180 LDKRoute this_obj_conv;
18181 this_obj_conv.inner = (void*)(this_obj & (~1));
18182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18183 Route_free(this_obj_conv);
18186 void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
18187 LDKRoute this_ptr_conv;
18188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18189 this_ptr_conv.is_owned = false;
18190 LDKCVec_CVec_RouteHopZZ val_constr;
18191 val_constr.datalen = *((uint32_t*)val);
18192 if (val_constr.datalen > 0)
18193 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18195 val_constr.data = NULL;
18196 uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
18197 for (size_t m = 0; m < val_constr.datalen; m++) {
18198 uint32_tArray val_conv_12 = val_vals[m];
18199 LDKCVec_RouteHopZ val_conv_12_constr;
18200 val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
18201 if (val_conv_12_constr.datalen > 0)
18202 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18204 val_conv_12_constr.data = NULL;
18205 uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
18206 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
18207 uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
18208 LDKRouteHop val_conv_12_conv_10_conv;
18209 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
18210 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
18211 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
18212 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
18214 val_constr.data[m] = val_conv_12_constr;
18216 Route_set_paths(&this_ptr_conv, val_constr);
18219 uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) {
18220 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
18221 paths_arg_constr.datalen = *((uint32_t*)paths_arg);
18222 if (paths_arg_constr.datalen > 0)
18223 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
18225 paths_arg_constr.data = NULL;
18226 uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
18227 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
18228 uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
18229 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
18230 paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
18231 if (paths_arg_conv_12_constr.datalen > 0)
18232 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
18234 paths_arg_conv_12_constr.data = NULL;
18235 uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
18236 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
18237 uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
18238 LDKRouteHop paths_arg_conv_12_conv_10_conv;
18239 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
18240 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
18241 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
18242 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
18244 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
18246 LDKRoute ret_var = Route_new(paths_arg_constr);
18247 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18248 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18249 long ret_ref = (long)ret_var.inner;
18250 if (ret_var.is_owned) {
18256 uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
18257 LDKRoute orig_conv;
18258 orig_conv.inner = (void*)(orig & (~1));
18259 orig_conv.is_owned = false;
18260 LDKRoute ret_var = Route_clone(&orig_conv);
18261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18263 long ret_ref = (long)ret_var.inner;
18264 if (ret_var.is_owned) {
18270 int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
18272 obj_conv.inner = (void*)(obj & (~1));
18273 obj_conv.is_owned = false;
18274 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
18275 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18276 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18277 CVec_u8Z_free(ret_var);
18281 uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
18282 LDKu8slice ser_ref;
18283 ser_ref.datalen = *((uint32_t*)ser);
18284 ser_ref.data = (int8_t*)(ser + 4);
18285 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
18286 *ret_conv = Route_read(ser_ref);
18287 return (long)ret_conv;
18290 void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
18291 LDKRouteHint this_obj_conv;
18292 this_obj_conv.inner = (void*)(this_obj & (~1));
18293 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18294 RouteHint_free(this_obj_conv);
18297 int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id(uint32_t this_ptr) {
18298 LDKRouteHint this_ptr_conv;
18299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18300 this_ptr_conv.is_owned = false;
18301 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18302 memcpy((uint8_t*)(ret_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33);
18306 void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
18307 LDKRouteHint this_ptr_conv;
18308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18309 this_ptr_conv.is_owned = false;
18310 LDKPublicKey val_ref;
18311 CHECK(*((uint32_t*)val) == 33);
18312 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18313 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
18316 int64_t __attribute__((visibility("default"))) TS_RouteHint_get_short_channel_id(uint32_t this_ptr) {
18317 LDKRouteHint this_ptr_conv;
18318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18319 this_ptr_conv.is_owned = false;
18320 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
18324 void __attribute__((visibility("default"))) TS_RouteHint_set_short_channel_id(uint32_t this_ptr, int64_t val) {
18325 LDKRouteHint this_ptr_conv;
18326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18327 this_ptr_conv.is_owned = false;
18328 RouteHint_set_short_channel_id(&this_ptr_conv, val);
18331 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_fees(uint32_t this_ptr) {
18332 LDKRouteHint this_ptr_conv;
18333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18334 this_ptr_conv.is_owned = false;
18335 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
18336 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18337 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18338 long ret_ref = (long)ret_var.inner;
18339 if (ret_var.is_owned) {
18345 void __attribute__((visibility("default"))) TS_RouteHint_set_fees(uint32_t this_ptr, uint32_t val) {
18346 LDKRouteHint this_ptr_conv;
18347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18348 this_ptr_conv.is_owned = false;
18349 LDKRoutingFees val_conv;
18350 val_conv.inner = (void*)(val & (~1));
18351 val_conv.is_owned = (val & 1) || (val == 0);
18352 val_conv = RoutingFees_clone(&val_conv);
18353 RouteHint_set_fees(&this_ptr_conv, val_conv);
18356 int16_t __attribute__((visibility("default"))) TS_RouteHint_get_cltv_expiry_delta(uint32_t this_ptr) {
18357 LDKRouteHint this_ptr_conv;
18358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18359 this_ptr_conv.is_owned = false;
18360 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
18364 void __attribute__((visibility("default"))) TS_RouteHint_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18365 LDKRouteHint this_ptr_conv;
18366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18367 this_ptr_conv.is_owned = false;
18368 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
18371 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_minimum_msat(uint32_t this_ptr) {
18372 LDKRouteHint this_ptr_conv;
18373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18374 this_ptr_conv.is_owned = false;
18375 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18376 *ret_copy = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
18377 long ret_ref = (long)ret_copy;
18381 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
18382 LDKRouteHint this_ptr_conv;
18383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18384 this_ptr_conv.is_owned = false;
18385 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18387 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
18390 uint32_t __attribute__((visibility("default"))) TS_RouteHint_get_htlc_maximum_msat(uint32_t this_ptr) {
18391 LDKRouteHint this_ptr_conv;
18392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18393 this_ptr_conv.is_owned = false;
18394 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18395 *ret_copy = RouteHint_get_htlc_maximum_msat(&this_ptr_conv);
18396 long ret_ref = (long)ret_copy;
18400 void __attribute__((visibility("default"))) TS_RouteHint_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
18401 LDKRouteHint this_ptr_conv;
18402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18403 this_ptr_conv.is_owned = false;
18404 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18406 RouteHint_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
18409 uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) {
18410 LDKPublicKey src_node_id_arg_ref;
18411 CHECK(*((uint32_t*)src_node_id_arg) == 33);
18412 memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
18413 LDKRoutingFees fees_arg_conv;
18414 fees_arg_conv.inner = (void*)(fees_arg & (~1));
18415 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
18416 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
18417 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
18418 FREE((void*)htlc_minimum_msat_arg);
18419 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
18420 FREE((void*)htlc_maximum_msat_arg);
18421 LDKRouteHint ret_var = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
18422 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18423 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18424 long ret_ref = (long)ret_var.inner;
18425 if (ret_var.is_owned) {
18431 uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
18432 LDKRouteHint orig_conv;
18433 orig_conv.inner = (void*)(orig & (~1));
18434 orig_conv.is_owned = false;
18435 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
18436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18438 long ret_ref = (long)ret_var.inner;
18439 if (ret_var.is_owned) {
18445 uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
18446 LDKPublicKey our_node_id_ref;
18447 CHECK(*((uint32_t*)our_node_id) == 33);
18448 memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
18449 LDKNetworkGraph network_conv;
18450 network_conv.inner = (void*)(network & (~1));
18451 network_conv.is_owned = false;
18452 LDKPublicKey payee_ref;
18453 CHECK(*((uint32_t*)payee) == 33);
18454 memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
18455 LDKInvoiceFeatures payee_features_conv;
18456 payee_features_conv.inner = (void*)(payee_features & (~1));
18457 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
18458 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
18459 LDKCVec_ChannelDetailsZ first_hops_constr;
18460 first_hops_constr.datalen = *((uint32_t*)first_hops);
18461 if (first_hops_constr.datalen > 0)
18462 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
18464 first_hops_constr.data = NULL;
18465 uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
18466 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
18467 uint32_t first_hops_conv_16 = first_hops_vals[q];
18468 LDKChannelDetails first_hops_conv_16_conv;
18469 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
18470 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
18471 first_hops_constr.data[q] = first_hops_conv_16_conv;
18473 LDKCVec_RouteHintZ last_hops_constr;
18474 last_hops_constr.datalen = *((uint32_t*)last_hops);
18475 if (last_hops_constr.datalen > 0)
18476 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
18478 last_hops_constr.data = NULL;
18479 uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
18480 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
18481 uint32_t last_hops_conv_11 = last_hops_vals[l];
18482 LDKRouteHint last_hops_conv_11_conv;
18483 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
18484 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
18485 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
18486 last_hops_constr.data[l] = last_hops_conv_11_conv;
18488 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18489 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
18490 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
18491 FREE(first_hops_constr.data);
18492 return (long)ret_conv;
18495 void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) {
18496 LDKNetworkGraph this_obj_conv;
18497 this_obj_conv.inner = (void*)(this_obj & (~1));
18498 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18499 NetworkGraph_free(this_obj_conv);
18502 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
18503 LDKNetworkGraph orig_conv;
18504 orig_conv.inner = (void*)(orig & (~1));
18505 orig_conv.is_owned = false;
18506 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
18507 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18508 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18509 long ret_ref = (long)ret_var.inner;
18510 if (ret_var.is_owned) {
18516 void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
18517 LDKLockedNetworkGraph this_obj_conv;
18518 this_obj_conv.inner = (void*)(this_obj & (~1));
18519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18520 LockedNetworkGraph_free(this_obj_conv);
18523 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
18524 LDKNetGraphMsgHandler this_obj_conv;
18525 this_obj_conv.inner = (void*)(this_obj & (~1));
18526 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18527 NetGraphMsgHandler_free(this_obj_conv);
18530 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
18531 LDKThirtyTwoBytes genesis_hash_ref;
18532 CHECK(*((uint32_t*)genesis_hash) == 32);
18533 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
18534 LDKAccess *chain_access_conv_ptr = NULL;
18535 if (chain_access != 0) {
18536 LDKAccess chain_access_conv;
18537 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
18538 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
18539 *chain_access_conv_ptr = chain_access_conv;
18541 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18542 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
18543 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18544 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18545 long ret_ref = (long)ret_var.inner;
18546 if (ret_var.is_owned) {
18552 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
18553 LDKAccess *chain_access_conv_ptr = NULL;
18554 if (chain_access != 0) {
18555 LDKAccess chain_access_conv;
18556 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
18557 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
18558 *chain_access_conv_ptr = chain_access_conv;
18560 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18561 LDKNetworkGraph network_graph_conv;
18562 network_graph_conv.inner = (void*)(network_graph & (~1));
18563 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
18564 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
18565 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_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 void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) {
18576 LDKNetGraphMsgHandler this_arg_conv;
18577 this_arg_conv.inner = (void*)(this_arg & (~1));
18578 this_arg_conv.is_owned = false;
18579 LDKAccess *chain_access_conv_ptr = NULL;
18580 if (chain_access != 0) {
18581 LDKAccess chain_access_conv;
18582 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
18583 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
18584 *chain_access_conv_ptr = chain_access_conv;
18586 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
18589 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
18590 LDKNetGraphMsgHandler this_arg_conv;
18591 this_arg_conv.inner = (void*)(this_arg & (~1));
18592 this_arg_conv.is_owned = false;
18593 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
18594 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18595 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18596 long ret_ref = (long)ret_var.inner;
18597 if (ret_var.is_owned) {
18603 uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
18604 LDKLockedNetworkGraph this_arg_conv;
18605 this_arg_conv.inner = (void*)(this_arg & (~1));
18606 this_arg_conv.is_owned = false;
18607 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
18608 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18609 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18610 long ret_ref = (long)ret_var.inner;
18611 if (ret_var.is_owned) {
18617 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
18618 LDKNetGraphMsgHandler this_arg_conv;
18619 this_arg_conv.inner = (void*)(this_arg & (~1));
18620 this_arg_conv.is_owned = false;
18621 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
18622 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
18626 uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
18627 LDKNetGraphMsgHandler this_arg_conv;
18628 this_arg_conv.inner = (void*)(this_arg & (~1));
18629 this_arg_conv.is_owned = false;
18630 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18631 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
18635 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
18636 LDKDirectionalChannelInfo this_obj_conv;
18637 this_obj_conv.inner = (void*)(this_obj & (~1));
18638 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18639 DirectionalChannelInfo_free(this_obj_conv);
18642 int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) {
18643 LDKDirectionalChannelInfo this_ptr_conv;
18644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18645 this_ptr_conv.is_owned = false;
18646 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
18650 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) {
18651 LDKDirectionalChannelInfo this_ptr_conv;
18652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18653 this_ptr_conv.is_owned = false;
18654 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
18657 jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) {
18658 LDKDirectionalChannelInfo this_ptr_conv;
18659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18660 this_ptr_conv.is_owned = false;
18661 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
18665 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) {
18666 LDKDirectionalChannelInfo this_ptr_conv;
18667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18668 this_ptr_conv.is_owned = false;
18669 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
18672 int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
18673 LDKDirectionalChannelInfo this_ptr_conv;
18674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18675 this_ptr_conv.is_owned = false;
18676 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
18680 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
18681 LDKDirectionalChannelInfo this_ptr_conv;
18682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18683 this_ptr_conv.is_owned = false;
18684 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
18687 int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) {
18688 LDKDirectionalChannelInfo this_ptr_conv;
18689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18690 this_ptr_conv.is_owned = false;
18691 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
18695 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
18696 LDKDirectionalChannelInfo this_ptr_conv;
18697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18698 this_ptr_conv.is_owned = false;
18699 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
18702 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) {
18703 LDKDirectionalChannelInfo this_ptr_conv;
18704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18705 this_ptr_conv.is_owned = false;
18706 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18707 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
18708 long ret_ref = (long)ret_copy;
18712 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
18713 LDKDirectionalChannelInfo this_ptr_conv;
18714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18715 this_ptr_conv.is_owned = false;
18716 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18718 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
18721 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) {
18722 LDKDirectionalChannelInfo this_ptr_conv;
18723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18724 this_ptr_conv.is_owned = false;
18725 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
18726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18728 long ret_ref = (long)ret_var.inner;
18729 if (ret_var.is_owned) {
18735 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) {
18736 LDKDirectionalChannelInfo this_ptr_conv;
18737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18738 this_ptr_conv.is_owned = false;
18739 LDKRoutingFees val_conv;
18740 val_conv.inner = (void*)(val & (~1));
18741 val_conv.is_owned = (val & 1) || (val == 0);
18742 val_conv = RoutingFees_clone(&val_conv);
18743 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
18746 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) {
18747 LDKDirectionalChannelInfo this_ptr_conv;
18748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18749 this_ptr_conv.is_owned = false;
18750 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
18751 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18752 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18753 long ret_ref = (long)ret_var.inner;
18754 if (ret_var.is_owned) {
18760 void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) {
18761 LDKDirectionalChannelInfo this_ptr_conv;
18762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18763 this_ptr_conv.is_owned = false;
18764 LDKChannelUpdate val_conv;
18765 val_conv.inner = (void*)(val & (~1));
18766 val_conv.is_owned = (val & 1) || (val == 0);
18767 val_conv = ChannelUpdate_clone(&val_conv);
18768 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
18771 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) {
18772 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
18773 FREE((void*)htlc_maximum_msat_arg);
18774 LDKRoutingFees fees_arg_conv;
18775 fees_arg_conv.inner = (void*)(fees_arg & (~1));
18776 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
18777 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
18778 LDKChannelUpdate last_update_message_arg_conv;
18779 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
18780 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
18781 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
18782 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
18783 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18784 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18785 long ret_ref = (long)ret_var.inner;
18786 if (ret_var.is_owned) {
18792 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) {
18793 LDKDirectionalChannelInfo orig_conv;
18794 orig_conv.inner = (void*)(orig & (~1));
18795 orig_conv.is_owned = false;
18796 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
18797 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18798 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18799 long ret_ref = (long)ret_var.inner;
18800 if (ret_var.is_owned) {
18806 int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) {
18807 LDKDirectionalChannelInfo obj_conv;
18808 obj_conv.inner = (void*)(obj & (~1));
18809 obj_conv.is_owned = false;
18810 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
18811 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
18812 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
18813 CVec_u8Z_free(ret_var);
18817 uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) {
18818 LDKu8slice ser_ref;
18819 ser_ref.datalen = *((uint32_t*)ser);
18820 ser_ref.data = (int8_t*)(ser + 4);
18821 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
18822 *ret_conv = DirectionalChannelInfo_read(ser_ref);
18823 return (long)ret_conv;
18826 void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) {
18827 LDKChannelInfo this_obj_conv;
18828 this_obj_conv.inner = (void*)(this_obj & (~1));
18829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18830 ChannelInfo_free(this_obj_conv);
18833 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) {
18834 LDKChannelInfo this_ptr_conv;
18835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18836 this_ptr_conv.is_owned = false;
18837 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
18838 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18839 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18840 long ret_ref = (long)ret_var.inner;
18841 if (ret_var.is_owned) {
18847 void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) {
18848 LDKChannelInfo this_ptr_conv;
18849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18850 this_ptr_conv.is_owned = false;
18851 LDKChannelFeatures val_conv;
18852 val_conv.inner = (void*)(val & (~1));
18853 val_conv.is_owned = (val & 1) || (val == 0);
18854 val_conv = ChannelFeatures_clone(&val_conv);
18855 ChannelInfo_set_features(&this_ptr_conv, val_conv);
18858 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) {
18859 LDKChannelInfo this_ptr_conv;
18860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18861 this_ptr_conv.is_owned = false;
18862 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18863 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33);
18867 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) {
18868 LDKChannelInfo this_ptr_conv;
18869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18870 this_ptr_conv.is_owned = false;
18871 LDKPublicKey val_ref;
18872 CHECK(*((uint32_t*)val) == 33);
18873 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18874 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
18877 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) {
18878 LDKChannelInfo this_ptr_conv;
18879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18880 this_ptr_conv.is_owned = false;
18881 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
18882 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18883 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18884 long ret_ref = (long)ret_var.inner;
18885 if (ret_var.is_owned) {
18891 void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) {
18892 LDKChannelInfo this_ptr_conv;
18893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18894 this_ptr_conv.is_owned = false;
18895 LDKDirectionalChannelInfo val_conv;
18896 val_conv.inner = (void*)(val & (~1));
18897 val_conv.is_owned = (val & 1) || (val == 0);
18898 val_conv = DirectionalChannelInfo_clone(&val_conv);
18899 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
18902 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) {
18903 LDKChannelInfo this_ptr_conv;
18904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18905 this_ptr_conv.is_owned = false;
18906 int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
18907 memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33);
18911 void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) {
18912 LDKChannelInfo this_ptr_conv;
18913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18914 this_ptr_conv.is_owned = false;
18915 LDKPublicKey val_ref;
18916 CHECK(*((uint32_t*)val) == 33);
18917 memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
18918 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
18921 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) {
18922 LDKChannelInfo this_ptr_conv;
18923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18924 this_ptr_conv.is_owned = false;
18925 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
18926 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18927 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18928 long ret_ref = (long)ret_var.inner;
18929 if (ret_var.is_owned) {
18935 void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) {
18936 LDKChannelInfo this_ptr_conv;
18937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18938 this_ptr_conv.is_owned = false;
18939 LDKDirectionalChannelInfo val_conv;
18940 val_conv.inner = (void*)(val & (~1));
18941 val_conv.is_owned = (val & 1) || (val == 0);
18942 val_conv = DirectionalChannelInfo_clone(&val_conv);
18943 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
18946 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) {
18947 LDKChannelInfo this_ptr_conv;
18948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18949 this_ptr_conv.is_owned = false;
18950 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18951 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
18952 long ret_ref = (long)ret_copy;
18956 void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) {
18957 LDKChannelInfo this_ptr_conv;
18958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18959 this_ptr_conv.is_owned = false;
18960 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18962 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
18965 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) {
18966 LDKChannelInfo this_ptr_conv;
18967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18968 this_ptr_conv.is_owned = false;
18969 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
18970 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18971 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18972 long ret_ref = (long)ret_var.inner;
18973 if (ret_var.is_owned) {
18979 void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
18980 LDKChannelInfo this_ptr_conv;
18981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18982 this_ptr_conv.is_owned = false;
18983 LDKChannelAnnouncement val_conv;
18984 val_conv.inner = (void*)(val & (~1));
18985 val_conv.is_owned = (val & 1) || (val == 0);
18986 val_conv = ChannelAnnouncement_clone(&val_conv);
18987 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
18990 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, int8_tArray node_one_arg, uint32_t one_to_two_arg, int8_tArray node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) {
18991 LDKChannelFeatures features_arg_conv;
18992 features_arg_conv.inner = (void*)(features_arg & (~1));
18993 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18994 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
18995 LDKPublicKey node_one_arg_ref;
18996 CHECK(*((uint32_t*)node_one_arg) == 33);
18997 memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33);
18998 LDKDirectionalChannelInfo one_to_two_arg_conv;
18999 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
19000 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
19001 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
19002 LDKPublicKey node_two_arg_ref;
19003 CHECK(*((uint32_t*)node_two_arg) == 33);
19004 memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33);
19005 LDKDirectionalChannelInfo two_to_one_arg_conv;
19006 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
19007 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
19008 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
19009 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
19010 FREE((void*)capacity_sats_arg);
19011 LDKChannelAnnouncement announcement_message_arg_conv;
19012 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
19013 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
19014 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
19015 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
19016 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19017 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19018 long ret_ref = (long)ret_var.inner;
19019 if (ret_var.is_owned) {
19025 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) {
19026 LDKChannelInfo orig_conv;
19027 orig_conv.inner = (void*)(orig & (~1));
19028 orig_conv.is_owned = false;
19029 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
19030 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19031 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19032 long ret_ref = (long)ret_var.inner;
19033 if (ret_var.is_owned) {
19039 int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) {
19040 LDKChannelInfo obj_conv;
19041 obj_conv.inner = (void*)(obj & (~1));
19042 obj_conv.is_owned = false;
19043 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
19044 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19045 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19046 CVec_u8Z_free(ret_var);
19050 uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) {
19051 LDKu8slice ser_ref;
19052 ser_ref.datalen = *((uint32_t*)ser);
19053 ser_ref.data = (int8_t*)(ser + 4);
19054 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19055 *ret_conv = ChannelInfo_read(ser_ref);
19056 return (long)ret_conv;
19059 void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) {
19060 LDKRoutingFees this_obj_conv;
19061 this_obj_conv.inner = (void*)(this_obj & (~1));
19062 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19063 RoutingFees_free(this_obj_conv);
19066 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) {
19067 LDKRoutingFees this_ptr_conv;
19068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19069 this_ptr_conv.is_owned = false;
19070 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
19074 void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) {
19075 LDKRoutingFees this_ptr_conv;
19076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19077 this_ptr_conv.is_owned = false;
19078 RoutingFees_set_base_msat(&this_ptr_conv, val);
19081 int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) {
19082 LDKRoutingFees this_ptr_conv;
19083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19084 this_ptr_conv.is_owned = false;
19085 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
19089 void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) {
19090 LDKRoutingFees this_ptr_conv;
19091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19092 this_ptr_conv.is_owned = false;
19093 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
19096 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
19097 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
19098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19100 long ret_ref = (long)ret_var.inner;
19101 if (ret_var.is_owned) {
19107 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) {
19108 LDKRoutingFees orig_conv;
19109 orig_conv.inner = (void*)(orig & (~1));
19110 orig_conv.is_owned = false;
19111 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
19112 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19113 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19114 long ret_ref = (long)ret_var.inner;
19115 if (ret_var.is_owned) {
19121 uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) {
19122 LDKu8slice ser_ref;
19123 ser_ref.datalen = *((uint32_t*)ser);
19124 ser_ref.data = (int8_t*)(ser + 4);
19125 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19126 *ret_conv = RoutingFees_read(ser_ref);
19127 return (long)ret_conv;
19130 int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
19131 LDKRoutingFees obj_conv;
19132 obj_conv.inner = (void*)(obj & (~1));
19133 obj_conv.is_owned = false;
19134 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
19135 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19136 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19137 CVec_u8Z_free(ret_var);
19141 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) {
19142 LDKNodeAnnouncementInfo this_obj_conv;
19143 this_obj_conv.inner = (void*)(this_obj & (~1));
19144 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19145 NodeAnnouncementInfo_free(this_obj_conv);
19148 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) {
19149 LDKNodeAnnouncementInfo this_ptr_conv;
19150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19151 this_ptr_conv.is_owned = false;
19152 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
19153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19155 long ret_ref = (long)ret_var.inner;
19156 if (ret_var.is_owned) {
19162 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) {
19163 LDKNodeAnnouncementInfo this_ptr_conv;
19164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19165 this_ptr_conv.is_owned = false;
19166 LDKNodeFeatures val_conv;
19167 val_conv.inner = (void*)(val & (~1));
19168 val_conv.is_owned = (val & 1) || (val == 0);
19169 val_conv = NodeFeatures_clone(&val_conv);
19170 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
19173 int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) {
19174 LDKNodeAnnouncementInfo this_ptr_conv;
19175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19176 this_ptr_conv.is_owned = false;
19177 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
19181 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) {
19182 LDKNodeAnnouncementInfo this_ptr_conv;
19183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19184 this_ptr_conv.is_owned = false;
19185 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
19188 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) {
19189 LDKNodeAnnouncementInfo this_ptr_conv;
19190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19191 this_ptr_conv.is_owned = false;
19192 int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes");
19193 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
19197 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) {
19198 LDKNodeAnnouncementInfo this_ptr_conv;
19199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19200 this_ptr_conv.is_owned = false;
19201 LDKThreeBytes val_ref;
19202 CHECK(*((uint32_t*)val) == 3);
19203 memcpy(val_ref.data, (uint8_t*)(val + 4), 3);
19204 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
19207 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) {
19208 LDKNodeAnnouncementInfo this_ptr_conv;
19209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19210 this_ptr_conv.is_owned = false;
19211 int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
19212 memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32);
19216 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) {
19217 LDKNodeAnnouncementInfo this_ptr_conv;
19218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19219 this_ptr_conv.is_owned = false;
19220 LDKThirtyTwoBytes val_ref;
19221 CHECK(*((uint32_t*)val) == 32);
19222 memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
19223 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
19226 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) {
19227 LDKNodeAnnouncementInfo this_ptr_conv;
19228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19229 this_ptr_conv.is_owned = false;
19230 LDKCVec_NetAddressZ val_constr;
19231 val_constr.datalen = *((uint32_t*)val);
19232 if (val_constr.datalen > 0)
19233 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19235 val_constr.data = NULL;
19236 uint32_t* val_vals = (uint32_t*)(val + 4);
19237 for (size_t m = 0; m < val_constr.datalen; m++) {
19238 uint32_t val_conv_12 = val_vals[m];
19239 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
19240 FREE((void*)val_conv_12);
19241 val_constr.data[m] = val_conv_12_conv;
19243 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
19246 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) {
19247 LDKNodeAnnouncementInfo this_ptr_conv;
19248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19249 this_ptr_conv.is_owned = false;
19250 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
19251 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19252 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19253 long ret_ref = (long)ret_var.inner;
19254 if (ret_var.is_owned) {
19260 void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) {
19261 LDKNodeAnnouncementInfo this_ptr_conv;
19262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19263 this_ptr_conv.is_owned = false;
19264 LDKNodeAnnouncement val_conv;
19265 val_conv.inner = (void*)(val & (~1));
19266 val_conv.is_owned = (val & 1) || (val == 0);
19267 val_conv = NodeAnnouncement_clone(&val_conv);
19268 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
19271 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) {
19272 LDKNodeFeatures features_arg_conv;
19273 features_arg_conv.inner = (void*)(features_arg & (~1));
19274 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19275 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
19276 LDKThreeBytes rgb_arg_ref;
19277 CHECK(*((uint32_t*)rgb_arg) == 3);
19278 memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3);
19279 LDKThirtyTwoBytes alias_arg_ref;
19280 CHECK(*((uint32_t*)alias_arg) == 32);
19281 memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32);
19282 LDKCVec_NetAddressZ addresses_arg_constr;
19283 addresses_arg_constr.datalen = *((uint32_t*)addresses_arg);
19284 if (addresses_arg_constr.datalen > 0)
19285 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19287 addresses_arg_constr.data = NULL;
19288 uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4);
19289 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
19290 uint32_t addresses_arg_conv_12 = addresses_arg_vals[m];
19291 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
19292 FREE((void*)addresses_arg_conv_12);
19293 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
19295 LDKNodeAnnouncement announcement_message_arg_conv;
19296 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
19297 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
19298 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
19299 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
19300 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19301 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19302 long ret_ref = (long)ret_var.inner;
19303 if (ret_var.is_owned) {
19309 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) {
19310 LDKNodeAnnouncementInfo orig_conv;
19311 orig_conv.inner = (void*)(orig & (~1));
19312 orig_conv.is_owned = false;
19313 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
19314 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19315 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19316 long ret_ref = (long)ret_var.inner;
19317 if (ret_var.is_owned) {
19323 int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) {
19324 LDKNodeAnnouncementInfo obj_conv;
19325 obj_conv.inner = (void*)(obj & (~1));
19326 obj_conv.is_owned = false;
19327 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
19328 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19329 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19330 CVec_u8Z_free(ret_var);
19334 uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
19335 LDKu8slice ser_ref;
19336 ser_ref.datalen = *((uint32_t*)ser);
19337 ser_ref.data = (int8_t*)(ser + 4);
19338 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19339 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
19340 return (long)ret_conv;
19343 void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) {
19344 LDKNodeInfo this_obj_conv;
19345 this_obj_conv.inner = (void*)(this_obj & (~1));
19346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19347 NodeInfo_free(this_obj_conv);
19350 void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) {
19351 LDKNodeInfo this_ptr_conv;
19352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19353 this_ptr_conv.is_owned = false;
19354 LDKCVec_u64Z val_constr;
19355 val_constr.datalen = *((uint32_t*)val);
19356 if (val_constr.datalen > 0)
19357 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19359 val_constr.data = NULL;
19360 int64_t* val_vals = (int64_t*)(val + 4);
19361 for (size_t i = 0; i < val_constr.datalen; i++) {
19362 int64_t val_conv_8 = val_vals[i];
19363 val_constr.data[i] = val_conv_8;
19365 NodeInfo_set_channels(&this_ptr_conv, val_constr);
19368 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) {
19369 LDKNodeInfo this_ptr_conv;
19370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19371 this_ptr_conv.is_owned = false;
19372 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
19373 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19374 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19375 long ret_ref = (long)ret_var.inner;
19376 if (ret_var.is_owned) {
19382 void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) {
19383 LDKNodeInfo this_ptr_conv;
19384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19385 this_ptr_conv.is_owned = false;
19386 LDKRoutingFees val_conv;
19387 val_conv.inner = (void*)(val & (~1));
19388 val_conv.is_owned = (val & 1) || (val == 0);
19389 val_conv = RoutingFees_clone(&val_conv);
19390 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
19393 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) {
19394 LDKNodeInfo this_ptr_conv;
19395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19396 this_ptr_conv.is_owned = false;
19397 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
19398 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19399 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19400 long ret_ref = (long)ret_var.inner;
19401 if (ret_var.is_owned) {
19407 void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) {
19408 LDKNodeInfo this_ptr_conv;
19409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19410 this_ptr_conv.is_owned = false;
19411 LDKNodeAnnouncementInfo val_conv;
19412 val_conv.inner = (void*)(val & (~1));
19413 val_conv.is_owned = (val & 1) || (val == 0);
19414 val_conv = NodeAnnouncementInfo_clone(&val_conv);
19415 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
19418 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) {
19419 LDKCVec_u64Z channels_arg_constr;
19420 channels_arg_constr.datalen = *((uint32_t*)channels_arg);
19421 if (channels_arg_constr.datalen > 0)
19422 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19424 channels_arg_constr.data = NULL;
19425 int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4);
19426 for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
19427 int64_t channels_arg_conv_8 = channels_arg_vals[i];
19428 channels_arg_constr.data[i] = channels_arg_conv_8;
19430 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
19431 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
19432 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
19433 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
19434 LDKNodeAnnouncementInfo announcement_info_arg_conv;
19435 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
19436 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
19437 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
19438 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
19439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19441 long ret_ref = (long)ret_var.inner;
19442 if (ret_var.is_owned) {
19448 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) {
19449 LDKNodeInfo orig_conv;
19450 orig_conv.inner = (void*)(orig & (~1));
19451 orig_conv.is_owned = false;
19452 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
19453 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19454 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19455 long ret_ref = (long)ret_var.inner;
19456 if (ret_var.is_owned) {
19462 int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) {
19463 LDKNodeInfo obj_conv;
19464 obj_conv.inner = (void*)(obj & (~1));
19465 obj_conv.is_owned = false;
19466 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
19467 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19468 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19469 CVec_u8Z_free(ret_var);
19473 uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) {
19474 LDKu8slice ser_ref;
19475 ser_ref.datalen = *((uint32_t*)ser);
19476 ser_ref.data = (int8_t*)(ser + 4);
19477 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19478 *ret_conv = NodeInfo_read(ser_ref);
19479 return (long)ret_conv;
19482 int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
19483 LDKNetworkGraph obj_conv;
19484 obj_conv.inner = (void*)(obj & (~1));
19485 obj_conv.is_owned = false;
19486 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
19487 int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
19488 memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
19489 CVec_u8Z_free(ret_var);
19493 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
19494 LDKu8slice ser_ref;
19495 ser_ref.datalen = *((uint32_t*)ser);
19496 ser_ref.data = (int8_t*)(ser + 4);
19497 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19498 *ret_conv = NetworkGraph_read(ser_ref);
19499 return (long)ret_conv;
19502 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
19503 LDKThirtyTwoBytes genesis_hash_ref;
19504 CHECK(*((uint32_t*)genesis_hash) == 32);
19505 memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
19506 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
19507 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19508 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19509 long ret_ref = (long)ret_var.inner;
19510 if (ret_var.is_owned) {
19516 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
19517 LDKNetworkGraph this_arg_conv;
19518 this_arg_conv.inner = (void*)(this_arg & (~1));
19519 this_arg_conv.is_owned = false;
19520 LDKNodeAnnouncement msg_conv;
19521 msg_conv.inner = (void*)(msg & (~1));
19522 msg_conv.is_owned = false;
19523 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19524 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
19525 return (long)ret_conv;
19528 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
19529 LDKNetworkGraph this_arg_conv;
19530 this_arg_conv.inner = (void*)(this_arg & (~1));
19531 this_arg_conv.is_owned = false;
19532 LDKUnsignedNodeAnnouncement msg_conv;
19533 msg_conv.inner = (void*)(msg & (~1));
19534 msg_conv.is_owned = false;
19535 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19536 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
19537 return (long)ret_conv;
19540 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
19541 LDKNetworkGraph this_arg_conv;
19542 this_arg_conv.inner = (void*)(this_arg & (~1));
19543 this_arg_conv.is_owned = false;
19544 LDKChannelAnnouncement msg_conv;
19545 msg_conv.inner = (void*)(msg & (~1));
19546 msg_conv.is_owned = false;
19547 LDKAccess *chain_access_conv_ptr = NULL;
19548 if (chain_access != 0) {
19549 LDKAccess chain_access_conv;
19550 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19551 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19552 *chain_access_conv_ptr = chain_access_conv;
19554 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19555 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
19556 return (long)ret_conv;
19559 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
19560 LDKNetworkGraph this_arg_conv;
19561 this_arg_conv.inner = (void*)(this_arg & (~1));
19562 this_arg_conv.is_owned = false;
19563 LDKUnsignedChannelAnnouncement msg_conv;
19564 msg_conv.inner = (void*)(msg & (~1));
19565 msg_conv.is_owned = false;
19566 LDKAccess *chain_access_conv_ptr = NULL;
19567 if (chain_access != 0) {
19568 LDKAccess chain_access_conv;
19569 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
19570 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
19571 *chain_access_conv_ptr = chain_access_conv;
19573 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19574 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
19575 return (long)ret_conv;
19578 void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
19579 LDKNetworkGraph this_arg_conv;
19580 this_arg_conv.inner = (void*)(this_arg & (~1));
19581 this_arg_conv.is_owned = false;
19582 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
19585 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
19586 LDKNetworkGraph this_arg_conv;
19587 this_arg_conv.inner = (void*)(this_arg & (~1));
19588 this_arg_conv.is_owned = false;
19589 LDKChannelUpdate msg_conv;
19590 msg_conv.inner = (void*)(msg & (~1));
19591 msg_conv.is_owned = false;
19592 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19593 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
19594 return (long)ret_conv;
19597 uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
19598 LDKNetworkGraph this_arg_conv;
19599 this_arg_conv.inner = (void*)(this_arg & (~1));
19600 this_arg_conv.is_owned = false;
19601 LDKUnsignedChannelUpdate msg_conv;
19602 msg_conv.inner = (void*)(msg & (~1));
19603 msg_conv.is_owned = false;
19604 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19605 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
19606 return (long)ret_conv;