1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include "org_ldk_impl_bindings.h"
9 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
10 #define MALLOC(a, _) malloc(a)
11 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
12 #define DO_ASSERT(a) (void)(a)
15 static jmethodID ordinal_meth = NULL;
16 static jmethodID slicedef_meth = NULL;
17 static jclass slicedef_cls = NULL;
18 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
19 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
20 CHECK(ordinal_meth != NULL);
21 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
22 CHECK(slicedef_meth != NULL);
23 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
24 CHECK(slicedef_cls != NULL);
27 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
30 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
33 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
36 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
37 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
38 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
41 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
42 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
43 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
44 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
47 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
48 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
49 vec->datalen = (*env)->GetArrayLength(env, bytes);
50 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
51 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
54 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
55 LDKTransaction *txdata = (LDKTransaction*)ptr;
57 slice.data = txdata->data;
58 slice.datalen = txdata->datalen;
59 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
61 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
62 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
63 txdata->datalen = (*env)->GetArrayLength(env, bytes);
64 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
65 txdata->data_is_owned = false;
66 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
67 return (uint64_t)txdata;
69 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
70 LDKTransaction *tx = (LDKTransaction*)ptr;
71 tx->data_is_owned = true;
72 Transaction_free(*tx);
75 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
76 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
77 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
79 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
81 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
82 return (uint64_t)vec->datalen;
84 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
85 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
86 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
88 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
90 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
96 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
97 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
98 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
101 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
102 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
103 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
105 typedef jlongArray int64_tArray;
106 typedef jbyteArray int8_tArray;
108 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
109 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
110 char* conv_buf = MALLOC(len + 1, "str conv buf");
111 memcpy(conv_buf, chars, len);
113 jstring ret = (*env)->NewStringUTF(env, conv_buf);
117 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
118 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
119 char* newchars = MALLOC(str_len + 1, "String chars");
120 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
121 memcpy(newchars, jchars, str_len);
122 newchars[str_len] = 0;
123 (*env)->ReleaseStringUTFChars(env, str, jchars);
127 .chars_is_owned = true
132 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
133 return str_ref_to_java(env, "v0.0.98.1", strlen("v0.0.98.1"));
135 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
136 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
139 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
141 static jclass arr_of_B_clz = NULL;
142 static jclass arr_of_J_clz = NULL;
143 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
144 arr_of_B_clz = (*env)->FindClass(env, "[B");
145 CHECK(arr_of_B_clz != NULL);
146 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
147 arr_of_J_clz = (*env)->FindClass(env, "[J");
148 CHECK(arr_of_J_clz != NULL);
149 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
151 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
152 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
153 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
154 case 0: return LDKAccessError_UnknownChain;
155 case 1: return LDKAccessError_UnknownTx;
159 static jclass AccessError_class = NULL;
160 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
161 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
162 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
163 AccessError_class = (*env)->NewGlobalRef(env, clz);
164 CHECK(AccessError_class != NULL);
165 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
166 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
167 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
168 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
170 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
172 case LDKAccessError_UnknownChain:
173 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
174 case LDKAccessError_UnknownTx:
175 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
180 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
181 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
182 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
183 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
187 static jclass ChannelMonitorUpdateErr_class = NULL;
188 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
189 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
190 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
191 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
192 CHECK(ChannelMonitorUpdateErr_class != NULL);
193 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
194 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
195 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
196 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
198 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
200 case LDKChannelMonitorUpdateErr_TemporaryFailure:
201 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
202 case LDKChannelMonitorUpdateErr_PermanentFailure:
203 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
208 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
209 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
210 case 0: return LDKConfirmationTarget_Background;
211 case 1: return LDKConfirmationTarget_Normal;
212 case 2: return LDKConfirmationTarget_HighPriority;
216 static jclass ConfirmationTarget_class = NULL;
217 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
218 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
219 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
220 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
221 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
222 CHECK(ConfirmationTarget_class != NULL);
223 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
224 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
225 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
226 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
227 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
228 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
230 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
232 case LDKConfirmationTarget_Background:
233 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
234 case LDKConfirmationTarget_Normal:
235 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
236 case LDKConfirmationTarget_HighPriority:
237 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
242 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
243 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
244 case 0: return LDKCreationError_DescriptionTooLong;
245 case 1: return LDKCreationError_RouteTooLong;
246 case 2: return LDKCreationError_TimestampOutOfBounds;
247 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
251 static jclass CreationError_class = NULL;
252 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
253 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
254 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
255 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
256 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
257 CreationError_class = (*env)->NewGlobalRef(env, clz);
258 CHECK(CreationError_class != NULL);
259 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
260 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
261 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
262 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
263 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
264 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
265 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
266 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
268 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
270 case LDKCreationError_DescriptionTooLong:
271 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
272 case LDKCreationError_RouteTooLong:
273 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
274 case LDKCreationError_TimestampOutOfBounds:
275 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
276 case LDKCreationError_ExpiryTimeOutOfBounds:
277 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
282 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
283 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
284 case 0: return LDKCurrency_Bitcoin;
285 case 1: return LDKCurrency_BitcoinTestnet;
286 case 2: return LDKCurrency_Regtest;
287 case 3: return LDKCurrency_Simnet;
288 case 4: return LDKCurrency_Signet;
292 static jclass Currency_class = NULL;
293 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
294 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
295 static jfieldID Currency_LDKCurrency_Regtest = NULL;
296 static jfieldID Currency_LDKCurrency_Simnet = NULL;
297 static jfieldID Currency_LDKCurrency_Signet = NULL;
298 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
299 Currency_class = (*env)->NewGlobalRef(env, clz);
300 CHECK(Currency_class != NULL);
301 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
302 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
303 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
304 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
305 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
306 CHECK(Currency_LDKCurrency_Regtest != NULL);
307 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
308 CHECK(Currency_LDKCurrency_Simnet != NULL);
309 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
310 CHECK(Currency_LDKCurrency_Signet != NULL);
312 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
314 case LDKCurrency_Bitcoin:
315 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
316 case LDKCurrency_BitcoinTestnet:
317 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
318 case LDKCurrency_Regtest:
319 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
320 case LDKCurrency_Simnet:
321 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
322 case LDKCurrency_Signet:
323 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
328 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
329 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
330 case 0: return LDKIOError_NotFound;
331 case 1: return LDKIOError_PermissionDenied;
332 case 2: return LDKIOError_ConnectionRefused;
333 case 3: return LDKIOError_ConnectionReset;
334 case 4: return LDKIOError_ConnectionAborted;
335 case 5: return LDKIOError_NotConnected;
336 case 6: return LDKIOError_AddrInUse;
337 case 7: return LDKIOError_AddrNotAvailable;
338 case 8: return LDKIOError_BrokenPipe;
339 case 9: return LDKIOError_AlreadyExists;
340 case 10: return LDKIOError_WouldBlock;
341 case 11: return LDKIOError_InvalidInput;
342 case 12: return LDKIOError_InvalidData;
343 case 13: return LDKIOError_TimedOut;
344 case 14: return LDKIOError_WriteZero;
345 case 15: return LDKIOError_Interrupted;
346 case 16: return LDKIOError_Other;
347 case 17: return LDKIOError_UnexpectedEof;
351 static jclass IOError_class = NULL;
352 static jfieldID IOError_LDKIOError_NotFound = NULL;
353 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
354 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
355 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
356 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
357 static jfieldID IOError_LDKIOError_NotConnected = NULL;
358 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
359 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
360 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
361 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
362 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
363 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
364 static jfieldID IOError_LDKIOError_InvalidData = NULL;
365 static jfieldID IOError_LDKIOError_TimedOut = NULL;
366 static jfieldID IOError_LDKIOError_WriteZero = NULL;
367 static jfieldID IOError_LDKIOError_Interrupted = NULL;
368 static jfieldID IOError_LDKIOError_Other = NULL;
369 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
370 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
371 IOError_class = (*env)->NewGlobalRef(env, clz);
372 CHECK(IOError_class != NULL);
373 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
374 CHECK(IOError_LDKIOError_NotFound != NULL);
375 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
376 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
377 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
378 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
379 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
380 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
381 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
382 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
383 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
384 CHECK(IOError_LDKIOError_NotConnected != NULL);
385 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
386 CHECK(IOError_LDKIOError_AddrInUse != NULL);
387 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
388 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
389 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
390 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
391 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
392 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
393 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
394 CHECK(IOError_LDKIOError_WouldBlock != NULL);
395 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
396 CHECK(IOError_LDKIOError_InvalidInput != NULL);
397 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
398 CHECK(IOError_LDKIOError_InvalidData != NULL);
399 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
400 CHECK(IOError_LDKIOError_TimedOut != NULL);
401 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
402 CHECK(IOError_LDKIOError_WriteZero != NULL);
403 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
404 CHECK(IOError_LDKIOError_Interrupted != NULL);
405 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
406 CHECK(IOError_LDKIOError_Other != NULL);
407 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
408 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
410 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
412 case LDKIOError_NotFound:
413 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
414 case LDKIOError_PermissionDenied:
415 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
416 case LDKIOError_ConnectionRefused:
417 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
418 case LDKIOError_ConnectionReset:
419 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
420 case LDKIOError_ConnectionAborted:
421 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
422 case LDKIOError_NotConnected:
423 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
424 case LDKIOError_AddrInUse:
425 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
426 case LDKIOError_AddrNotAvailable:
427 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
428 case LDKIOError_BrokenPipe:
429 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
430 case LDKIOError_AlreadyExists:
431 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
432 case LDKIOError_WouldBlock:
433 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
434 case LDKIOError_InvalidInput:
435 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
436 case LDKIOError_InvalidData:
437 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
438 case LDKIOError_TimedOut:
439 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
440 case LDKIOError_WriteZero:
441 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
442 case LDKIOError_Interrupted:
443 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
444 case LDKIOError_Other:
445 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
446 case LDKIOError_UnexpectedEof:
447 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
452 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
453 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
454 case 0: return LDKLevel_Off;
455 case 1: return LDKLevel_Error;
456 case 2: return LDKLevel_Warn;
457 case 3: return LDKLevel_Info;
458 case 4: return LDKLevel_Debug;
459 case 5: return LDKLevel_Trace;
463 static jclass Level_class = NULL;
464 static jfieldID Level_LDKLevel_Off = NULL;
465 static jfieldID Level_LDKLevel_Error = NULL;
466 static jfieldID Level_LDKLevel_Warn = NULL;
467 static jfieldID Level_LDKLevel_Info = NULL;
468 static jfieldID Level_LDKLevel_Debug = NULL;
469 static jfieldID Level_LDKLevel_Trace = NULL;
470 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
471 Level_class = (*env)->NewGlobalRef(env, clz);
472 CHECK(Level_class != NULL);
473 Level_LDKLevel_Off = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Off", "Lorg/ldk/enums/Level;");
474 CHECK(Level_LDKLevel_Off != NULL);
475 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
476 CHECK(Level_LDKLevel_Error != NULL);
477 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
478 CHECK(Level_LDKLevel_Warn != NULL);
479 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
480 CHECK(Level_LDKLevel_Info != NULL);
481 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
482 CHECK(Level_LDKLevel_Debug != NULL);
483 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
484 CHECK(Level_LDKLevel_Trace != NULL);
486 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
489 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Off);
491 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
493 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
495 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
497 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
499 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
504 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
505 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
506 case 0: return LDKNetwork_Bitcoin;
507 case 1: return LDKNetwork_Testnet;
508 case 2: return LDKNetwork_Regtest;
509 case 3: return LDKNetwork_Signet;
513 static jclass Network_class = NULL;
514 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
515 static jfieldID Network_LDKNetwork_Testnet = NULL;
516 static jfieldID Network_LDKNetwork_Regtest = NULL;
517 static jfieldID Network_LDKNetwork_Signet = NULL;
518 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
519 Network_class = (*env)->NewGlobalRef(env, clz);
520 CHECK(Network_class != NULL);
521 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
522 CHECK(Network_LDKNetwork_Bitcoin != NULL);
523 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
524 CHECK(Network_LDKNetwork_Testnet != NULL);
525 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
526 CHECK(Network_LDKNetwork_Regtest != NULL);
527 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
528 CHECK(Network_LDKNetwork_Signet != NULL);
530 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
532 case LDKNetwork_Bitcoin:
533 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
534 case LDKNetwork_Testnet:
535 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
536 case LDKNetwork_Regtest:
537 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
538 case LDKNetwork_Signet:
539 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
544 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
545 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
546 case 0: return LDKSecp256k1Error_IncorrectSignature;
547 case 1: return LDKSecp256k1Error_InvalidMessage;
548 case 2: return LDKSecp256k1Error_InvalidPublicKey;
549 case 3: return LDKSecp256k1Error_InvalidSignature;
550 case 4: return LDKSecp256k1Error_InvalidSecretKey;
551 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
552 case 6: return LDKSecp256k1Error_InvalidTweak;
553 case 7: return LDKSecp256k1Error_TweakCheckFailed;
554 case 8: return LDKSecp256k1Error_NotEnoughMemory;
558 static jclass Secp256k1Error_class = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
564 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
565 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
566 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
567 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
568 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
569 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
570 CHECK(Secp256k1Error_class != NULL);
571 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
572 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
573 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
574 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
575 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
576 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
577 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
578 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
579 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
580 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
581 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
582 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
583 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
584 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
585 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
586 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
587 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
588 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
590 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
592 case LDKSecp256k1Error_IncorrectSignature:
593 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
594 case LDKSecp256k1Error_InvalidMessage:
595 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
596 case LDKSecp256k1Error_InvalidPublicKey:
597 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
598 case LDKSecp256k1Error_InvalidSignature:
599 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
600 case LDKSecp256k1Error_InvalidSecretKey:
601 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
602 case LDKSecp256k1Error_InvalidRecoveryId:
603 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
604 case LDKSecp256k1Error_InvalidTweak:
605 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
606 case LDKSecp256k1Error_TweakCheckFailed:
607 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
608 case LDKSecp256k1Error_NotEnoughMemory:
609 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
614 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
615 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
616 case 0: return LDKSemanticError_NoPaymentHash;
617 case 1: return LDKSemanticError_MultiplePaymentHashes;
618 case 2: return LDKSemanticError_NoDescription;
619 case 3: return LDKSemanticError_MultipleDescriptions;
620 case 4: return LDKSemanticError_MultiplePaymentSecrets;
621 case 5: return LDKSemanticError_InvalidFeatures;
622 case 6: return LDKSemanticError_InvalidRecoveryId;
623 case 7: return LDKSemanticError_InvalidSignature;
627 static jclass SemanticError_class = NULL;
628 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
629 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
630 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
631 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
632 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
633 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
634 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
635 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
636 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
637 SemanticError_class = (*env)->NewGlobalRef(env, clz);
638 CHECK(SemanticError_class != NULL);
639 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
640 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
641 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
642 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
643 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
644 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
645 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
646 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
647 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
648 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
649 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
650 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
651 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
652 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
653 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
654 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
656 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
658 case LDKSemanticError_NoPaymentHash:
659 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
660 case LDKSemanticError_MultiplePaymentHashes:
661 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
662 case LDKSemanticError_NoDescription:
663 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
664 case LDKSemanticError_MultipleDescriptions:
665 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
666 case LDKSemanticError_MultiplePaymentSecrets:
667 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
668 case LDKSemanticError_InvalidFeatures:
669 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
670 case LDKSemanticError_InvalidRecoveryId:
671 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
672 case LDKSemanticError_InvalidSignature:
673 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
678 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
679 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
680 case 0: return LDKSiPrefix_Milli;
681 case 1: return LDKSiPrefix_Micro;
682 case 2: return LDKSiPrefix_Nano;
683 case 3: return LDKSiPrefix_Pico;
687 static jclass SiPrefix_class = NULL;
688 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
689 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
690 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
691 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
692 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
693 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
694 CHECK(SiPrefix_class != NULL);
695 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
696 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
697 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
698 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
699 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
700 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
701 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
702 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
704 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
706 case LDKSiPrefix_Milli:
707 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
708 case LDKSiPrefix_Micro:
709 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
710 case LDKSiPrefix_Nano:
711 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
712 case LDKSiPrefix_Pico:
713 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
719 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
720 ret->datalen = (*env)->GetArrayLength(env, elems);
721 if (ret->datalen == 0) {
724 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
725 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
726 for (size_t i = 0; i < ret->datalen; i++) {
727 ret->data[i] = java_elems[i];
729 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
731 return (uint64_t)ret;
733 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
734 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
735 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
739 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
742 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
743 CHECK(val->result_ok);
744 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
745 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
748 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
749 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
750 CHECK(!val->result_ok);
751 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
755 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
758 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
759 CHECK(val->result_ok);
760 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
761 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
764 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
765 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
766 CHECK(!val->result_ok);
767 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
770 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
771 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
774 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
775 CHECK(val->result_ok);
776 LDKTxCreationKeys res_var = (*val->contents.result);
777 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
778 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
779 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
783 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
784 CHECK(!val->result_ok);
785 LDKDecodeError err_var = (*val->contents.err);
786 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
787 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
788 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
792 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
795 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
796 CHECK(val->result_ok);
797 LDKChannelPublicKeys res_var = (*val->contents.result);
798 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
799 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
800 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
804 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
805 CHECK(!val->result_ok);
806 LDKDecodeError err_var = (*val->contents.err);
807 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
808 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
809 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
813 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
816 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
817 CHECK(val->result_ok);
818 LDKTxCreationKeys res_var = (*val->contents.result);
819 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
820 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
821 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
824 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
825 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
826 CHECK(!val->result_ok);
827 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
830 static jclass LDKCOption_u32Z_Some_class = NULL;
831 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
832 static jclass LDKCOption_u32Z_None_class = NULL;
833 static jmethodID LDKCOption_u32Z_None_meth = NULL;
834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
835 LDKCOption_u32Z_Some_class =
836 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
837 CHECK(LDKCOption_u32Z_Some_class != NULL);
838 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
839 CHECK(LDKCOption_u32Z_Some_meth != NULL);
840 LDKCOption_u32Z_None_class =
841 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
842 CHECK(LDKCOption_u32Z_None_class != NULL);
843 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
844 CHECK(LDKCOption_u32Z_None_meth != NULL);
846 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
847 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
849 case LDKCOption_u32Z_Some: {
850 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
852 case LDKCOption_u32Z_None: {
853 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
859 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
862 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
863 CHECK(val->result_ok);
864 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
865 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
866 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
867 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
871 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
872 CHECK(!val->result_ok);
873 LDKDecodeError err_var = (*val->contents.err);
874 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
875 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
876 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
880 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
883 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
884 CHECK(val->result_ok);
885 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
886 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
887 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
888 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
892 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
893 CHECK(!val->result_ok);
894 LDKDecodeError err_var = (*val->contents.err);
895 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
896 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
897 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
901 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
904 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
905 CHECK(val->result_ok);
906 LDKChannelTransactionParameters res_var = (*val->contents.result);
907 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
908 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
909 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
913 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
914 CHECK(!val->result_ok);
915 LDKDecodeError err_var = (*val->contents.err);
916 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
917 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
918 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
922 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
925 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
926 CHECK(val->result_ok);
927 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
928 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
929 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
930 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
934 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
935 CHECK(!val->result_ok);
936 LDKDecodeError err_var = (*val->contents.err);
937 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
938 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
939 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
943 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
946 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
947 CHECK(val->result_ok);
948 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
949 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
950 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
951 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
955 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
956 CHECK(!val->result_ok);
957 LDKDecodeError err_var = (*val->contents.err);
958 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
959 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
960 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
964 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
967 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
968 CHECK(val->result_ok);
969 LDKCommitmentTransaction res_var = (*val->contents.result);
970 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
971 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
972 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
976 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
977 CHECK(!val->result_ok);
978 LDKDecodeError err_var = (*val->contents.err);
979 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
980 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
981 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
985 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
988 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
989 CHECK(val->result_ok);
990 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
991 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
992 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
993 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
997 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
998 CHECK(!val->result_ok);
999 return *val->contents.err;
1001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1002 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1004 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1005 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1006 CHECK(val->result_ok);
1007 LDKCVec_SignatureZ res_var = (*val->contents.result);
1008 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1010 for (size_t i = 0; i < res_var.datalen; i++) {
1011 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1012 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1013 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1018 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1019 CHECK(!val->result_ok);
1020 return *val->contents.err;
1022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1023 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1026 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1027 CHECK(val->result_ok);
1028 return *val->contents.result;
1030 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1031 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1032 CHECK(!val->result_ok);
1033 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1037 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1040 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1041 CHECK(val->result_ok);
1042 LDKRouteHop res_var = (*val->contents.result);
1043 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1044 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1045 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1049 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1050 CHECK(!val->result_ok);
1051 LDKDecodeError err_var = (*val->contents.err);
1052 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1058 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1059 ret->datalen = (*env)->GetArrayLength(env, elems);
1060 if (ret->datalen == 0) {
1063 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1064 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1065 for (size_t i = 0; i < ret->datalen; i++) {
1066 int64_t arr_elem = java_elems[i];
1067 LDKRouteHop arr_elem_conv;
1068 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1069 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1070 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1071 ret->data[i] = arr_elem_conv;
1073 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1075 return (uint64_t)ret;
1077 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1078 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1079 for (size_t i = 0; i < ret.datalen; i++) {
1080 ret.data[i] = RouteHop_clone(&orig->data[i]);
1084 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1085 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1086 for (size_t i = 0; i < ret.datalen; i++) {
1087 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1092 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1095 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1096 CHECK(val->result_ok);
1097 LDKRoute res_var = (*val->contents.result);
1098 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1099 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1100 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1104 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1105 CHECK(!val->result_ok);
1106 LDKDecodeError err_var = (*val->contents.err);
1107 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1108 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1109 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1112 static jclass LDKCOption_u64Z_Some_class = NULL;
1113 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1114 static jclass LDKCOption_u64Z_None_class = NULL;
1115 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1117 LDKCOption_u64Z_Some_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1119 CHECK(LDKCOption_u64Z_Some_class != NULL);
1120 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1121 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1122 LDKCOption_u64Z_None_class =
1123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1124 CHECK(LDKCOption_u64Z_None_class != NULL);
1125 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1126 CHECK(LDKCOption_u64Z_None_meth != NULL);
1128 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1129 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1131 case LDKCOption_u64Z_Some: {
1132 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1134 case LDKCOption_u64Z_None: {
1135 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1141 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1142 ret->datalen = (*env)->GetArrayLength(env, elems);
1143 if (ret->datalen == 0) {
1146 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1147 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1148 for (size_t i = 0; i < ret->datalen; i++) {
1149 int64_t arr_elem = java_elems[i];
1150 LDKChannelDetails arr_elem_conv;
1151 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1152 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1153 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1154 ret->data[i] = arr_elem_conv;
1156 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1158 return (uint64_t)ret;
1160 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1161 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1162 for (size_t i = 0; i < ret.datalen; i++) {
1163 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1168 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1169 ret->datalen = (*env)->GetArrayLength(env, elems);
1170 if (ret->datalen == 0) {
1173 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1174 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1175 for (size_t i = 0; i < ret->datalen; i++) {
1176 int64_t arr_elem = java_elems[i];
1177 LDKRouteHint arr_elem_conv;
1178 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1179 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1180 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1181 ret->data[i] = arr_elem_conv;
1183 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1185 return (uint64_t)ret;
1187 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1188 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1189 for (size_t i = 0; i < ret.datalen; i++) {
1190 ret.data[i] = RouteHint_clone(&orig->data[i]);
1194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1195 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1198 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1199 CHECK(val->result_ok);
1200 LDKRoute res_var = (*val->contents.result);
1201 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1202 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1203 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1207 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1208 CHECK(!val->result_ok);
1209 LDKLightningError err_var = (*val->contents.err);
1210 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1211 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1212 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1216 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1219 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1220 CHECK(val->result_ok);
1221 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1222 return (uint64_t)res_ref;
1224 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1225 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1226 CHECK(!val->result_ok);
1227 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1231 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1233 LDKTransaction b_ref;
1234 b_ref.datalen = (*env)->GetArrayLength(env, b);
1235 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1236 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1237 b_ref.data_is_owned = false;
1239 return (uint64_t)ret;
1241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1242 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1246 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1247 LDKTransaction b_var = tuple->b;
1248 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1249 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1253 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1254 ret->datalen = (*env)->GetArrayLength(env, elems);
1255 if (ret->datalen == 0) {
1258 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1259 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1260 for (size_t i = 0; i < ret->datalen; i++) {
1261 int64_t arr_elem = java_elems[i];
1262 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1263 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1264 ret->data[i] = arr_elem_conv;
1266 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1268 return (uint64_t)ret;
1270 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1271 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1272 for (size_t i = 0; i < ret.datalen; i++) {
1273 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1277 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1278 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1279 for (size_t i = 0; i < ret.datalen; i++) {
1280 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1285 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1288 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1289 CHECK(val->result_ok);
1290 return *val->contents.result;
1292 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1293 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1294 CHECK(!val->result_ok);
1295 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1298 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1299 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1300 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1301 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1303 LDKMonitorEvent_HTLCEvent_class =
1304 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1305 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1306 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1307 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1308 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1309 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1310 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1311 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1312 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1314 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1315 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1317 case LDKMonitorEvent_HTLCEvent: {
1318 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1319 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1320 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1321 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1322 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1324 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1325 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1326 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1327 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1328 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1329 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1335 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1336 ret->datalen = (*env)->GetArrayLength(env, elems);
1337 if (ret->datalen == 0) {
1340 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1341 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1342 for (size_t i = 0; i < ret->datalen; i++) {
1343 int64_t arr_elem = java_elems[i];
1344 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1345 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1346 ret->data[i] = arr_elem_conv;
1348 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1350 return (uint64_t)ret;
1352 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1353 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1354 for (size_t i = 0; i < ret.datalen; i++) {
1355 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1359 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1360 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1361 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1362 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1364 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1365 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1366 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1367 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1368 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1369 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1370 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1371 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1372 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1373 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1375 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1376 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1378 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1379 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1380 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1382 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1383 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1388 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1389 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1390 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1391 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1392 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1393 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1395 LDKSpendableOutputDescriptor_StaticOutput_class =
1396 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1397 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1398 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1399 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1400 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1401 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1402 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1403 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1404 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1405 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1406 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1407 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1408 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1409 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1411 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1412 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1414 case LDKSpendableOutputDescriptor_StaticOutput: {
1415 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1416 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1417 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1418 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1419 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1420 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1422 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1423 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1424 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1425 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1426 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1427 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1429 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1430 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1431 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1432 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1433 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1434 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1440 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1441 ret->datalen = (*env)->GetArrayLength(env, elems);
1442 if (ret->datalen == 0) {
1445 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1446 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1447 for (size_t i = 0; i < ret->datalen; i++) {
1448 int64_t arr_elem = java_elems[i];
1449 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1450 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1451 ret->data[i] = arr_elem_conv;
1453 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1455 return (uint64_t)ret;
1457 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1458 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1459 for (size_t i = 0; i < ret.datalen; i++) {
1460 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1464 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1465 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1466 static jclass LDKErrorAction_IgnoreError_class = NULL;
1467 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1468 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1469 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1471 LDKErrorAction_DisconnectPeer_class =
1472 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1473 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1474 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1475 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1476 LDKErrorAction_IgnoreError_class =
1477 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1478 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1479 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1480 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1481 LDKErrorAction_SendErrorMessage_class =
1482 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1483 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1484 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1485 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1487 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1488 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1490 case LDKErrorAction_DisconnectPeer: {
1491 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1492 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1493 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1494 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1495 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1497 case LDKErrorAction_IgnoreError: {
1498 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1500 case LDKErrorAction_SendErrorMessage: {
1501 LDKErrorMessage msg_var = obj->send_error_message.msg;
1502 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1503 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1504 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1505 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1510 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1511 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1512 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1513 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1514 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1515 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1517 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1518 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1519 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1520 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1521 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1522 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1523 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1524 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1525 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1526 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1527 LDKHTLCFailChannelUpdate_NodeFailure_class =
1528 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1529 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1530 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1531 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1533 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1534 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1536 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1537 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1538 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1539 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1540 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1541 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1543 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1544 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1546 case LDKHTLCFailChannelUpdate_NodeFailure: {
1547 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1548 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1549 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1554 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1555 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1556 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1557 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1558 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1559 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1560 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1561 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1562 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1563 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1564 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1565 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1566 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1567 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1568 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1569 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1570 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1571 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1572 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1573 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1574 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1575 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1576 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1577 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1578 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1579 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1580 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1581 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1582 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1583 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1584 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1585 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1586 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1587 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1588 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1589 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1590 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1591 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1593 LDKMessageSendEvent_SendAcceptChannel_class =
1594 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1595 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1596 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1597 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1598 LDKMessageSendEvent_SendOpenChannel_class =
1599 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1600 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1601 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1602 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1603 LDKMessageSendEvent_SendFundingCreated_class =
1604 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1605 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1606 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1607 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1608 LDKMessageSendEvent_SendFundingSigned_class =
1609 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1610 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1611 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1612 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1613 LDKMessageSendEvent_SendFundingLocked_class =
1614 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1615 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1616 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1617 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1618 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1619 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1620 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1621 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1622 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1623 LDKMessageSendEvent_UpdateHTLCs_class =
1624 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1625 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1626 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1627 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1628 LDKMessageSendEvent_SendRevokeAndACK_class =
1629 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1630 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1631 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1632 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1633 LDKMessageSendEvent_SendClosingSigned_class =
1634 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1635 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1636 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1637 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1638 LDKMessageSendEvent_SendShutdown_class =
1639 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1640 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1641 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1642 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1643 LDKMessageSendEvent_SendChannelReestablish_class =
1644 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1645 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1646 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1647 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1648 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1649 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1650 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1651 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1652 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1653 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1654 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1655 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1656 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1657 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1658 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1659 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1660 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1661 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1662 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1663 LDKMessageSendEvent_HandleError_class =
1664 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1665 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1666 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1667 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1668 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1669 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1670 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1671 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1672 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1673 LDKMessageSendEvent_SendChannelRangeQuery_class =
1674 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1675 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1676 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1677 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1678 LDKMessageSendEvent_SendShortIdsQuery_class =
1679 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1680 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1681 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1682 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1683 LDKMessageSendEvent_SendReplyChannelRange_class =
1684 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1685 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1686 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1687 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1689 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1690 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1692 case LDKMessageSendEvent_SendAcceptChannel: {
1693 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1694 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1695 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1696 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1697 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1698 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1699 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1701 case LDKMessageSendEvent_SendOpenChannel: {
1702 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1703 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1704 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1705 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1706 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1707 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1708 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1710 case LDKMessageSendEvent_SendFundingCreated: {
1711 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1712 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1713 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1714 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1715 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1716 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1717 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1719 case LDKMessageSendEvent_SendFundingSigned: {
1720 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1721 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1722 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1723 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1724 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1725 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1726 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1728 case LDKMessageSendEvent_SendFundingLocked: {
1729 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1730 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1731 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1732 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1733 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1734 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1735 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1737 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1738 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1739 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1740 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1741 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1742 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1743 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1744 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1746 case LDKMessageSendEvent_UpdateHTLCs: {
1747 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1748 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1749 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1750 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1751 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1752 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1753 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1755 case LDKMessageSendEvent_SendRevokeAndACK: {
1756 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1757 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1758 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1759 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1760 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1761 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1762 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1764 case LDKMessageSendEvent_SendClosingSigned: {
1765 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1766 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1767 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1768 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1769 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1770 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1771 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1773 case LDKMessageSendEvent_SendShutdown: {
1774 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1775 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1776 LDKShutdown msg_var = obj->send_shutdown.msg;
1777 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1778 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1779 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1780 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1782 case LDKMessageSendEvent_SendChannelReestablish: {
1783 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1784 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1785 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1786 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1787 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1788 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1789 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1791 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1792 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1793 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1794 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1795 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1796 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1797 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1798 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1799 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1800 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1802 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1803 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1804 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1805 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1806 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1807 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1809 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1810 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1811 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1812 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1813 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1814 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1816 case LDKMessageSendEvent_HandleError: {
1817 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1818 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1819 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1820 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1822 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1823 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1824 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1826 case LDKMessageSendEvent_SendChannelRangeQuery: {
1827 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1828 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1829 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1830 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1831 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1832 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1833 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1835 case LDKMessageSendEvent_SendShortIdsQuery: {
1836 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1837 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1838 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1839 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1840 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1841 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1842 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1844 case LDKMessageSendEvent_SendReplyChannelRange: {
1845 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1846 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1847 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1848 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1849 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1850 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1851 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1857 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1858 ret->datalen = (*env)->GetArrayLength(env, elems);
1859 if (ret->datalen == 0) {
1862 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1863 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1864 for (size_t i = 0; i < ret->datalen; i++) {
1865 int64_t arr_elem = java_elems[i];
1866 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1867 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1868 ret->data[i] = arr_elem_conv;
1870 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1872 return (uint64_t)ret;
1874 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1875 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1876 for (size_t i = 0; i < ret.datalen; i++) {
1877 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1882 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1885 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1886 CHECK(val->result_ok);
1887 LDKInitFeatures res_var = (*val->contents.result);
1888 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1889 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1890 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1894 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1895 CHECK(!val->result_ok);
1896 LDKDecodeError err_var = (*val->contents.err);
1897 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1898 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1899 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1903 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1906 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1907 CHECK(val->result_ok);
1908 LDKNodeFeatures res_var = (*val->contents.result);
1909 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1910 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1911 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1915 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1916 CHECK(!val->result_ok);
1917 LDKDecodeError err_var = (*val->contents.err);
1918 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1919 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1920 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1924 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1927 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1928 CHECK(val->result_ok);
1929 LDKChannelFeatures res_var = (*val->contents.result);
1930 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1931 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1932 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1936 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1937 CHECK(!val->result_ok);
1938 LDKDecodeError err_var = (*val->contents.err);
1939 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1940 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1941 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1945 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1948 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1949 CHECK(val->result_ok);
1950 LDKInvoiceFeatures res_var = (*val->contents.result);
1951 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1952 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1953 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1957 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1958 CHECK(!val->result_ok);
1959 LDKDecodeError err_var = (*val->contents.err);
1960 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1961 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1962 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1966 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1969 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1970 CHECK(val->result_ok);
1971 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1972 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1973 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1974 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1978 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1979 CHECK(!val->result_ok);
1980 LDKDecodeError err_var = (*val->contents.err);
1981 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1982 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1983 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1987 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1990 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1991 CHECK(val->result_ok);
1992 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1993 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1994 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1995 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1999 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2000 CHECK(!val->result_ok);
2001 LDKDecodeError err_var = (*val->contents.err);
2002 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2003 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2004 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2008 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2011 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2012 CHECK(val->result_ok);
2013 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2017 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2018 CHECK(!val->result_ok);
2019 LDKDecodeError err_var = (*val->contents.err);
2020 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2021 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2022 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2026 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2028 CHECK((*env)->GetArrayLength(env, a) == 64);
2029 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2031 LDKCVec_SignatureZ b_constr;
2032 b_constr.datalen = (*env)->GetArrayLength(env, b);
2033 if (b_constr.datalen > 0)
2034 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2036 b_constr.data = NULL;
2037 for (size_t i = 0; i < b_constr.datalen; i++) {
2038 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2039 LDKSignature b_conv_8_ref;
2040 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2041 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2042 b_constr.data[i] = b_conv_8_ref;
2045 return (uint64_t)ret;
2047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2048 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2049 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2050 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2053 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2054 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2055 LDKCVec_SignatureZ b_var = tuple->b;
2056 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2058 for (size_t i = 0; i < b_var.datalen; i++) {
2059 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2060 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2061 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2066 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2069 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2070 CHECK(val->result_ok);
2071 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2075 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2076 CHECK(!val->result_ok);
2077 return *val->contents.err;
2079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2080 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2083 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2084 CHECK(val->result_ok);
2085 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2086 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2090 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2091 CHECK(!val->result_ok);
2092 return *val->contents.err;
2094 typedef struct LDKBaseSign_JCalls {
2095 atomic_size_t refcnt;
2098 jmethodID get_per_commitment_point_meth;
2099 jmethodID release_commitment_secret_meth;
2100 jmethodID channel_keys_id_meth;
2101 jmethodID sign_counterparty_commitment_meth;
2102 jmethodID sign_holder_commitment_and_htlcs_meth;
2103 jmethodID sign_justice_revoked_output_meth;
2104 jmethodID sign_justice_revoked_htlc_meth;
2105 jmethodID sign_counterparty_htlc_transaction_meth;
2106 jmethodID sign_closing_transaction_meth;
2107 jmethodID sign_channel_announcement_meth;
2108 jmethodID ready_channel_meth;
2109 } LDKBaseSign_JCalls;
2110 static void LDKBaseSign_JCalls_free(void* this_arg) {
2111 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2112 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2114 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2115 if (get_jenv_res == JNI_EDETACHED) {
2116 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2118 DO_ASSERT(get_jenv_res == JNI_OK);
2120 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2121 if (get_jenv_res == JNI_EDETACHED) {
2122 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2127 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2128 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2130 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2131 if (get_jenv_res == JNI_EDETACHED) {
2132 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2134 DO_ASSERT(get_jenv_res == JNI_OK);
2136 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2138 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2139 LDKPublicKey ret_ref;
2140 CHECK((*env)->GetArrayLength(env, ret) == 33);
2141 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2142 if (get_jenv_res == JNI_EDETACHED) {
2143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2147 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2148 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2150 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2151 if (get_jenv_res == JNI_EDETACHED) {
2152 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2154 DO_ASSERT(get_jenv_res == JNI_OK);
2156 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2158 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2159 LDKThirtyTwoBytes ret_ref;
2160 CHECK((*env)->GetArrayLength(env, ret) == 32);
2161 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2162 if (get_jenv_res == JNI_EDETACHED) {
2163 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2167 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2168 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2170 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2171 if (get_jenv_res == JNI_EDETACHED) {
2172 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2174 DO_ASSERT(get_jenv_res == JNI_OK);
2176 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2178 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2179 LDKThirtyTwoBytes ret_ref;
2180 CHECK((*env)->GetArrayLength(env, ret) == 32);
2181 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2182 if (get_jenv_res == JNI_EDETACHED) {
2183 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2187 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2188 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2190 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2191 if (get_jenv_res == JNI_EDETACHED) {
2192 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2194 DO_ASSERT(get_jenv_res == JNI_OK);
2196 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2197 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2198 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2199 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2200 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2201 if (commitment_tx_var.is_owned) {
2202 commitment_tx_ref |= 1;
2204 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2206 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2207 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2208 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2209 if (get_jenv_res == JNI_EDETACHED) {
2210 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2214 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2215 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2217 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2218 if (get_jenv_res == JNI_EDETACHED) {
2219 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2221 DO_ASSERT(get_jenv_res == JNI_OK);
2223 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2224 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2225 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2226 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2227 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2228 if (commitment_tx_var.is_owned) {
2229 commitment_tx_ref |= 1;
2231 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2233 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2234 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2235 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2236 if (get_jenv_res == JNI_EDETACHED) {
2237 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2241 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2242 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2244 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2245 if (get_jenv_res == JNI_EDETACHED) {
2246 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2248 DO_ASSERT(get_jenv_res == JNI_OK);
2250 LDKTransaction justice_tx_var = justice_tx;
2251 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2252 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2253 Transaction_free(justice_tx_var);
2254 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2255 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2256 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2258 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2259 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2260 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2261 if (get_jenv_res == JNI_EDETACHED) {
2262 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2266 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2267 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2269 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2270 if (get_jenv_res == JNI_EDETACHED) {
2271 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2273 DO_ASSERT(get_jenv_res == JNI_OK);
2275 LDKTransaction justice_tx_var = justice_tx;
2276 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2277 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2278 Transaction_free(justice_tx_var);
2279 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2280 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2281 LDKHTLCOutputInCommitment htlc_var = *htlc;
2282 htlc_var = HTLCOutputInCommitment_clone(htlc);
2283 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2284 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2285 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2286 if (htlc_var.is_owned) {
2289 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2291 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2292 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2293 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2294 if (get_jenv_res == JNI_EDETACHED) {
2295 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2299 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2300 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2302 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2303 if (get_jenv_res == JNI_EDETACHED) {
2304 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2306 DO_ASSERT(get_jenv_res == JNI_OK);
2308 LDKTransaction htlc_tx_var = htlc_tx;
2309 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2310 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2311 Transaction_free(htlc_tx_var);
2312 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2313 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2314 LDKHTLCOutputInCommitment htlc_var = *htlc;
2315 htlc_var = HTLCOutputInCommitment_clone(htlc);
2316 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2317 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2318 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2319 if (htlc_var.is_owned) {
2322 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2324 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2325 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2326 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2327 if (get_jenv_res == JNI_EDETACHED) {
2328 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2332 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2333 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2335 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2336 if (get_jenv_res == JNI_EDETACHED) {
2337 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2339 DO_ASSERT(get_jenv_res == JNI_OK);
2341 LDKTransaction closing_tx_var = closing_tx;
2342 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2343 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2344 Transaction_free(closing_tx_var);
2345 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2347 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2348 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2349 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2350 if (get_jenv_res == JNI_EDETACHED) {
2351 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2355 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2356 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2358 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2359 if (get_jenv_res == JNI_EDETACHED) {
2360 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2362 DO_ASSERT(get_jenv_res == JNI_OK);
2364 LDKUnsignedChannelAnnouncement msg_var = *msg;
2365 msg_var = UnsignedChannelAnnouncement_clone(msg);
2366 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2367 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2368 uint64_t msg_ref = (uint64_t)msg_var.inner;
2369 if (msg_var.is_owned) {
2372 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2374 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2375 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2376 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2377 if (get_jenv_res == JNI_EDETACHED) {
2378 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2382 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2383 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2385 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2386 if (get_jenv_res == JNI_EDETACHED) {
2387 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2389 DO_ASSERT(get_jenv_res == JNI_OK);
2391 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2392 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2393 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2394 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2395 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2396 if (channel_parameters_var.is_owned) {
2397 channel_parameters_ref |= 1;
2399 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2401 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2402 if (get_jenv_res == JNI_EDETACHED) {
2403 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2406 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
2407 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2408 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2409 return (void*) this_arg;
2411 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2412 jclass c = (*env)->GetObjectClass(env, o);
2414 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2415 atomic_init(&calls->refcnt, 1);
2416 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2417 calls->o = (*env)->NewWeakGlobalRef(env, o);
2418 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2419 CHECK(calls->get_per_commitment_point_meth != NULL);
2420 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2421 CHECK(calls->release_commitment_secret_meth != NULL);
2422 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2423 CHECK(calls->channel_keys_id_meth != NULL);
2424 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2425 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2426 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2427 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2428 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2429 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2430 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2431 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2432 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2433 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2434 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2435 CHECK(calls->sign_closing_transaction_meth != NULL);
2436 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2437 CHECK(calls->sign_channel_announcement_meth != NULL);
2438 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2439 CHECK(calls->ready_channel_meth != NULL);
2441 LDKChannelPublicKeys pubkeys_conv;
2442 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2443 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2444 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2447 .this_arg = (void*) calls,
2448 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2449 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2450 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2451 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2452 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2453 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2454 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2455 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2456 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2457 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2458 .ready_channel = ready_channel_LDKBaseSign_jcall,
2459 .free = LDKBaseSign_JCalls_free,
2460 .pubkeys = pubkeys_conv,
2461 .set_pubkeys = NULL,
2465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2466 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2467 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2468 return (uint64_t)res_ptr;
2470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2471 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2472 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2473 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2478 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2479 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2480 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2485 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2486 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2487 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2492 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2493 LDKCommitmentTransaction commitment_tx_conv;
2494 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2495 commitment_tx_conv.is_owned = false;
2496 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2497 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2498 return (uint64_t)ret_conv;
2501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2502 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2503 LDKHolderCommitmentTransaction commitment_tx_conv;
2504 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2505 commitment_tx_conv.is_owned = false;
2506 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2507 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2508 return (uint64_t)ret_conv;
2511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2512 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2513 LDKTransaction justice_tx_ref;
2514 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2515 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2516 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2517 justice_tx_ref.data_is_owned = true;
2518 unsigned char per_commitment_key_arr[32];
2519 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2520 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2521 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2522 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2523 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2524 return (uint64_t)ret_conv;
2527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
2528 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2529 LDKTransaction justice_tx_ref;
2530 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2531 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2532 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2533 justice_tx_ref.data_is_owned = true;
2534 unsigned char per_commitment_key_arr[32];
2535 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2536 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2537 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2538 LDKHTLCOutputInCommitment htlc_conv;
2539 htlc_conv.inner = (void*)(htlc & (~1));
2540 htlc_conv.is_owned = false;
2541 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2542 *ret_conv = (this_arg_conv->sign_justice_revoked_htlc)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2543 return (uint64_t)ret_conv;
2546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
2547 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2548 LDKTransaction htlc_tx_ref;
2549 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2550 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2551 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2552 htlc_tx_ref.data_is_owned = true;
2553 LDKPublicKey per_commitment_point_ref;
2554 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2555 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2556 LDKHTLCOutputInCommitment htlc_conv;
2557 htlc_conv.inner = (void*)(htlc & (~1));
2558 htlc_conv.is_owned = false;
2559 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2560 *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);
2561 return (uint64_t)ret_conv;
2564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2565 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2566 LDKTransaction closing_tx_ref;
2567 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2568 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2569 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2570 closing_tx_ref.data_is_owned = true;
2571 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2572 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2573 return (uint64_t)ret_conv;
2576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2577 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2578 LDKUnsignedChannelAnnouncement msg_conv;
2579 msg_conv.inner = (void*)(msg & (~1));
2580 msg_conv.is_owned = false;
2581 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2582 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2583 return (uint64_t)ret_conv;
2586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2587 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2588 LDKChannelTransactionParameters channel_parameters_conv;
2589 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2590 channel_parameters_conv.is_owned = false;
2591 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2594 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2595 if (this_arg->set_pubkeys != NULL)
2596 this_arg->set_pubkeys(this_arg);
2597 return this_arg->pubkeys;
2599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2600 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2601 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2604 uint64_t ret_ref = (uint64_t)ret_var.inner;
2605 if (ret_var.is_owned) {
2611 typedef struct LDKSign_JCalls {
2612 atomic_size_t refcnt;
2615 LDKBaseSign_JCalls* BaseSign;
2616 jmethodID write_meth;
2618 static void LDKSign_JCalls_free(void* this_arg) {
2619 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2620 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2622 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2623 if (get_jenv_res == JNI_EDETACHED) {
2624 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2626 DO_ASSERT(get_jenv_res == JNI_OK);
2628 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2629 if (get_jenv_res == JNI_EDETACHED) {
2630 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2635 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2636 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2638 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2639 if (get_jenv_res == JNI_EDETACHED) {
2640 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2642 DO_ASSERT(get_jenv_res == JNI_OK);
2644 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2646 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2647 LDKCVec_u8Z ret_ref;
2648 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2649 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2650 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2651 if (get_jenv_res == JNI_EDETACHED) {
2652 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2656 static void* LDKSign_JCalls_clone(const void* this_arg) {
2657 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2658 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2659 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2660 return (void*) this_arg;
2662 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2663 jclass c = (*env)->GetObjectClass(env, o);
2665 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2666 atomic_init(&calls->refcnt, 1);
2667 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2668 calls->o = (*env)->NewWeakGlobalRef(env, o);
2669 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2670 CHECK(calls->write_meth != NULL);
2672 LDKChannelPublicKeys pubkeys_conv;
2673 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2674 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2675 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2678 .this_arg = (void*) calls,
2679 .write = write_LDKSign_jcall,
2680 .clone = LDKSign_JCalls_clone,
2681 .free = LDKSign_JCalls_free,
2682 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2684 calls->BaseSign = ret.BaseSign.this_arg;
2687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2688 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2689 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2690 return (uint64_t)res_ptr;
2692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2693 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2694 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2695 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2696 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2697 CVec_u8Z_free(ret_var);
2701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2702 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2705 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2706 CHECK(val->result_ok);
2707 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2708 *ret = Sign_clone(&(*val->contents.result));
2709 return (uint64_t)ret;
2711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2712 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2713 CHECK(!val->result_ok);
2714 LDKDecodeError err_var = (*val->contents.err);
2715 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2716 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2717 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2721 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2724 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2725 CHECK(val->result_ok);
2726 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2727 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2731 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2732 CHECK(!val->result_ok);
2733 return *val->contents.err;
2735 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2736 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2737 for (size_t i = 0; i < ret.datalen; i++) {
2738 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2743 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2745 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2746 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2747 CHECK(val->result_ok);
2748 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2749 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2751 for (size_t i = 0; i < res_var.datalen; i++) {
2752 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2753 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2754 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2755 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2760 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2761 CHECK(!val->result_ok);
2762 return *val->contents.err;
2764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2765 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2768 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2769 CHECK(val->result_ok);
2770 LDKInMemorySigner res_var = (*val->contents.result);
2771 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2772 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2773 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2777 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2778 CHECK(!val->result_ok);
2779 LDKDecodeError err_var = (*val->contents.err);
2780 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2781 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2782 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2786 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2787 ret->datalen = (*env)->GetArrayLength(env, elems);
2788 if (ret->datalen == 0) {
2791 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2792 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2793 for (size_t i = 0; i < ret->datalen; i++) {
2794 int64_t arr_elem = java_elems[i];
2795 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2796 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2797 ret->data[i] = arr_elem_conv;
2799 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2801 return (uint64_t)ret;
2803 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2804 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2805 for (size_t i = 0; i < ret.datalen; i++) {
2806 ret.data[i] = TxOut_clone(&orig->data[i]);
2810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2811 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2814 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2815 CHECK(val->result_ok);
2816 LDKTransaction res_var = (*val->contents.result);
2817 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2818 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2822 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2823 CHECK(!val->result_ok);
2824 return *val->contents.err;
2826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2827 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2828 LDKThirtyTwoBytes a_ref;
2829 CHECK((*env)->GetArrayLength(env, a) == 32);
2830 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2832 LDKChannelMonitor b_conv;
2833 b_conv.inner = (void*)(b & (~1));
2834 b_conv.is_owned = (b & 1) || (b == 0);
2835 b_conv = ChannelMonitor_clone(&b_conv);
2837 return (uint64_t)ret;
2839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2840 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2841 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2842 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2846 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2847 LDKChannelMonitor b_var = tuple->b;
2848 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2849 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2850 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2854 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2855 ret->datalen = (*env)->GetArrayLength(env, elems);
2856 if (ret->datalen == 0) {
2859 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2860 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2861 for (size_t i = 0; i < ret->datalen; i++) {
2862 int64_t arr_elem = java_elems[i];
2863 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2864 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2865 ret->data[i] = arr_elem_conv;
2867 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2869 return (uint64_t)ret;
2871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2872 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2874 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2875 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2876 CHECK(val->result_ok);
2877 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2878 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
2879 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
2880 for (size_t i = 0; i < res_var.datalen; i++) {
2881 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
2882 res_arr_ptr[i] = res_conv_34_ref;
2884 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
2887 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2888 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2889 CHECK(!val->result_ok);
2890 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
2893 static jclass LDKAPIError_APIMisuseError_class = NULL;
2894 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2895 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2896 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2897 static jclass LDKAPIError_RouteError_class = NULL;
2898 static jmethodID LDKAPIError_RouteError_meth = NULL;
2899 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2900 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2901 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2902 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2904 LDKAPIError_APIMisuseError_class =
2905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2906 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2907 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
2908 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2909 LDKAPIError_FeeRateTooHigh_class =
2910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2911 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2912 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
2913 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2914 LDKAPIError_RouteError_class =
2915 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2916 CHECK(LDKAPIError_RouteError_class != NULL);
2917 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2918 CHECK(LDKAPIError_RouteError_meth != NULL);
2919 LDKAPIError_ChannelUnavailable_class =
2920 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2921 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2922 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
2923 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2924 LDKAPIError_MonitorUpdateFailed_class =
2925 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2926 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2927 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2928 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2930 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2931 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2933 case LDKAPIError_APIMisuseError: {
2934 LDKStr err_str = obj->api_misuse_error.err;
2935 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2936 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
2938 case LDKAPIError_FeeRateTooHigh: {
2939 LDKStr err_str = obj->fee_rate_too_high.err;
2940 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2941 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
2943 case LDKAPIError_RouteError: {
2944 LDKStr err_str = obj->route_error.err;
2945 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2946 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2948 case LDKAPIError_ChannelUnavailable: {
2949 LDKStr err_str = obj->channel_unavailable.err;
2950 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2951 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
2953 case LDKAPIError_MonitorUpdateFailed: {
2954 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2960 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2963 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2964 CHECK(val->result_ok);
2965 return *val->contents.result;
2967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2968 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2969 CHECK(!val->result_ok);
2970 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2974 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2975 ret->datalen = (*env)->GetArrayLength(env, elems);
2976 if (ret->datalen == 0) {
2979 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2980 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2981 for (size_t i = 0; i < ret->datalen; i++) {
2982 int64_t arr_elem = java_elems[i];
2983 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2984 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2985 ret->data[i] = arr_elem_conv;
2987 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2989 return (uint64_t)ret;
2991 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2992 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2993 for (size_t i = 0; i < ret.datalen; i++) {
2994 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2999 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3000 ret->datalen = (*env)->GetArrayLength(env, elems);
3001 if (ret->datalen == 0) {
3004 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3005 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3006 for (size_t i = 0; i < ret->datalen; i++) {
3007 int64_t arr_elem = java_elems[i];
3008 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3009 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3010 ret->data[i] = arr_elem_conv;
3012 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3014 return (uint64_t)ret;
3016 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3017 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3018 for (size_t i = 0; i < ret.datalen; i++) {
3019 ret.data[i] = APIError_clone(&orig->data[i]);
3023 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3024 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3025 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3026 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3027 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3028 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3029 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3030 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3032 LDKPaymentSendFailure_ParameterError_class =
3033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3034 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3035 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3036 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3037 LDKPaymentSendFailure_PathParameterError_class =
3038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3039 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3040 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3041 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3042 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3044 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3045 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3046 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3047 LDKPaymentSendFailure_PartialFailure_class =
3048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3049 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3050 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3051 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3053 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3054 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3056 case LDKPaymentSendFailure_ParameterError: {
3057 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3058 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3060 case LDKPaymentSendFailure_PathParameterError: {
3061 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3062 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3063 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3064 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3065 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3066 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3067 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3068 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3070 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3071 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3073 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3074 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3075 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3076 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3077 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3078 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3079 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3081 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3082 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3084 case LDKPaymentSendFailure_PartialFailure: {
3085 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3086 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3087 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3088 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3089 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3090 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3091 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3092 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3094 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3095 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3100 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3101 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3104 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3105 CHECK(val->result_ok);
3106 return *val->contents.result;
3108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3109 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3110 CHECK(!val->result_ok);
3111 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3114 static jclass LDKNetAddress_IPv4_class = NULL;
3115 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3116 static jclass LDKNetAddress_IPv6_class = NULL;
3117 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3118 static jclass LDKNetAddress_OnionV2_class = NULL;
3119 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3120 static jclass LDKNetAddress_OnionV3_class = NULL;
3121 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3123 LDKNetAddress_IPv4_class =
3124 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3125 CHECK(LDKNetAddress_IPv4_class != NULL);
3126 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3127 CHECK(LDKNetAddress_IPv4_meth != NULL);
3128 LDKNetAddress_IPv6_class =
3129 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3130 CHECK(LDKNetAddress_IPv6_class != NULL);
3131 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3132 CHECK(LDKNetAddress_IPv6_meth != NULL);
3133 LDKNetAddress_OnionV2_class =
3134 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3135 CHECK(LDKNetAddress_OnionV2_class != NULL);
3136 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3137 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3138 LDKNetAddress_OnionV3_class =
3139 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3140 CHECK(LDKNetAddress_OnionV3_class != NULL);
3141 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3142 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3144 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3145 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3147 case LDKNetAddress_IPv4: {
3148 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3149 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3150 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3152 case LDKNetAddress_IPv6: {
3153 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3154 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3155 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3157 case LDKNetAddress_OnionV2: {
3158 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3159 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3160 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3162 case LDKNetAddress_OnionV3: {
3163 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3164 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3165 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port);
3170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3171 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3172 ret->datalen = (*env)->GetArrayLength(env, elems);
3173 if (ret->datalen == 0) {
3176 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3177 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3178 for (size_t i = 0; i < ret->datalen; i++) {
3179 int64_t arr_elem = java_elems[i];
3180 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3181 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3182 ret->data[i] = arr_elem_conv;
3184 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3186 return (uint64_t)ret;
3188 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3189 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3190 for (size_t i = 0; i < ret.datalen; i++) {
3191 ret.data[i] = NetAddress_clone(&orig->data[i]);
3195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3196 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3197 LDKThirtyTwoBytes a_ref;
3198 CHECK((*env)->GetArrayLength(env, a) == 32);
3199 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3201 LDKThirtyTwoBytes b_ref;
3202 CHECK((*env)->GetArrayLength(env, b) == 32);
3203 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3205 return (uint64_t)ret;
3207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3208 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3209 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3210 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3214 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3215 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3216 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3220 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3223 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3224 CHECK(val->result_ok);
3225 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3226 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3230 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3231 CHECK(!val->result_ok);
3232 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3236 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3237 ret->datalen = (*env)->GetArrayLength(env, elems);
3238 if (ret->datalen == 0) {
3241 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3242 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3243 for (size_t i = 0; i < ret->datalen; i++) {
3244 int64_t arr_elem = java_elems[i];
3245 LDKChannelMonitor arr_elem_conv;
3246 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3247 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3248 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3249 ret->data[i] = arr_elem_conv;
3251 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3253 return (uint64_t)ret;
3255 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3256 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3257 for (size_t i = 0; i < ret.datalen; i++) {
3258 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3262 typedef struct LDKWatch_JCalls {
3263 atomic_size_t refcnt;
3266 jmethodID watch_channel_meth;
3267 jmethodID update_channel_meth;
3268 jmethodID release_pending_monitor_events_meth;
3270 static void LDKWatch_JCalls_free(void* this_arg) {
3271 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3272 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3274 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3275 if (get_jenv_res == JNI_EDETACHED) {
3276 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3278 DO_ASSERT(get_jenv_res == JNI_OK);
3280 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3281 if (get_jenv_res == JNI_EDETACHED) {
3282 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3287 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3288 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3290 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3291 if (get_jenv_res == JNI_EDETACHED) {
3292 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3294 DO_ASSERT(get_jenv_res == JNI_OK);
3296 LDKOutPoint funding_txo_var = funding_txo;
3297 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3298 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3299 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3300 if (funding_txo_var.is_owned) {
3301 funding_txo_ref |= 1;
3303 LDKChannelMonitor monitor_var = monitor;
3304 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3305 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3306 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3307 if (monitor_var.is_owned) {
3310 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3312 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3313 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3314 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3315 if (get_jenv_res == JNI_EDETACHED) {
3316 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3320 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3321 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3323 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3324 if (get_jenv_res == JNI_EDETACHED) {
3325 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3327 DO_ASSERT(get_jenv_res == JNI_OK);
3329 LDKOutPoint funding_txo_var = funding_txo;
3330 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3331 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3332 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3333 if (funding_txo_var.is_owned) {
3334 funding_txo_ref |= 1;
3336 LDKChannelMonitorUpdate update_var = update;
3337 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3338 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3339 uint64_t update_ref = (uint64_t)update_var.inner;
3340 if (update_var.is_owned) {
3343 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3345 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3346 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3347 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3348 if (get_jenv_res == JNI_EDETACHED) {
3349 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3353 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3354 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3356 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3357 if (get_jenv_res == JNI_EDETACHED) {
3358 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3360 DO_ASSERT(get_jenv_res == JNI_OK);
3362 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3364 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3365 LDKCVec_MonitorEventZ ret_constr;
3366 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3367 if (ret_constr.datalen > 0)
3368 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3370 ret_constr.data = NULL;
3371 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3372 for (size_t o = 0; o < ret_constr.datalen; o++) {
3373 int64_t ret_conv_14 = ret_vals[o];
3374 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3375 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3376 ret_constr.data[o] = ret_conv_14_conv;
3378 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3379 if (get_jenv_res == JNI_EDETACHED) {
3380 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3384 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3385 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3386 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3387 return (void*) this_arg;
3389 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3390 jclass c = (*env)->GetObjectClass(env, o);
3392 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3393 atomic_init(&calls->refcnt, 1);
3394 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3395 calls->o = (*env)->NewWeakGlobalRef(env, o);
3396 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3397 CHECK(calls->watch_channel_meth != NULL);
3398 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3399 CHECK(calls->update_channel_meth != NULL);
3400 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3401 CHECK(calls->release_pending_monitor_events_meth != NULL);
3404 .this_arg = (void*) calls,
3405 .watch_channel = watch_channel_LDKWatch_jcall,
3406 .update_channel = update_channel_LDKWatch_jcall,
3407 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3408 .free = LDKWatch_JCalls_free,
3412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3413 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3414 *res_ptr = LDKWatch_init(env, clz, o);
3415 return (uint64_t)res_ptr;
3417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t monitor) {
3418 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3419 LDKOutPoint funding_txo_conv;
3420 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3421 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3422 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3423 LDKChannelMonitor monitor_conv;
3424 monitor_conv.inner = (void*)(monitor & (~1));
3425 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3426 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3427 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3428 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3429 return (uint64_t)ret_conv;
3432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
3433 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3434 LDKOutPoint funding_txo_conv;
3435 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3436 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3437 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3438 LDKChannelMonitorUpdate update_conv;
3439 update_conv.inner = (void*)(update & (~1));
3440 update_conv.is_owned = (update & 1) || (update == 0);
3441 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3442 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3443 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3444 return (uint64_t)ret_conv;
3447 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3448 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3449 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3450 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3451 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3452 for (size_t o = 0; o < ret_var.datalen; o++) {
3453 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3454 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3455 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3456 ret_arr_ptr[o] = ret_conv_14_ref;
3458 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3463 typedef struct LDKBroadcasterInterface_JCalls {
3464 atomic_size_t refcnt;
3467 jmethodID broadcast_transaction_meth;
3468 } LDKBroadcasterInterface_JCalls;
3469 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3470 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3471 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3473 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3474 if (get_jenv_res == JNI_EDETACHED) {
3475 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3477 DO_ASSERT(get_jenv_res == JNI_OK);
3479 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3480 if (get_jenv_res == JNI_EDETACHED) {
3481 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3486 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3487 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3489 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3490 if (get_jenv_res == JNI_EDETACHED) {
3491 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3493 DO_ASSERT(get_jenv_res == JNI_OK);
3495 LDKTransaction tx_var = tx;
3496 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3497 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3498 Transaction_free(tx_var);
3499 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3501 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3502 if (get_jenv_res == JNI_EDETACHED) {
3503 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3506 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3507 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3508 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3509 return (void*) this_arg;
3511 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3512 jclass c = (*env)->GetObjectClass(env, o);
3514 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3515 atomic_init(&calls->refcnt, 1);
3516 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3517 calls->o = (*env)->NewWeakGlobalRef(env, o);
3518 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3519 CHECK(calls->broadcast_transaction_meth != NULL);
3521 LDKBroadcasterInterface ret = {
3522 .this_arg = (void*) calls,
3523 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3524 .free = LDKBroadcasterInterface_JCalls_free,
3528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3529 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3530 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3531 return (uint64_t)res_ptr;
3533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3534 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3535 LDKTransaction tx_ref;
3536 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3537 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3538 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3539 tx_ref.data_is_owned = true;
3540 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3543 typedef struct LDKKeysInterface_JCalls {
3544 atomic_size_t refcnt;
3547 jmethodID get_node_secret_meth;
3548 jmethodID get_destination_script_meth;
3549 jmethodID get_shutdown_pubkey_meth;
3550 jmethodID get_channel_signer_meth;
3551 jmethodID get_secure_random_bytes_meth;
3552 jmethodID read_chan_signer_meth;
3553 jmethodID sign_invoice_meth;
3554 } LDKKeysInterface_JCalls;
3555 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3556 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3557 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3559 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3560 if (get_jenv_res == JNI_EDETACHED) {
3561 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3563 DO_ASSERT(get_jenv_res == JNI_OK);
3565 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3566 if (get_jenv_res == JNI_EDETACHED) {
3567 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3572 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3573 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3575 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3576 if (get_jenv_res == JNI_EDETACHED) {
3577 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3579 DO_ASSERT(get_jenv_res == JNI_OK);
3581 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3583 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3584 LDKSecretKey ret_ref;
3585 CHECK((*env)->GetArrayLength(env, ret) == 32);
3586 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3587 if (get_jenv_res == JNI_EDETACHED) {
3588 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3592 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3593 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3595 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3596 if (get_jenv_res == JNI_EDETACHED) {
3597 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3599 DO_ASSERT(get_jenv_res == JNI_OK);
3601 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3603 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3604 LDKCVec_u8Z ret_ref;
3605 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3606 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3607 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3608 if (get_jenv_res == JNI_EDETACHED) {
3609 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3613 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3614 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3616 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3617 if (get_jenv_res == JNI_EDETACHED) {
3618 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3620 DO_ASSERT(get_jenv_res == JNI_OK);
3622 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3624 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3625 LDKPublicKey ret_ref;
3626 CHECK((*env)->GetArrayLength(env, ret) == 33);
3627 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3628 if (get_jenv_res == JNI_EDETACHED) {
3629 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3633 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3634 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3637 if (get_jenv_res == JNI_EDETACHED) {
3638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3640 DO_ASSERT(get_jenv_res == JNI_OK);
3642 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3644 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3645 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3646 ret_conv = Sign_clone(ret);
3647 if (get_jenv_res == JNI_EDETACHED) {
3648 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3652 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3653 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3655 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3656 if (get_jenv_res == JNI_EDETACHED) {
3657 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3659 DO_ASSERT(get_jenv_res == JNI_OK);
3661 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3663 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3664 LDKThirtyTwoBytes ret_ref;
3665 CHECK((*env)->GetArrayLength(env, ret) == 32);
3666 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3667 if (get_jenv_res == JNI_EDETACHED) {
3668 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3672 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3673 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3675 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3676 if (get_jenv_res == JNI_EDETACHED) {
3677 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3679 DO_ASSERT(get_jenv_res == JNI_OK);
3681 LDKu8slice reader_var = reader;
3682 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3683 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3684 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3686 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3687 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3688 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3689 if (get_jenv_res == JNI_EDETACHED) {
3690 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3694 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3695 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3697 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3698 if (get_jenv_res == JNI_EDETACHED) {
3699 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3701 DO_ASSERT(get_jenv_res == JNI_OK);
3703 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3704 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3705 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3706 CVec_u8Z_free(invoice_preimage_var);
3707 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3709 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3710 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3711 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3712 if (get_jenv_res == JNI_EDETACHED) {
3713 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3717 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3718 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3719 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3720 return (void*) this_arg;
3722 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3723 jclass c = (*env)->GetObjectClass(env, o);
3725 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3726 atomic_init(&calls->refcnt, 1);
3727 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3728 calls->o = (*env)->NewWeakGlobalRef(env, o);
3729 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3730 CHECK(calls->get_node_secret_meth != NULL);
3731 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3732 CHECK(calls->get_destination_script_meth != NULL);
3733 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3734 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3735 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3736 CHECK(calls->get_channel_signer_meth != NULL);
3737 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3738 CHECK(calls->get_secure_random_bytes_meth != NULL);
3739 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3740 CHECK(calls->read_chan_signer_meth != NULL);
3741 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3742 CHECK(calls->sign_invoice_meth != NULL);
3744 LDKKeysInterface ret = {
3745 .this_arg = (void*) calls,
3746 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3747 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3748 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3749 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3750 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3751 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3752 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3753 .free = LDKKeysInterface_JCalls_free,
3757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3758 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3759 *res_ptr = LDKKeysInterface_init(env, clz, o);
3760 return (uint64_t)res_ptr;
3762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3763 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3764 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3765 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3770 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3771 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3772 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3773 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3774 CVec_u8Z_free(ret_var);
3778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3779 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3780 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3781 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
3786 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3787 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3788 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3789 return (uint64_t)ret;
3792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3793 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3794 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3795 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3800 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3801 LDKu8slice reader_ref;
3802 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3803 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3804 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3805 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3806 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3807 return (uint64_t)ret_conv;
3810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
3811 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3812 LDKCVec_u8Z invoice_preimage_ref;
3813 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
3814 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3815 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
3816 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3817 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3818 return (uint64_t)ret_conv;
3821 typedef struct LDKFeeEstimator_JCalls {
3822 atomic_size_t refcnt;
3825 jmethodID get_est_sat_per_1000_weight_meth;
3826 } LDKFeeEstimator_JCalls;
3827 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3828 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3829 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3831 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3832 if (get_jenv_res == JNI_EDETACHED) {
3833 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3835 DO_ASSERT(get_jenv_res == JNI_OK);
3837 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3838 if (get_jenv_res == JNI_EDETACHED) {
3839 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3844 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3845 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3847 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3848 if (get_jenv_res == JNI_EDETACHED) {
3849 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3851 DO_ASSERT(get_jenv_res == JNI_OK);
3853 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3854 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3856 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3857 if (get_jenv_res == JNI_EDETACHED) {
3858 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3862 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3863 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3864 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3865 return (void*) this_arg;
3867 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3868 jclass c = (*env)->GetObjectClass(env, o);
3870 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3871 atomic_init(&calls->refcnt, 1);
3872 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3873 calls->o = (*env)->NewWeakGlobalRef(env, o);
3874 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
3875 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3877 LDKFeeEstimator ret = {
3878 .this_arg = (void*) calls,
3879 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3880 .free = LDKFeeEstimator_JCalls_free,
3884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3885 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3886 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3887 return (uint64_t)res_ptr;
3889 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_arg, jclass confirmation_target) {
3890 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3891 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3892 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3896 typedef struct LDKLogger_JCalls {
3897 atomic_size_t refcnt;
3902 static void LDKLogger_JCalls_free(void* this_arg) {
3903 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3904 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3906 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3907 if (get_jenv_res == JNI_EDETACHED) {
3908 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3910 DO_ASSERT(get_jenv_res == JNI_OK);
3912 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3913 if (get_jenv_res == JNI_EDETACHED) {
3914 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3919 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3920 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3922 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3923 if (get_jenv_res == JNI_EDETACHED) {
3924 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3926 DO_ASSERT(get_jenv_res == JNI_OK);
3928 const char* record_str = record;
3929 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3930 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3932 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3933 if (get_jenv_res == JNI_EDETACHED) {
3934 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3937 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3938 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3939 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3940 return (void*) this_arg;
3942 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3943 jclass c = (*env)->GetObjectClass(env, o);
3945 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3946 atomic_init(&calls->refcnt, 1);
3947 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3948 calls->o = (*env)->NewWeakGlobalRef(env, o);
3949 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3950 CHECK(calls->log_meth != NULL);
3953 .this_arg = (void*) calls,
3954 .log = log_LDKLogger_jcall,
3955 .free = LDKLogger_JCalls_free,
3959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3960 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3961 *res_ptr = LDKLogger_init(env, clz, o);
3962 return (uint64_t)res_ptr;
3964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3965 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3966 LDKThirtyTwoBytes a_ref;
3967 CHECK((*env)->GetArrayLength(env, a) == 32);
3968 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3970 LDKChannelManager b_conv;
3971 b_conv.inner = (void*)(b & (~1));
3972 b_conv.is_owned = (b & 1) || (b == 0);
3973 // Warning: we need a move here but no clone is available for LDKChannelManager
3975 return (uint64_t)ret;
3977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3978 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3979 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3980 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3984 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3985 LDKChannelManager b_var = tuple->b;
3986 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3987 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3988 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3992 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3995 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3996 CHECK(val->result_ok);
3997 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4001 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4002 CHECK(!val->result_ok);
4003 LDKDecodeError err_var = (*val->contents.err);
4004 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4005 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4006 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4009 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4010 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4013 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4014 CHECK(val->result_ok);
4015 LDKChannelConfig res_var = (*val->contents.result);
4016 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4017 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4018 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4022 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4023 CHECK(!val->result_ok);
4024 LDKDecodeError err_var = (*val->contents.err);
4025 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4026 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4027 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4031 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4034 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4035 CHECK(val->result_ok);
4036 LDKOutPoint res_var = (*val->contents.result);
4037 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4038 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4039 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4043 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4044 CHECK(!val->result_ok);
4045 LDKDecodeError err_var = (*val->contents.err);
4046 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4047 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4048 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4052 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4055 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4056 CHECK(val->result_ok);
4057 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4061 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4062 CHECK(!val->result_ok);
4063 return *val->contents.err;
4065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4066 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4069 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4070 CHECK(val->result_ok);
4071 LDKInvoice res_var = (*val->contents.result);
4072 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4073 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4074 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4078 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4079 CHECK(!val->result_ok);
4080 return *val->contents.err;
4082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4083 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4086 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4087 CHECK(val->result_ok);
4088 LDKSignedRawInvoice res_var = (*val->contents.result);
4089 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4090 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4091 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4095 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4096 CHECK(!val->result_ok);
4097 return *val->contents.err;
4099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
4100 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4101 LDKRawInvoice a_conv;
4102 a_conv.inner = (void*)(a & (~1));
4103 a_conv.is_owned = (a & 1) || (a == 0);
4104 a_conv = RawInvoice_clone(&a_conv);
4106 LDKThirtyTwoBytes b_ref;
4107 CHECK((*env)->GetArrayLength(env, b) == 32);
4108 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4110 LDKInvoiceSignature c_conv;
4111 c_conv.inner = (void*)(c & (~1));
4112 c_conv.is_owned = (c & 1) || (c == 0);
4113 c_conv = InvoiceSignature_clone(&c_conv);
4115 return (uint64_t)ret;
4117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4118 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4119 LDKRawInvoice a_var = tuple->a;
4120 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4121 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4122 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4126 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4127 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4128 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4132 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4133 LDKInvoiceSignature c_var = tuple->c;
4134 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4135 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4136 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4140 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4143 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4144 CHECK(val->result_ok);
4145 LDKPayeePubKey res_var = (*val->contents.result);
4146 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4147 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4148 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4151 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4152 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4153 CHECK(!val->result_ok);
4154 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4158 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4159 ret->datalen = (*env)->GetArrayLength(env, elems);
4160 if (ret->datalen == 0) {
4163 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4164 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4165 for (size_t i = 0; i < ret->datalen; i++) {
4166 int64_t arr_elem = java_elems[i];
4167 LDKPrivateRoute arr_elem_conv;
4168 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4169 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4170 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4171 ret->data[i] = arr_elem_conv;
4173 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4175 return (uint64_t)ret;
4177 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4178 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4179 for (size_t i = 0; i < ret.datalen; i++) {
4180 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4185 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4188 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4189 CHECK(val->result_ok);
4190 LDKPositiveTimestamp res_var = (*val->contents.result);
4191 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4192 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4193 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4196 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4197 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4198 CHECK(!val->result_ok);
4199 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4203 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4206 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4207 CHECK(val->result_ok);
4208 return *val->contents.result;
4210 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4211 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4212 CHECK(!val->result_ok);
4213 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4217 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4220 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4221 CHECK(val->result_ok);
4222 LDKInvoice res_var = (*val->contents.result);
4223 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4224 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4225 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4228 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4229 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4230 CHECK(!val->result_ok);
4231 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4235 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4238 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4239 CHECK(val->result_ok);
4240 LDKDescription res_var = (*val->contents.result);
4241 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4242 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4243 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4246 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4247 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4248 CHECK(!val->result_ok);
4249 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4253 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4256 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4257 CHECK(val->result_ok);
4258 LDKExpiryTime res_var = (*val->contents.result);
4259 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4260 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4261 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4264 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4265 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4266 CHECK(!val->result_ok);
4267 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4271 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4274 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4275 CHECK(val->result_ok);
4276 LDKPrivateRoute res_var = (*val->contents.result);
4277 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4278 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4279 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4282 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4283 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4284 CHECK(!val->result_ok);
4285 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4289 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4291 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4292 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4293 CHECK(val->result_ok);
4294 LDKStr res_str = (*val->contents.result);
4295 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4298 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4299 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4300 CHECK(!val->result_ok);
4301 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4305 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4308 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4309 CHECK(val->result_ok);
4310 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4311 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4312 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4313 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4317 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4318 CHECK(!val->result_ok);
4319 LDKDecodeError err_var = (*val->contents.err);
4320 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4321 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4322 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4326 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4329 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4330 CHECK(val->result_ok);
4331 LDKHTLCUpdate res_var = (*val->contents.result);
4332 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4333 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4334 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4338 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4339 CHECK(!val->result_ok);
4340 LDKDecodeError err_var = (*val->contents.err);
4341 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4342 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4343 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4347 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4350 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4351 CHECK(val->result_ok);
4352 return *val->contents.result;
4354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4355 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4356 CHECK(!val->result_ok);
4357 LDKMonitorUpdateError err_var = (*val->contents.err);
4358 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4359 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4360 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4364 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4366 a_conv.inner = (void*)(a & (~1));
4367 a_conv.is_owned = (a & 1) || (a == 0);
4368 a_conv = OutPoint_clone(&a_conv);
4371 b_ref.datalen = (*env)->GetArrayLength(env, b);
4372 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4373 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4375 return (uint64_t)ret;
4377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4378 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4379 LDKOutPoint a_var = tuple->a;
4380 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4381 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4382 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4386 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4387 LDKCVec_u8Z b_var = tuple->b;
4388 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4389 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4393 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4396 b_ref.datalen = (*env)->GetArrayLength(env, b);
4397 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4398 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4400 return (uint64_t)ret;
4402 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4403 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4407 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4408 LDKCVec_u8Z b_var = tuple->b;
4409 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4410 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4414 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4415 ret->datalen = (*env)->GetArrayLength(env, elems);
4416 if (ret->datalen == 0) {
4419 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4420 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4421 for (size_t i = 0; i < ret->datalen; i++) {
4422 int64_t arr_elem = java_elems[i];
4423 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4424 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4425 ret->data[i] = arr_elem_conv;
4427 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4429 return (uint64_t)ret;
4431 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4432 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4433 for (size_t i = 0; i < ret.datalen; i++) {
4434 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4439 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4440 LDKThirtyTwoBytes a_ref;
4441 CHECK((*env)->GetArrayLength(env, a) == 32);
4442 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4444 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4445 b_constr.datalen = (*env)->GetArrayLength(env, b);
4446 if (b_constr.datalen > 0)
4447 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4449 b_constr.data = NULL;
4450 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4451 for (size_t b = 0; b < b_constr.datalen; b++) {
4452 int64_t b_conv_27 = b_vals[b];
4453 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4454 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4455 b_constr.data[b] = b_conv_27_conv;
4457 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4459 return (uint64_t)ret;
4461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4462 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4463 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4464 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4467 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4468 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4469 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4470 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4471 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4472 for (size_t b = 0; b < b_var.datalen; b++) {
4473 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4474 b_arr_ptr[b] = b_conv_27_ref;
4476 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4480 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4481 ret->datalen = (*env)->GetArrayLength(env, elems);
4482 if (ret->datalen == 0) {
4485 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4486 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4487 for (size_t i = 0; i < ret->datalen; i++) {
4488 int64_t arr_elem = java_elems[i];
4489 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4490 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4491 ret->data[i] = arr_elem_conv;
4493 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4495 return (uint64_t)ret;
4497 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4498 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
4499 for (size_t i = 0; i < ret.datalen; i++) {
4500 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4504 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4505 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4506 static jclass LDKEvent_PaymentReceived_class = NULL;
4507 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4508 static jclass LDKEvent_PaymentSent_class = NULL;
4509 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4510 static jclass LDKEvent_PaymentFailed_class = NULL;
4511 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4512 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4513 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4514 static jclass LDKEvent_SpendableOutputs_class = NULL;
4515 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4517 LDKEvent_FundingGenerationReady_class =
4518 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4519 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4520 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4521 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4522 LDKEvent_PaymentReceived_class =
4523 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4524 CHECK(LDKEvent_PaymentReceived_class != NULL);
4525 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
4526 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4527 LDKEvent_PaymentSent_class =
4528 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4529 CHECK(LDKEvent_PaymentSent_class != NULL);
4530 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4531 CHECK(LDKEvent_PaymentSent_meth != NULL);
4532 LDKEvent_PaymentFailed_class =
4533 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4534 CHECK(LDKEvent_PaymentFailed_class != NULL);
4535 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4536 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4537 LDKEvent_PendingHTLCsForwardable_class =
4538 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4539 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4540 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4541 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4542 LDKEvent_SpendableOutputs_class =
4543 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4544 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4545 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4546 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4548 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4549 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4551 case LDKEvent_FundingGenerationReady: {
4552 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4553 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4554 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4555 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4556 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4557 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
4559 case LDKEvent_PaymentReceived: {
4560 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4561 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4562 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4563 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
4564 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4565 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
4566 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
4568 case LDKEvent_PaymentSent: {
4569 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4570 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4571 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4573 case LDKEvent_PaymentFailed: {
4574 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4575 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4576 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4578 case LDKEvent_PendingHTLCsForwardable: {
4579 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4581 case LDKEvent_SpendableOutputs: {
4582 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4583 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4584 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4585 for (size_t b = 0; b < outputs_var.datalen; b++) {
4586 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4587 outputs_arr_ptr[b] = outputs_conv_27_ref;
4589 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4590 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4596 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4597 ret->datalen = (*env)->GetArrayLength(env, elems);
4598 if (ret->datalen == 0) {
4601 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4602 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4603 for (size_t i = 0; i < ret->datalen; i++) {
4604 int64_t arr_elem = java_elems[i];
4605 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4606 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4607 ret->data[i] = arr_elem_conv;
4609 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4611 return (uint64_t)ret;
4613 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4614 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4615 for (size_t i = 0; i < ret.datalen; i++) {
4616 ret.data[i] = Event_clone(&orig->data[i]);
4620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4621 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4623 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4624 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4626 return (uint64_t)ret;
4628 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4629 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4633 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4634 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4635 return (uint64_t)b_ref;
4637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4638 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4639 ret->datalen = (*env)->GetArrayLength(env, elems);
4640 if (ret->datalen == 0) {
4643 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4644 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4645 for (size_t i = 0; i < ret->datalen; i++) {
4646 int64_t arr_elem = java_elems[i];
4647 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4648 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4649 ret->data[i] = arr_elem_conv;
4651 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4653 return (uint64_t)ret;
4655 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4656 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4657 for (size_t i = 0; i < ret.datalen; i++) {
4658 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4663 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4664 LDKThirtyTwoBytes a_ref;
4665 CHECK((*env)->GetArrayLength(env, a) == 32);
4666 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4668 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4669 b_constr.datalen = (*env)->GetArrayLength(env, b);
4670 if (b_constr.datalen > 0)
4671 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4673 b_constr.data = NULL;
4674 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4675 for (size_t a = 0; a < b_constr.datalen; a++) {
4676 int64_t b_conv_26 = b_vals[a];
4677 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4678 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4679 b_constr.data[a] = b_conv_26_conv;
4681 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4683 return (uint64_t)ret;
4685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4686 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4687 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4688 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4691 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4692 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4693 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4694 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4695 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4696 for (size_t a = 0; a < b_var.datalen; a++) {
4697 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4698 b_arr_ptr[a] = b_conv_26_ref;
4700 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4704 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4705 ret->datalen = (*env)->GetArrayLength(env, elems);
4706 if (ret->datalen == 0) {
4709 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4710 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4711 for (size_t i = 0; i < ret->datalen; i++) {
4712 int64_t arr_elem = java_elems[i];
4713 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4714 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4715 ret->data[i] = arr_elem_conv;
4717 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4719 return (uint64_t)ret;
4721 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4722 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
4723 for (size_t i = 0; i < ret.datalen; i++) {
4724 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4729 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4732 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4733 CHECK(val->result_ok);
4734 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4738 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4739 CHECK(!val->result_ok);
4740 LDKDecodeError err_var = (*val->contents.err);
4741 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4742 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4743 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4747 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4750 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4751 CHECK(val->result_ok);
4752 return *val->contents.result;
4754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4755 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4756 CHECK(!val->result_ok);
4757 LDKLightningError err_var = (*val->contents.err);
4758 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4759 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4760 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
4764 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4765 LDKChannelAnnouncement a_conv;
4766 a_conv.inner = (void*)(a & (~1));
4767 a_conv.is_owned = (a & 1) || (a == 0);
4768 a_conv = ChannelAnnouncement_clone(&a_conv);
4770 LDKChannelUpdate b_conv;
4771 b_conv.inner = (void*)(b & (~1));
4772 b_conv.is_owned = (b & 1) || (b == 0);
4773 b_conv = ChannelUpdate_clone(&b_conv);
4775 LDKChannelUpdate c_conv;
4776 c_conv.inner = (void*)(c & (~1));
4777 c_conv.is_owned = (c & 1) || (c == 0);
4778 c_conv = ChannelUpdate_clone(&c_conv);
4780 return (uint64_t)ret;
4782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4783 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4784 LDKChannelAnnouncement a_var = tuple->a;
4785 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4786 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4787 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4791 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4792 LDKChannelUpdate b_var = tuple->b;
4793 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4794 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4795 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4799 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4800 LDKChannelUpdate c_var = tuple->c;
4801 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4802 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4803 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4807 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4808 ret->datalen = (*env)->GetArrayLength(env, elems);
4809 if (ret->datalen == 0) {
4812 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4813 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4814 for (size_t i = 0; i < ret->datalen; i++) {
4815 int64_t arr_elem = java_elems[i];
4816 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4817 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4818 ret->data[i] = arr_elem_conv;
4820 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4822 return (uint64_t)ret;
4824 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4825 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4826 for (size_t i = 0; i < ret.datalen; i++) {
4827 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4832 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4833 ret->datalen = (*env)->GetArrayLength(env, elems);
4834 if (ret->datalen == 0) {
4837 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4838 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4839 for (size_t i = 0; i < ret->datalen; i++) {
4840 int64_t arr_elem = java_elems[i];
4841 LDKNodeAnnouncement arr_elem_conv;
4842 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4843 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4844 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4845 ret->data[i] = arr_elem_conv;
4847 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4849 return (uint64_t)ret;
4851 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4852 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4853 for (size_t i = 0; i < ret.datalen; i++) {
4854 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4859 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4862 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4863 CHECK(val->result_ok);
4864 return *val->contents.result;
4866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4867 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4868 CHECK(!val->result_ok);
4869 LDKLightningError err_var = (*val->contents.err);
4870 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4871 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4872 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4876 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4879 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4880 CHECK(val->result_ok);
4881 LDKCVec_u8Z res_var = (*val->contents.result);
4882 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
4883 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
4886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4887 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4888 CHECK(!val->result_ok);
4889 LDKPeerHandleError err_var = (*val->contents.err);
4890 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4891 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4892 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4896 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4899 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4900 CHECK(val->result_ok);
4901 return *val->contents.result;
4903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4904 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4905 CHECK(!val->result_ok);
4906 LDKPeerHandleError err_var = (*val->contents.err);
4907 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4908 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4909 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4913 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4916 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4917 CHECK(val->result_ok);
4918 return *val->contents.result;
4920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4921 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4922 CHECK(!val->result_ok);
4923 LDKPeerHandleError err_var = (*val->contents.err);
4924 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4925 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4926 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4930 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4933 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4934 CHECK(val->result_ok);
4935 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4936 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4937 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4938 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4942 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4943 CHECK(!val->result_ok);
4944 LDKDecodeError err_var = (*val->contents.err);
4945 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4946 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4947 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4951 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4954 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4955 CHECK(val->result_ok);
4956 LDKChannelInfo res_var = (*val->contents.result);
4957 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4958 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4959 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4963 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4964 CHECK(!val->result_ok);
4965 LDKDecodeError err_var = (*val->contents.err);
4966 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4967 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4968 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4972 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4975 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4976 CHECK(val->result_ok);
4977 LDKRoutingFees res_var = (*val->contents.result);
4978 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4979 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4980 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4984 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4985 CHECK(!val->result_ok);
4986 LDKDecodeError err_var = (*val->contents.err);
4987 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4988 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4989 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4993 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4996 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
4997 CHECK(val->result_ok);
4998 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
4999 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5000 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5001 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5005 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5006 CHECK(!val->result_ok);
5007 LDKDecodeError err_var = (*val->contents.err);
5008 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5009 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5010 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5014 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5015 ret->datalen = (*env)->GetArrayLength(env, elems);
5016 if (ret->datalen == 0) {
5019 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5020 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5021 for (size_t i = 0; i < ret->datalen; i++) {
5022 ret->data[i] = java_elems[i];
5024 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5026 return (uint64_t)ret;
5028 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5029 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5030 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5034 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5037 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5038 CHECK(val->result_ok);
5039 LDKNodeInfo res_var = (*val->contents.result);
5040 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5041 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5042 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5046 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5047 CHECK(!val->result_ok);
5048 LDKDecodeError err_var = (*val->contents.err);
5049 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5050 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5051 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5055 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5058 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5059 CHECK(val->result_ok);
5060 LDKNetworkGraph res_var = (*val->contents.result);
5061 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5062 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5063 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5067 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5068 CHECK(!val->result_ok);
5069 LDKDecodeError err_var = (*val->contents.err);
5070 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5071 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5072 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5076 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5079 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5080 CHECK(val->result_ok);
5081 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5084 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5085 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5086 CHECK(!val->result_ok);
5087 return *val->contents.err;
5089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5090 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5093 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5094 CHECK(val->result_ok);
5095 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5096 *res_conv = (*val->contents.result);
5097 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5098 return (uint64_t)res_conv;
5100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5101 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5102 CHECK(!val->result_ok);
5103 LDKDecodeError err_var = (*val->contents.err);
5104 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5105 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5106 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5109 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5110 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5113 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5114 CHECK(val->result_ok);
5115 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5119 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5120 CHECK(!val->result_ok);
5121 LDKDecodeError err_var = (*val->contents.err);
5122 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5123 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5124 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5128 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5129 ret->datalen = (*env)->GetArrayLength(env, elems);
5130 if (ret->datalen == 0) {
5133 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5134 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5135 for (size_t i = 0; i < ret->datalen; i++) {
5136 int64_t arr_elem = java_elems[i];
5137 LDKUpdateAddHTLC arr_elem_conv;
5138 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5139 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5140 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5141 ret->data[i] = arr_elem_conv;
5143 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5145 return (uint64_t)ret;
5147 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5148 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5149 for (size_t i = 0; i < ret.datalen; i++) {
5150 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5155 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5156 ret->datalen = (*env)->GetArrayLength(env, elems);
5157 if (ret->datalen == 0) {
5160 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5161 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5162 for (size_t i = 0; i < ret->datalen; i++) {
5163 int64_t arr_elem = java_elems[i];
5164 LDKUpdateFulfillHTLC arr_elem_conv;
5165 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5166 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5167 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5168 ret->data[i] = arr_elem_conv;
5170 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5172 return (uint64_t)ret;
5174 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5175 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5176 for (size_t i = 0; i < ret.datalen; i++) {
5177 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5182 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5183 ret->datalen = (*env)->GetArrayLength(env, elems);
5184 if (ret->datalen == 0) {
5187 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5188 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5189 for (size_t i = 0; i < ret->datalen; i++) {
5190 int64_t arr_elem = java_elems[i];
5191 LDKUpdateFailHTLC arr_elem_conv;
5192 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5193 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5194 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5195 ret->data[i] = arr_elem_conv;
5197 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5199 return (uint64_t)ret;
5201 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5202 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5203 for (size_t i = 0; i < ret.datalen; i++) {
5204 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5209 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5210 ret->datalen = (*env)->GetArrayLength(env, elems);
5211 if (ret->datalen == 0) {
5214 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5215 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5216 for (size_t i = 0; i < ret->datalen; i++) {
5217 int64_t arr_elem = java_elems[i];
5218 LDKUpdateFailMalformedHTLC arr_elem_conv;
5219 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5220 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5221 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5222 ret->data[i] = arr_elem_conv;
5224 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5226 return (uint64_t)ret;
5228 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5229 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5230 for (size_t i = 0; i < ret.datalen; i++) {
5231 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5236 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5239 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5240 CHECK(val->result_ok);
5241 LDKAcceptChannel res_var = (*val->contents.result);
5242 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5243 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5244 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5248 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5249 CHECK(!val->result_ok);
5250 LDKDecodeError err_var = (*val->contents.err);
5251 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5252 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5253 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5257 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5260 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5261 CHECK(val->result_ok);
5262 LDKAnnouncementSignatures res_var = (*val->contents.result);
5263 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5264 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5265 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5269 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5270 CHECK(!val->result_ok);
5271 LDKDecodeError err_var = (*val->contents.err);
5272 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5273 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5274 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5278 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5281 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5282 CHECK(val->result_ok);
5283 LDKChannelReestablish res_var = (*val->contents.result);
5284 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5285 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5286 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5290 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5291 CHECK(!val->result_ok);
5292 LDKDecodeError err_var = (*val->contents.err);
5293 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5294 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5295 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5299 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5302 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5303 CHECK(val->result_ok);
5304 LDKClosingSigned res_var = (*val->contents.result);
5305 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5306 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5307 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5311 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5312 CHECK(!val->result_ok);
5313 LDKDecodeError err_var = (*val->contents.err);
5314 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5315 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5316 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5319 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5320 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5323 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5324 CHECK(val->result_ok);
5325 LDKCommitmentSigned res_var = (*val->contents.result);
5326 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5327 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5328 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5332 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5333 CHECK(!val->result_ok);
5334 LDKDecodeError err_var = (*val->contents.err);
5335 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5336 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5337 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5340 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5341 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5344 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5345 CHECK(val->result_ok);
5346 LDKFundingCreated res_var = (*val->contents.result);
5347 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5348 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5349 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5353 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5354 CHECK(!val->result_ok);
5355 LDKDecodeError err_var = (*val->contents.err);
5356 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5357 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5358 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5362 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5365 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5366 CHECK(val->result_ok);
5367 LDKFundingSigned res_var = (*val->contents.result);
5368 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5369 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5370 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5374 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5375 CHECK(!val->result_ok);
5376 LDKDecodeError err_var = (*val->contents.err);
5377 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5378 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5379 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5383 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5386 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5387 CHECK(val->result_ok);
5388 LDKFundingLocked res_var = (*val->contents.result);
5389 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5390 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5391 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5395 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5396 CHECK(!val->result_ok);
5397 LDKDecodeError err_var = (*val->contents.err);
5398 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5399 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5400 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5404 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5407 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5408 CHECK(val->result_ok);
5409 LDKInit res_var = (*val->contents.result);
5410 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5411 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5412 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5416 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5417 CHECK(!val->result_ok);
5418 LDKDecodeError err_var = (*val->contents.err);
5419 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5420 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5421 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5425 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5428 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5429 CHECK(val->result_ok);
5430 LDKOpenChannel res_var = (*val->contents.result);
5431 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5432 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5433 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5437 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5438 CHECK(!val->result_ok);
5439 LDKDecodeError err_var = (*val->contents.err);
5440 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5441 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5442 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5446 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5449 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5450 CHECK(val->result_ok);
5451 LDKRevokeAndACK res_var = (*val->contents.result);
5452 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5453 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5454 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5458 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5459 CHECK(!val->result_ok);
5460 LDKDecodeError err_var = (*val->contents.err);
5461 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5462 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5463 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5467 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5470 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5471 CHECK(val->result_ok);
5472 LDKShutdown res_var = (*val->contents.result);
5473 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5474 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5475 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5479 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5480 CHECK(!val->result_ok);
5481 LDKDecodeError err_var = (*val->contents.err);
5482 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5483 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5484 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5488 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5491 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5492 CHECK(val->result_ok);
5493 LDKUpdateFailHTLC res_var = (*val->contents.result);
5494 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5495 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5496 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5500 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5501 CHECK(!val->result_ok);
5502 LDKDecodeError err_var = (*val->contents.err);
5503 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5504 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5505 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5509 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5512 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5513 CHECK(val->result_ok);
5514 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5515 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5516 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5517 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5521 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5522 CHECK(!val->result_ok);
5523 LDKDecodeError err_var = (*val->contents.err);
5524 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5525 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5526 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5530 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5533 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5534 CHECK(val->result_ok);
5535 LDKUpdateFee res_var = (*val->contents.result);
5536 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5537 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5538 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5542 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5543 CHECK(!val->result_ok);
5544 LDKDecodeError err_var = (*val->contents.err);
5545 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5546 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5547 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5551 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5554 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5555 CHECK(val->result_ok);
5556 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5557 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5558 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5559 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5563 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5564 CHECK(!val->result_ok);
5565 LDKDecodeError err_var = (*val->contents.err);
5566 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5567 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5568 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5571 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5572 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5575 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5576 CHECK(val->result_ok);
5577 LDKUpdateAddHTLC res_var = (*val->contents.result);
5578 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5579 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5580 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5584 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5585 CHECK(!val->result_ok);
5586 LDKDecodeError err_var = (*val->contents.err);
5587 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5588 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5589 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5593 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5596 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5597 CHECK(val->result_ok);
5598 LDKPing res_var = (*val->contents.result);
5599 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5600 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5601 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5605 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5606 CHECK(!val->result_ok);
5607 LDKDecodeError err_var = (*val->contents.err);
5608 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5609 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5610 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5614 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5617 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5618 CHECK(val->result_ok);
5619 LDKPong res_var = (*val->contents.result);
5620 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5621 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5622 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5626 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5627 CHECK(!val->result_ok);
5628 LDKDecodeError err_var = (*val->contents.err);
5629 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5630 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5631 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5635 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5638 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5639 CHECK(val->result_ok);
5640 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5641 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5642 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5643 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5647 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5648 CHECK(!val->result_ok);
5649 LDKDecodeError err_var = (*val->contents.err);
5650 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5651 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5652 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5656 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5659 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5660 CHECK(val->result_ok);
5661 LDKChannelAnnouncement res_var = (*val->contents.result);
5662 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5663 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5664 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5668 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5669 CHECK(!val->result_ok);
5670 LDKDecodeError err_var = (*val->contents.err);
5671 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5672 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5673 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5677 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5680 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5681 CHECK(val->result_ok);
5682 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5683 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5684 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5685 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5689 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5690 CHECK(!val->result_ok);
5691 LDKDecodeError err_var = (*val->contents.err);
5692 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5693 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5694 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5698 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5701 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5702 CHECK(val->result_ok);
5703 LDKChannelUpdate res_var = (*val->contents.result);
5704 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5705 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5706 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5710 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5711 CHECK(!val->result_ok);
5712 LDKDecodeError err_var = (*val->contents.err);
5713 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5714 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5715 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5719 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5722 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5723 CHECK(val->result_ok);
5724 LDKErrorMessage res_var = (*val->contents.result);
5725 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5726 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5727 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5731 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5732 CHECK(!val->result_ok);
5733 LDKDecodeError err_var = (*val->contents.err);
5734 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5735 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5736 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5740 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5743 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5744 CHECK(val->result_ok);
5745 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5746 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5747 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5748 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5752 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5753 CHECK(!val->result_ok);
5754 LDKDecodeError err_var = (*val->contents.err);
5755 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5756 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5757 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5761 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5764 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5765 CHECK(val->result_ok);
5766 LDKNodeAnnouncement res_var = (*val->contents.result);
5767 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5768 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5769 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5773 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5774 CHECK(!val->result_ok);
5775 LDKDecodeError err_var = (*val->contents.err);
5776 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5777 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5778 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5781 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5782 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5785 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5786 CHECK(val->result_ok);
5787 LDKQueryShortChannelIds res_var = (*val->contents.result);
5788 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5789 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5790 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5794 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5795 CHECK(!val->result_ok);
5796 LDKDecodeError err_var = (*val->contents.err);
5797 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5798 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5799 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5803 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5806 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5807 CHECK(val->result_ok);
5808 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5809 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5810 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5811 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5815 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5816 CHECK(!val->result_ok);
5817 LDKDecodeError err_var = (*val->contents.err);
5818 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5819 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5820 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5824 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5827 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5828 CHECK(val->result_ok);
5829 LDKQueryChannelRange res_var = (*val->contents.result);
5830 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5831 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5832 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5836 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5837 CHECK(!val->result_ok);
5838 LDKDecodeError err_var = (*val->contents.err);
5839 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5840 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5841 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5845 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5848 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5849 CHECK(val->result_ok);
5850 LDKReplyChannelRange res_var = (*val->contents.result);
5851 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5852 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5853 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5857 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5858 CHECK(!val->result_ok);
5859 LDKDecodeError err_var = (*val->contents.err);
5860 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5861 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5862 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5866 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5869 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5870 CHECK(val->result_ok);
5871 LDKGossipTimestampFilter res_var = (*val->contents.result);
5872 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5873 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5874 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5878 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5879 CHECK(!val->result_ok);
5880 LDKDecodeError err_var = (*val->contents.err);
5881 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5882 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5883 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5886 static jclass LDKSignOrCreationError_SignError_class = NULL;
5887 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
5888 static jclass LDKSignOrCreationError_CreationError_class = NULL;
5889 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
5890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
5891 LDKSignOrCreationError_SignError_class =
5892 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
5893 CHECK(LDKSignOrCreationError_SignError_class != NULL);
5894 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
5895 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
5896 LDKSignOrCreationError_CreationError_class =
5897 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
5898 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
5899 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
5900 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
5902 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5903 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5905 case LDKSignOrCreationError_SignError: {
5906 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
5908 case LDKSignOrCreationError_CreationError: {
5909 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
5910 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
5915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5916 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5919 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5920 CHECK(val->result_ok);
5921 LDKInvoice res_var = (*val->contents.result);
5922 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5923 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5924 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5928 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5929 CHECK(!val->result_ok);
5930 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5933 typedef struct LDKMessageSendEventsProvider_JCalls {
5934 atomic_size_t refcnt;
5937 jmethodID get_and_clear_pending_msg_events_meth;
5938 } LDKMessageSendEventsProvider_JCalls;
5939 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5940 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5941 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5943 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5944 if (get_jenv_res == JNI_EDETACHED) {
5945 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5947 DO_ASSERT(get_jenv_res == JNI_OK);
5949 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5950 if (get_jenv_res == JNI_EDETACHED) {
5951 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5956 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5957 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5959 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5960 if (get_jenv_res == JNI_EDETACHED) {
5961 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5963 DO_ASSERT(get_jenv_res == JNI_OK);
5965 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5967 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
5968 LDKCVec_MessageSendEventZ ret_constr;
5969 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5970 if (ret_constr.datalen > 0)
5971 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5973 ret_constr.data = NULL;
5974 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5975 for (size_t s = 0; s < ret_constr.datalen; s++) {
5976 int64_t ret_conv_18 = ret_vals[s];
5977 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5978 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5979 ret_constr.data[s] = ret_conv_18_conv;
5981 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5982 if (get_jenv_res == JNI_EDETACHED) {
5983 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5987 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
5988 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5989 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5990 return (void*) this_arg;
5992 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
5993 jclass c = (*env)->GetObjectClass(env, o);
5995 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5996 atomic_init(&calls->refcnt, 1);
5997 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5998 calls->o = (*env)->NewWeakGlobalRef(env, o);
5999 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6000 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6002 LDKMessageSendEventsProvider ret = {
6003 .this_arg = (void*) calls,
6004 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6005 .free = LDKMessageSendEventsProvider_JCalls_free,
6009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6010 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6011 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6012 return (uint64_t)res_ptr;
6014 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6015 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6016 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6017 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6018 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6019 for (size_t s = 0; s < ret_var.datalen; s++) {
6020 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6021 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6022 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6023 ret_arr_ptr[s] = ret_conv_18_ref;
6025 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6030 typedef struct LDKEventHandler_JCalls {
6031 atomic_size_t refcnt;
6034 jmethodID handle_event_meth;
6035 } LDKEventHandler_JCalls;
6036 static void LDKEventHandler_JCalls_free(void* this_arg) {
6037 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6038 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6040 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6041 if (get_jenv_res == JNI_EDETACHED) {
6042 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6044 DO_ASSERT(get_jenv_res == JNI_OK);
6046 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6047 if (get_jenv_res == JNI_EDETACHED) {
6048 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6053 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6054 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6056 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6057 if (get_jenv_res == JNI_EDETACHED) {
6058 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6060 DO_ASSERT(get_jenv_res == JNI_OK);
6062 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6063 *event_copy = event;
6064 uint64_t event_ref = (uint64_t)event_copy;
6065 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6067 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6068 if (get_jenv_res == JNI_EDETACHED) {
6069 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6072 static void* LDKEventHandler_JCalls_clone(const void* this_arg) {
6073 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6074 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6075 return (void*) this_arg;
6077 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6078 jclass c = (*env)->GetObjectClass(env, o);
6080 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6081 atomic_init(&calls->refcnt, 1);
6082 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6083 calls->o = (*env)->NewWeakGlobalRef(env, o);
6084 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6085 CHECK(calls->handle_event_meth != NULL);
6087 LDKEventHandler ret = {
6088 .this_arg = (void*) calls,
6089 .handle_event = handle_event_LDKEventHandler_jcall,
6090 .free = LDKEventHandler_JCalls_free,
6094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6095 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6096 *res_ptr = LDKEventHandler_init(env, clz, o);
6097 return (uint64_t)res_ptr;
6099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6100 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6101 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6102 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6105 typedef struct LDKEventsProvider_JCalls {
6106 atomic_size_t refcnt;
6109 jmethodID process_pending_events_meth;
6110 } LDKEventsProvider_JCalls;
6111 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6112 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6113 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6115 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6116 if (get_jenv_res == JNI_EDETACHED) {
6117 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6119 DO_ASSERT(get_jenv_res == JNI_OK);
6121 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6122 if (get_jenv_res == JNI_EDETACHED) {
6123 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6128 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6129 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6131 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6132 if (get_jenv_res == JNI_EDETACHED) {
6133 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6135 DO_ASSERT(get_jenv_res == JNI_OK);
6137 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6139 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6141 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6142 if (get_jenv_res == JNI_EDETACHED) {
6143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6146 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
6147 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6148 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6149 return (void*) this_arg;
6151 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6152 jclass c = (*env)->GetObjectClass(env, o);
6154 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6155 atomic_init(&calls->refcnt, 1);
6156 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6157 calls->o = (*env)->NewWeakGlobalRef(env, o);
6158 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6159 CHECK(calls->process_pending_events_meth != NULL);
6161 LDKEventsProvider ret = {
6162 .this_arg = (void*) calls,
6163 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6164 .free = LDKEventsProvider_JCalls_free,
6168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6169 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6170 *res_ptr = LDKEventsProvider_init(env, clz, o);
6171 return (uint64_t)res_ptr;
6173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6174 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6175 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6176 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6177 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6178 LDKEventHandler_JCalls_clone(handler_conv.this_arg);
6180 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6183 typedef struct LDKAccess_JCalls {
6184 atomic_size_t refcnt;
6187 jmethodID get_utxo_meth;
6189 static void LDKAccess_JCalls_free(void* this_arg) {
6190 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6191 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6193 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6194 if (get_jenv_res == JNI_EDETACHED) {
6195 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6197 DO_ASSERT(get_jenv_res == JNI_OK);
6199 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6200 if (get_jenv_res == JNI_EDETACHED) {
6201 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6206 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6207 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6209 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6210 if (get_jenv_res == JNI_EDETACHED) {
6211 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6213 DO_ASSERT(get_jenv_res == JNI_OK);
6215 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6216 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6217 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6219 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6220 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6221 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6222 if (get_jenv_res == JNI_EDETACHED) {
6223 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6227 static void* LDKAccess_JCalls_clone(const void* this_arg) {
6228 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6229 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6230 return (void*) this_arg;
6232 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6233 jclass c = (*env)->GetObjectClass(env, o);
6235 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6236 atomic_init(&calls->refcnt, 1);
6237 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6238 calls->o = (*env)->NewWeakGlobalRef(env, o);
6239 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6240 CHECK(calls->get_utxo_meth != NULL);
6243 .this_arg = (void*) calls,
6244 .get_utxo = get_utxo_LDKAccess_jcall,
6245 .free = LDKAccess_JCalls_free,
6249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6250 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6251 *res_ptr = LDKAccess_init(env, clz, o);
6252 return (uint64_t)res_ptr;
6254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
6255 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6256 unsigned char genesis_hash_arr[32];
6257 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6258 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6259 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6260 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6261 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6262 return (uint64_t)ret_conv;
6265 typedef struct LDKListen_JCalls {
6266 atomic_size_t refcnt;
6269 jmethodID block_connected_meth;
6270 jmethodID block_disconnected_meth;
6272 static void LDKListen_JCalls_free(void* this_arg) {
6273 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6274 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6276 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6277 if (get_jenv_res == JNI_EDETACHED) {
6278 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6280 DO_ASSERT(get_jenv_res == JNI_OK);
6282 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6283 if (get_jenv_res == JNI_EDETACHED) {
6284 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6289 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6290 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6292 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6293 if (get_jenv_res == JNI_EDETACHED) {
6294 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6296 DO_ASSERT(get_jenv_res == JNI_OK);
6298 LDKu8slice block_var = block;
6299 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6300 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6301 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6303 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6304 if (get_jenv_res == JNI_EDETACHED) {
6305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6308 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6309 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6311 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6312 if (get_jenv_res == JNI_EDETACHED) {
6313 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6315 DO_ASSERT(get_jenv_res == JNI_OK);
6317 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6318 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6319 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6321 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6322 if (get_jenv_res == JNI_EDETACHED) {
6323 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6326 static void* LDKListen_JCalls_clone(const void* this_arg) {
6327 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6328 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6329 return (void*) this_arg;
6331 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6332 jclass c = (*env)->GetObjectClass(env, o);
6334 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6335 atomic_init(&calls->refcnt, 1);
6336 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6337 calls->o = (*env)->NewWeakGlobalRef(env, o);
6338 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6339 CHECK(calls->block_connected_meth != NULL);
6340 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6341 CHECK(calls->block_disconnected_meth != NULL);
6344 .this_arg = (void*) calls,
6345 .block_connected = block_connected_LDKListen_jcall,
6346 .block_disconnected = block_disconnected_LDKListen_jcall,
6347 .free = LDKListen_JCalls_free,
6351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6352 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6353 *res_ptr = LDKListen_init(env, clz, o);
6354 return (uint64_t)res_ptr;
6356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) {
6357 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6358 LDKu8slice block_ref;
6359 block_ref.datalen = (*env)->GetArrayLength(env, block);
6360 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6361 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6362 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
6366 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6367 unsigned char header_arr[80];
6368 CHECK((*env)->GetArrayLength(env, header) == 80);
6369 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6370 unsigned char (*header_ref)[80] = &header_arr;
6371 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6374 typedef struct LDKConfirm_JCalls {
6375 atomic_size_t refcnt;
6378 jmethodID transactions_confirmed_meth;
6379 jmethodID transaction_unconfirmed_meth;
6380 jmethodID best_block_updated_meth;
6381 jmethodID get_relevant_txids_meth;
6382 } LDKConfirm_JCalls;
6383 static void LDKConfirm_JCalls_free(void* this_arg) {
6384 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6385 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6387 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6388 if (get_jenv_res == JNI_EDETACHED) {
6389 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6391 DO_ASSERT(get_jenv_res == JNI_OK);
6393 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6394 if (get_jenv_res == JNI_EDETACHED) {
6395 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6400 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6401 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6403 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6404 if (get_jenv_res == JNI_EDETACHED) {
6405 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6407 DO_ASSERT(get_jenv_res == JNI_OK);
6409 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6410 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6411 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6412 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6413 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6414 for (size_t y = 0; y < txdata_var.datalen; y++) {
6415 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6416 *txdata_conv_24_ref = txdata_var.data[y];
6417 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6419 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6420 FREE(txdata_var.data);
6421 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6423 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6424 if (get_jenv_res == JNI_EDETACHED) {
6425 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6428 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6429 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6431 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6432 if (get_jenv_res == JNI_EDETACHED) {
6433 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6435 DO_ASSERT(get_jenv_res == JNI_OK);
6437 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6438 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6439 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6441 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6442 if (get_jenv_res == JNI_EDETACHED) {
6443 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6446 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6447 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6449 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6450 if (get_jenv_res == JNI_EDETACHED) {
6451 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6453 DO_ASSERT(get_jenv_res == JNI_OK);
6455 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6456 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6457 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6459 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6460 if (get_jenv_res == JNI_EDETACHED) {
6461 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6464 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6465 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6467 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6468 if (get_jenv_res == JNI_EDETACHED) {
6469 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6471 DO_ASSERT(get_jenv_res == JNI_OK);
6473 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6475 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6476 LDKCVec_TxidZ ret_constr;
6477 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6478 if (ret_constr.datalen > 0)
6479 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6481 ret_constr.data = NULL;
6482 for (size_t i = 0; i < ret_constr.datalen; i++) {
6483 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6484 LDKThirtyTwoBytes ret_conv_8_ref;
6485 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6486 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6487 ret_constr.data[i] = ret_conv_8_ref;
6489 if (get_jenv_res == JNI_EDETACHED) {
6490 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6494 static void* LDKConfirm_JCalls_clone(const void* this_arg) {
6495 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6496 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6497 return (void*) this_arg;
6499 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6500 jclass c = (*env)->GetObjectClass(env, o);
6502 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6503 atomic_init(&calls->refcnt, 1);
6504 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6505 calls->o = (*env)->NewWeakGlobalRef(env, o);
6506 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6507 CHECK(calls->transactions_confirmed_meth != NULL);
6508 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6509 CHECK(calls->transaction_unconfirmed_meth != NULL);
6510 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6511 CHECK(calls->best_block_updated_meth != NULL);
6512 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6513 CHECK(calls->get_relevant_txids_meth != NULL);
6516 .this_arg = (void*) calls,
6517 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6518 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6519 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6520 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6521 .free = LDKConfirm_JCalls_free,
6525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6526 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6527 *res_ptr = LDKConfirm_init(env, clz, o);
6528 return (uint64_t)res_ptr;
6530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
6531 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6532 unsigned char header_arr[80];
6533 CHECK((*env)->GetArrayLength(env, header) == 80);
6534 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6535 unsigned char (*header_ref)[80] = &header_arr;
6536 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6537 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6538 if (txdata_constr.datalen > 0)
6539 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6541 txdata_constr.data = NULL;
6542 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6543 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6544 int64_t txdata_conv_24 = txdata_vals[y];
6545 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6546 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6547 txdata_constr.data[y] = txdata_conv_24_conv;
6549 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6550 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6554 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6555 unsigned char txid_arr[32];
6556 CHECK((*env)->GetArrayLength(env, txid) == 32);
6557 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6558 unsigned char (*txid_ref)[32] = &txid_arr;
6559 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
6563 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6564 unsigned char header_arr[80];
6565 CHECK((*env)->GetArrayLength(env, header) == 80);
6566 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6567 unsigned char (*header_ref)[80] = &header_arr;
6568 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6571 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6572 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6573 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6574 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6576 for (size_t i = 0; i < ret_var.datalen; i++) {
6577 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6578 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6579 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6585 typedef struct LDKFilter_JCalls {
6586 atomic_size_t refcnt;
6589 jmethodID register_tx_meth;
6590 jmethodID register_output_meth;
6592 static void LDKFilter_JCalls_free(void* this_arg) {
6593 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6594 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6596 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6597 if (get_jenv_res == JNI_EDETACHED) {
6598 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6600 DO_ASSERT(get_jenv_res == JNI_OK);
6602 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6603 if (get_jenv_res == JNI_EDETACHED) {
6604 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6609 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6610 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6612 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6613 if (get_jenv_res == JNI_EDETACHED) {
6614 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6616 DO_ASSERT(get_jenv_res == JNI_OK);
6618 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6619 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6620 LDKu8slice script_pubkey_var = script_pubkey;
6621 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6622 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6623 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6625 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6626 if (get_jenv_res == JNI_EDETACHED) {
6627 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6630 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6631 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6633 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6634 if (get_jenv_res == JNI_EDETACHED) {
6635 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6637 DO_ASSERT(get_jenv_res == JNI_OK);
6639 LDKWatchedOutput output_var = output;
6640 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6641 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6642 uint64_t output_ref = (uint64_t)output_var.inner;
6643 if (output_var.is_owned) {
6646 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6648 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6649 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6650 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6651 if (get_jenv_res == JNI_EDETACHED) {
6652 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6656 static void* LDKFilter_JCalls_clone(const void* this_arg) {
6657 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6658 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6659 return (void*) this_arg;
6661 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
6662 jclass c = (*env)->GetObjectClass(env, o);
6664 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
6665 atomic_init(&calls->refcnt, 1);
6666 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6667 calls->o = (*env)->NewWeakGlobalRef(env, o);
6668 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
6669 CHECK(calls->register_tx_meth != NULL);
6670 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
6671 CHECK(calls->register_output_meth != NULL);
6674 .this_arg = (void*) calls,
6675 .register_tx = register_tx_LDKFilter_jcall,
6676 .register_output = register_output_LDKFilter_jcall,
6677 .free = LDKFilter_JCalls_free,
6681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
6682 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
6683 *res_ptr = LDKFilter_init(env, clz, o);
6684 return (uint64_t)res_ptr;
6686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
6687 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6688 unsigned char txid_arr[32];
6689 CHECK((*env)->GetArrayLength(env, txid) == 32);
6690 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6691 unsigned char (*txid_ref)[32] = &txid_arr;
6692 LDKu8slice script_pubkey_ref;
6693 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
6694 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
6695 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
6696 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
6699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
6700 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6701 LDKWatchedOutput output_conv;
6702 output_conv.inner = (void*)(output & (~1));
6703 output_conv.is_owned = (output & 1) || (output == 0);
6704 output_conv = WatchedOutput_clone(&output_conv);
6705 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
6706 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
6707 uint64_t ret_ref = (uint64_t)ret_copy;
6711 typedef struct LDKPersist_JCalls {
6712 atomic_size_t refcnt;
6715 jmethodID persist_new_channel_meth;
6716 jmethodID update_persisted_channel_meth;
6717 } LDKPersist_JCalls;
6718 static void LDKPersist_JCalls_free(void* this_arg) {
6719 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6720 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6722 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6723 if (get_jenv_res == JNI_EDETACHED) {
6724 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6726 DO_ASSERT(get_jenv_res == JNI_OK);
6728 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6729 if (get_jenv_res == JNI_EDETACHED) {
6730 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6735 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
6736 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6738 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6739 if (get_jenv_res == JNI_EDETACHED) {
6740 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6742 DO_ASSERT(get_jenv_res == JNI_OK);
6744 LDKOutPoint id_var = id;
6745 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6746 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6747 uint64_t id_ref = (uint64_t)id_var.inner;
6748 if (id_var.is_owned) {
6751 LDKChannelMonitor data_var = *data;
6752 data_var = ChannelMonitor_clone(data);
6753 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6754 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6755 uint64_t data_ref = (uint64_t)data_var.inner;
6756 if (data_var.is_owned) {
6759 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6761 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
6762 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6763 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6764 if (get_jenv_res == JNI_EDETACHED) {
6765 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6769 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
6770 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6772 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6773 if (get_jenv_res == JNI_EDETACHED) {
6774 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6776 DO_ASSERT(get_jenv_res == JNI_OK);
6778 LDKOutPoint id_var = id;
6779 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6780 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6781 uint64_t id_ref = (uint64_t)id_var.inner;
6782 if (id_var.is_owned) {
6785 LDKChannelMonitorUpdate update_var = *update;
6786 update_var = ChannelMonitorUpdate_clone(update);
6787 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6788 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6789 uint64_t update_ref = (uint64_t)update_var.inner;
6790 if (update_var.is_owned) {
6793 LDKChannelMonitor data_var = *data;
6794 data_var = ChannelMonitor_clone(data);
6795 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6796 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6797 uint64_t data_ref = (uint64_t)data_var.inner;
6798 if (data_var.is_owned) {
6801 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6803 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
6804 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6805 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6806 if (get_jenv_res == JNI_EDETACHED) {
6807 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6811 static void* LDKPersist_JCalls_clone(const void* this_arg) {
6812 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6813 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6814 return (void*) this_arg;
6816 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
6817 jclass c = (*env)->GetObjectClass(env, o);
6819 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6820 atomic_init(&calls->refcnt, 1);
6821 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6822 calls->o = (*env)->NewWeakGlobalRef(env, o);
6823 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
6824 CHECK(calls->persist_new_channel_meth != NULL);
6825 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
6826 CHECK(calls->update_persisted_channel_meth != NULL);
6829 .this_arg = (void*) calls,
6830 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6831 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6832 .free = LDKPersist_JCalls_free,
6836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
6837 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6838 *res_ptr = LDKPersist_init(env, clz, o);
6839 return (uint64_t)res_ptr;
6841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) {
6842 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6843 LDKOutPoint id_conv;
6844 id_conv.inner = (void*)(id & (~1));
6845 id_conv.is_owned = (id & 1) || (id == 0);
6846 id_conv = OutPoint_clone(&id_conv);
6847 LDKChannelMonitor data_conv;
6848 data_conv.inner = (void*)(data & (~1));
6849 data_conv.is_owned = false;
6850 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6851 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
6852 return (uint64_t)ret_conv;
6855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) {
6856 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6857 LDKOutPoint id_conv;
6858 id_conv.inner = (void*)(id & (~1));
6859 id_conv.is_owned = (id & 1) || (id == 0);
6860 id_conv = OutPoint_clone(&id_conv);
6861 LDKChannelMonitorUpdate update_conv;
6862 update_conv.inner = (void*)(update & (~1));
6863 update_conv.is_owned = false;
6864 LDKChannelMonitor data_conv;
6865 data_conv.inner = (void*)(data & (~1));
6866 data_conv.is_owned = false;
6867 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6868 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
6869 return (uint64_t)ret_conv;
6872 typedef struct LDKChannelMessageHandler_JCalls {
6873 atomic_size_t refcnt;
6876 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6877 jmethodID handle_open_channel_meth;
6878 jmethodID handle_accept_channel_meth;
6879 jmethodID handle_funding_created_meth;
6880 jmethodID handle_funding_signed_meth;
6881 jmethodID handle_funding_locked_meth;
6882 jmethodID handle_shutdown_meth;
6883 jmethodID handle_closing_signed_meth;
6884 jmethodID handle_update_add_htlc_meth;
6885 jmethodID handle_update_fulfill_htlc_meth;
6886 jmethodID handle_update_fail_htlc_meth;
6887 jmethodID handle_update_fail_malformed_htlc_meth;
6888 jmethodID handle_commitment_signed_meth;
6889 jmethodID handle_revoke_and_ack_meth;
6890 jmethodID handle_update_fee_meth;
6891 jmethodID handle_announcement_signatures_meth;
6892 jmethodID peer_disconnected_meth;
6893 jmethodID peer_connected_meth;
6894 jmethodID handle_channel_reestablish_meth;
6895 jmethodID handle_channel_update_meth;
6896 jmethodID handle_error_meth;
6897 } LDKChannelMessageHandler_JCalls;
6898 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6899 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6900 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6902 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6903 if (get_jenv_res == JNI_EDETACHED) {
6904 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6906 DO_ASSERT(get_jenv_res == JNI_OK);
6908 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6909 if (get_jenv_res == JNI_EDETACHED) {
6910 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6915 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6916 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6918 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6919 if (get_jenv_res == JNI_EDETACHED) {
6920 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6922 DO_ASSERT(get_jenv_res == JNI_OK);
6924 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6925 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6926 LDKInitFeatures their_features_var = their_features;
6927 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6928 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6929 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6930 if (their_features_var.is_owned) {
6931 their_features_ref |= 1;
6933 LDKOpenChannel msg_var = *msg;
6934 msg_var = OpenChannel_clone(msg);
6935 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6936 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6937 uint64_t msg_ref = (uint64_t)msg_var.inner;
6938 if (msg_var.is_owned) {
6941 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6943 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6944 if (get_jenv_res == JNI_EDETACHED) {
6945 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6948 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6949 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6951 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6952 if (get_jenv_res == JNI_EDETACHED) {
6953 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6955 DO_ASSERT(get_jenv_res == JNI_OK);
6957 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6958 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6959 LDKInitFeatures their_features_var = their_features;
6960 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6961 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6962 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6963 if (their_features_var.is_owned) {
6964 their_features_ref |= 1;
6966 LDKAcceptChannel msg_var = *msg;
6967 msg_var = AcceptChannel_clone(msg);
6968 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6969 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6970 uint64_t msg_ref = (uint64_t)msg_var.inner;
6971 if (msg_var.is_owned) {
6974 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6976 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6977 if (get_jenv_res == JNI_EDETACHED) {
6978 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6981 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6982 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6984 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6985 if (get_jenv_res == JNI_EDETACHED) {
6986 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6988 DO_ASSERT(get_jenv_res == JNI_OK);
6990 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6991 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6992 LDKFundingCreated msg_var = *msg;
6993 msg_var = FundingCreated_clone(msg);
6994 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6995 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6996 uint64_t msg_ref = (uint64_t)msg_var.inner;
6997 if (msg_var.is_owned) {
7000 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7002 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7003 if (get_jenv_res == JNI_EDETACHED) {
7004 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7007 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7008 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7010 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7011 if (get_jenv_res == JNI_EDETACHED) {
7012 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7014 DO_ASSERT(get_jenv_res == JNI_OK);
7016 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7017 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7018 LDKFundingSigned msg_var = *msg;
7019 msg_var = FundingSigned_clone(msg);
7020 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7021 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7022 uint64_t msg_ref = (uint64_t)msg_var.inner;
7023 if (msg_var.is_owned) {
7026 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7028 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7029 if (get_jenv_res == JNI_EDETACHED) {
7030 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7033 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7034 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7036 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7037 if (get_jenv_res == JNI_EDETACHED) {
7038 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7040 DO_ASSERT(get_jenv_res == JNI_OK);
7042 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7043 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7044 LDKFundingLocked msg_var = *msg;
7045 msg_var = FundingLocked_clone(msg);
7046 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7047 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7048 uint64_t msg_ref = (uint64_t)msg_var.inner;
7049 if (msg_var.is_owned) {
7052 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7054 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7055 if (get_jenv_res == JNI_EDETACHED) {
7056 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7059 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7060 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7062 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7063 if (get_jenv_res == JNI_EDETACHED) {
7064 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7066 DO_ASSERT(get_jenv_res == JNI_OK);
7068 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7069 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7070 LDKInitFeatures their_features_var = *their_features;
7071 their_features_var = InitFeatures_clone(their_features);
7072 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7073 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7074 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7075 if (their_features_var.is_owned) {
7076 their_features_ref |= 1;
7078 LDKShutdown msg_var = *msg;
7079 msg_var = Shutdown_clone(msg);
7080 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7081 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7082 uint64_t msg_ref = (uint64_t)msg_var.inner;
7083 if (msg_var.is_owned) {
7086 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7088 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7089 if (get_jenv_res == JNI_EDETACHED) {
7090 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7093 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7094 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7096 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7097 if (get_jenv_res == JNI_EDETACHED) {
7098 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7100 DO_ASSERT(get_jenv_res == JNI_OK);
7102 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7103 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7104 LDKClosingSigned msg_var = *msg;
7105 msg_var = ClosingSigned_clone(msg);
7106 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7107 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7108 uint64_t msg_ref = (uint64_t)msg_var.inner;
7109 if (msg_var.is_owned) {
7112 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7114 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7115 if (get_jenv_res == JNI_EDETACHED) {
7116 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7119 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7120 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7122 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7123 if (get_jenv_res == JNI_EDETACHED) {
7124 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7126 DO_ASSERT(get_jenv_res == JNI_OK);
7128 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7129 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7130 LDKUpdateAddHTLC msg_var = *msg;
7131 msg_var = UpdateAddHTLC_clone(msg);
7132 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7133 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7134 uint64_t msg_ref = (uint64_t)msg_var.inner;
7135 if (msg_var.is_owned) {
7138 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7140 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7141 if (get_jenv_res == JNI_EDETACHED) {
7142 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7145 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7146 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7148 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7149 if (get_jenv_res == JNI_EDETACHED) {
7150 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7152 DO_ASSERT(get_jenv_res == JNI_OK);
7154 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7155 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7156 LDKUpdateFulfillHTLC msg_var = *msg;
7157 msg_var = UpdateFulfillHTLC_clone(msg);
7158 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7159 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7160 uint64_t msg_ref = (uint64_t)msg_var.inner;
7161 if (msg_var.is_owned) {
7164 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7166 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7167 if (get_jenv_res == JNI_EDETACHED) {
7168 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7171 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7172 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7174 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7175 if (get_jenv_res == JNI_EDETACHED) {
7176 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7178 DO_ASSERT(get_jenv_res == JNI_OK);
7180 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7181 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7182 LDKUpdateFailHTLC msg_var = *msg;
7183 msg_var = UpdateFailHTLC_clone(msg);
7184 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7185 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7186 uint64_t msg_ref = (uint64_t)msg_var.inner;
7187 if (msg_var.is_owned) {
7190 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7192 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7193 if (get_jenv_res == JNI_EDETACHED) {
7194 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7197 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7198 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7200 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7201 if (get_jenv_res == JNI_EDETACHED) {
7202 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7204 DO_ASSERT(get_jenv_res == JNI_OK);
7206 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7207 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7208 LDKUpdateFailMalformedHTLC msg_var = *msg;
7209 msg_var = UpdateFailMalformedHTLC_clone(msg);
7210 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7211 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7212 uint64_t msg_ref = (uint64_t)msg_var.inner;
7213 if (msg_var.is_owned) {
7216 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7218 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7219 if (get_jenv_res == JNI_EDETACHED) {
7220 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7223 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7224 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7226 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7227 if (get_jenv_res == JNI_EDETACHED) {
7228 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7230 DO_ASSERT(get_jenv_res == JNI_OK);
7232 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7233 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7234 LDKCommitmentSigned msg_var = *msg;
7235 msg_var = CommitmentSigned_clone(msg);
7236 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7237 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7238 uint64_t msg_ref = (uint64_t)msg_var.inner;
7239 if (msg_var.is_owned) {
7242 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7244 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7245 if (get_jenv_res == JNI_EDETACHED) {
7246 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7249 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7250 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7252 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7253 if (get_jenv_res == JNI_EDETACHED) {
7254 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7256 DO_ASSERT(get_jenv_res == JNI_OK);
7258 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7259 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7260 LDKRevokeAndACK msg_var = *msg;
7261 msg_var = RevokeAndACK_clone(msg);
7262 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7263 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7264 uint64_t msg_ref = (uint64_t)msg_var.inner;
7265 if (msg_var.is_owned) {
7268 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7270 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7271 if (get_jenv_res == JNI_EDETACHED) {
7272 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7275 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7276 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7278 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7279 if (get_jenv_res == JNI_EDETACHED) {
7280 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7282 DO_ASSERT(get_jenv_res == JNI_OK);
7284 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7285 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7286 LDKUpdateFee msg_var = *msg;
7287 msg_var = UpdateFee_clone(msg);
7288 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7289 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7290 uint64_t msg_ref = (uint64_t)msg_var.inner;
7291 if (msg_var.is_owned) {
7294 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7296 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7297 if (get_jenv_res == JNI_EDETACHED) {
7298 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7301 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7302 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7304 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7305 if (get_jenv_res == JNI_EDETACHED) {
7306 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7308 DO_ASSERT(get_jenv_res == JNI_OK);
7310 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7311 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7312 LDKAnnouncementSignatures msg_var = *msg;
7313 msg_var = AnnouncementSignatures_clone(msg);
7314 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7315 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7316 uint64_t msg_ref = (uint64_t)msg_var.inner;
7317 if (msg_var.is_owned) {
7320 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7322 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7323 if (get_jenv_res == JNI_EDETACHED) {
7324 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7327 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7328 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7330 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7331 if (get_jenv_res == JNI_EDETACHED) {
7332 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7334 DO_ASSERT(get_jenv_res == JNI_OK);
7336 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7337 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7338 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7340 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7341 if (get_jenv_res == JNI_EDETACHED) {
7342 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7345 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7346 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7348 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7349 if (get_jenv_res == JNI_EDETACHED) {
7350 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7352 DO_ASSERT(get_jenv_res == JNI_OK);
7354 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7355 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7356 LDKInit msg_var = *msg;
7357 msg_var = Init_clone(msg);
7358 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7359 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7360 uint64_t msg_ref = (uint64_t)msg_var.inner;
7361 if (msg_var.is_owned) {
7364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7366 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7367 if (get_jenv_res == JNI_EDETACHED) {
7368 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7371 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7372 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7374 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7375 if (get_jenv_res == JNI_EDETACHED) {
7376 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7378 DO_ASSERT(get_jenv_res == JNI_OK);
7380 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7381 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7382 LDKChannelReestablish msg_var = *msg;
7383 msg_var = ChannelReestablish_clone(msg);
7384 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7385 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7386 uint64_t msg_ref = (uint64_t)msg_var.inner;
7387 if (msg_var.is_owned) {
7390 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7392 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7393 if (get_jenv_res == JNI_EDETACHED) {
7394 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7397 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7398 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7400 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7401 if (get_jenv_res == JNI_EDETACHED) {
7402 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7404 DO_ASSERT(get_jenv_res == JNI_OK);
7406 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7407 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7408 LDKChannelUpdate msg_var = *msg;
7409 msg_var = ChannelUpdate_clone(msg);
7410 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7411 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7412 uint64_t msg_ref = (uint64_t)msg_var.inner;
7413 if (msg_var.is_owned) {
7416 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7418 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
7419 if (get_jenv_res == JNI_EDETACHED) {
7420 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7423 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7424 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7426 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7427 if (get_jenv_res == JNI_EDETACHED) {
7428 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7430 DO_ASSERT(get_jenv_res == JNI_OK);
7432 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7433 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7434 LDKErrorMessage msg_var = *msg;
7435 msg_var = ErrorMessage_clone(msg);
7436 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7437 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7438 uint64_t msg_ref = (uint64_t)msg_var.inner;
7439 if (msg_var.is_owned) {
7442 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7444 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7445 if (get_jenv_res == JNI_EDETACHED) {
7446 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7449 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
7450 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7451 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7452 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7453 return (void*) this_arg;
7455 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7456 jclass c = (*env)->GetObjectClass(env, o);
7458 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7459 atomic_init(&calls->refcnt, 1);
7460 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7461 calls->o = (*env)->NewWeakGlobalRef(env, o);
7462 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7463 CHECK(calls->handle_open_channel_meth != NULL);
7464 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7465 CHECK(calls->handle_accept_channel_meth != NULL);
7466 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7467 CHECK(calls->handle_funding_created_meth != NULL);
7468 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7469 CHECK(calls->handle_funding_signed_meth != NULL);
7470 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7471 CHECK(calls->handle_funding_locked_meth != NULL);
7472 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7473 CHECK(calls->handle_shutdown_meth != NULL);
7474 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7475 CHECK(calls->handle_closing_signed_meth != NULL);
7476 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7477 CHECK(calls->handle_update_add_htlc_meth != NULL);
7478 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7479 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7480 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7481 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7482 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7483 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7484 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7485 CHECK(calls->handle_commitment_signed_meth != NULL);
7486 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7487 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7488 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7489 CHECK(calls->handle_update_fee_meth != NULL);
7490 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7491 CHECK(calls->handle_announcement_signatures_meth != NULL);
7492 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7493 CHECK(calls->peer_disconnected_meth != NULL);
7494 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7495 CHECK(calls->peer_connected_meth != NULL);
7496 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7497 CHECK(calls->handle_channel_reestablish_meth != NULL);
7498 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7499 CHECK(calls->handle_channel_update_meth != NULL);
7500 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7501 CHECK(calls->handle_error_meth != NULL);
7503 LDKChannelMessageHandler ret = {
7504 .this_arg = (void*) calls,
7505 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7506 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7507 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7508 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7509 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7510 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7511 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7512 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7513 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7514 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7515 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7516 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7517 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7518 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7519 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7520 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7521 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7522 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7523 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7524 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7525 .free = LDKChannelMessageHandler_JCalls_free,
7526 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7528 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7532 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7533 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7534 return (uint64_t)res_ptr;
7536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
7537 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7538 LDKPublicKey their_node_id_ref;
7539 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7540 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7541 LDKInitFeatures their_features_conv;
7542 their_features_conv.inner = (void*)(their_features & (~1));
7543 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7544 their_features_conv = InitFeatures_clone(&their_features_conv);
7545 LDKOpenChannel msg_conv;
7546 msg_conv.inner = (void*)(msg & (~1));
7547 msg_conv.is_owned = false;
7548 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
7552 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7553 LDKPublicKey their_node_id_ref;
7554 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7555 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7556 LDKInitFeatures their_features_conv;
7557 their_features_conv.inner = (void*)(their_features & (~1));
7558 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7559 their_features_conv = InitFeatures_clone(&their_features_conv);
7560 LDKAcceptChannel msg_conv;
7561 msg_conv.inner = (void*)(msg & (~1));
7562 msg_conv.is_owned = false;
7563 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7567 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7568 LDKPublicKey their_node_id_ref;
7569 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7570 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7571 LDKFundingCreated msg_conv;
7572 msg_conv.inner = (void*)(msg & (~1));
7573 msg_conv.is_owned = false;
7574 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7578 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7579 LDKPublicKey their_node_id_ref;
7580 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7581 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7582 LDKFundingSigned msg_conv;
7583 msg_conv.inner = (void*)(msg & (~1));
7584 msg_conv.is_owned = false;
7585 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7589 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7590 LDKPublicKey their_node_id_ref;
7591 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7592 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7593 LDKFundingLocked msg_conv;
7594 msg_conv.inner = (void*)(msg & (~1));
7595 msg_conv.is_owned = false;
7596 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
7600 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7601 LDKPublicKey their_node_id_ref;
7602 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7603 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7604 LDKInitFeatures their_features_conv;
7605 their_features_conv.inner = (void*)(their_features & (~1));
7606 their_features_conv.is_owned = false;
7607 LDKShutdown msg_conv;
7608 msg_conv.inner = (void*)(msg & (~1));
7609 msg_conv.is_owned = false;
7610 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7614 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7615 LDKPublicKey their_node_id_ref;
7616 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7617 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7618 LDKClosingSigned msg_conv;
7619 msg_conv.inner = (void*)(msg & (~1));
7620 msg_conv.is_owned = false;
7621 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1add_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7625 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7626 LDKPublicKey their_node_id_ref;
7627 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7628 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7629 LDKUpdateAddHTLC msg_conv;
7630 msg_conv.inner = (void*)(msg & (~1));
7631 msg_conv.is_owned = false;
7632 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fulfill_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7636 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7637 LDKPublicKey their_node_id_ref;
7638 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7639 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7640 LDKUpdateFulfillHTLC msg_conv;
7641 msg_conv.inner = (void*)(msg & (~1));
7642 msg_conv.is_owned = false;
7643 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7647 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7648 LDKPublicKey their_node_id_ref;
7649 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7650 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7651 LDKUpdateFailHTLC msg_conv;
7652 msg_conv.inner = (void*)(msg & (~1));
7653 msg_conv.is_owned = false;
7654 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7658 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7659 LDKPublicKey their_node_id_ref;
7660 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7661 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7662 LDKUpdateFailMalformedHTLC msg_conv;
7663 msg_conv.inner = (void*)(msg & (~1));
7664 msg_conv.is_owned = false;
7665 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7669 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7670 LDKPublicKey their_node_id_ref;
7671 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7672 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7673 LDKCommitmentSigned msg_conv;
7674 msg_conv.inner = (void*)(msg & (~1));
7675 msg_conv.is_owned = false;
7676 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1revoke_1and_1ack(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7680 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7681 LDKPublicKey their_node_id_ref;
7682 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7683 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7684 LDKRevokeAndACK msg_conv;
7685 msg_conv.inner = (void*)(msg & (~1));
7686 msg_conv.is_owned = false;
7687 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fee(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7691 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7692 LDKPublicKey their_node_id_ref;
7693 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7694 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7695 LDKUpdateFee msg_conv;
7696 msg_conv.inner = (void*)(msg & (~1));
7697 msg_conv.is_owned = false;
7698 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1announcement_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7702 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7703 LDKPublicKey their_node_id_ref;
7704 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7705 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7706 LDKAnnouncementSignatures msg_conv;
7707 msg_conv.inner = (void*)(msg & (~1));
7708 msg_conv.is_owned = false;
7709 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
7713 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7714 LDKPublicKey their_node_id_ref;
7715 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7716 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7717 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7721 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7722 LDKPublicKey their_node_id_ref;
7723 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7724 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7726 msg_conv.inner = (void*)(msg & (~1));
7727 msg_conv.is_owned = false;
7728 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7732 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7733 LDKPublicKey their_node_id_ref;
7734 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7735 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7736 LDKChannelReestablish msg_conv;
7737 msg_conv.inner = (void*)(msg & (~1));
7738 msg_conv.is_owned = false;
7739 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7743 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7744 LDKPublicKey their_node_id_ref;
7745 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7746 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7747 LDKChannelUpdate msg_conv;
7748 msg_conv.inner = (void*)(msg & (~1));
7749 msg_conv.is_owned = false;
7750 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
7754 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7755 LDKPublicKey their_node_id_ref;
7756 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7757 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7758 LDKErrorMessage msg_conv;
7759 msg_conv.inner = (void*)(msg & (~1));
7760 msg_conv.is_owned = false;
7761 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7764 typedef struct LDKRoutingMessageHandler_JCalls {
7765 atomic_size_t refcnt;
7768 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7769 jmethodID handle_node_announcement_meth;
7770 jmethodID handle_channel_announcement_meth;
7771 jmethodID handle_channel_update_meth;
7772 jmethodID handle_htlc_fail_channel_update_meth;
7773 jmethodID get_next_channel_announcements_meth;
7774 jmethodID get_next_node_announcements_meth;
7775 jmethodID sync_routing_table_meth;
7776 jmethodID handle_reply_channel_range_meth;
7777 jmethodID handle_reply_short_channel_ids_end_meth;
7778 jmethodID handle_query_channel_range_meth;
7779 jmethodID handle_query_short_channel_ids_meth;
7780 } LDKRoutingMessageHandler_JCalls;
7781 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
7782 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7783 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7785 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7786 if (get_jenv_res == JNI_EDETACHED) {
7787 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7789 DO_ASSERT(get_jenv_res == JNI_OK);
7791 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7792 if (get_jenv_res == JNI_EDETACHED) {
7793 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7798 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
7799 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7801 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7802 if (get_jenv_res == JNI_EDETACHED) {
7803 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7805 DO_ASSERT(get_jenv_res == JNI_OK);
7807 LDKNodeAnnouncement msg_var = *msg;
7808 msg_var = NodeAnnouncement_clone(msg);
7809 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7810 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7811 uint64_t msg_ref = (uint64_t)msg_var.inner;
7812 if (msg_var.is_owned) {
7815 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7817 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
7818 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7819 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7820 if (get_jenv_res == JNI_EDETACHED) {
7821 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7825 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
7826 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7828 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7829 if (get_jenv_res == JNI_EDETACHED) {
7830 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7832 DO_ASSERT(get_jenv_res == JNI_OK);
7834 LDKChannelAnnouncement msg_var = *msg;
7835 msg_var = ChannelAnnouncement_clone(msg);
7836 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7837 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7838 uint64_t msg_ref = (uint64_t)msg_var.inner;
7839 if (msg_var.is_owned) {
7842 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7844 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
7845 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7846 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7847 if (get_jenv_res == JNI_EDETACHED) {
7848 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7852 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
7853 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7855 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7856 if (get_jenv_res == JNI_EDETACHED) {
7857 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7859 DO_ASSERT(get_jenv_res == JNI_OK);
7861 LDKChannelUpdate msg_var = *msg;
7862 msg_var = ChannelUpdate_clone(msg);
7863 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7864 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7865 uint64_t msg_ref = (uint64_t)msg_var.inner;
7866 if (msg_var.is_owned) {
7869 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7871 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
7872 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7873 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7874 if (get_jenv_res == JNI_EDETACHED) {
7875 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7879 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
7880 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7882 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7883 if (get_jenv_res == JNI_EDETACHED) {
7884 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7886 DO_ASSERT(get_jenv_res == JNI_OK);
7888 uint64_t ret_update = (uint64_t)update;
7889 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7891 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
7892 if (get_jenv_res == JNI_EDETACHED) {
7893 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7896 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
7897 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7899 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7900 if (get_jenv_res == JNI_EDETACHED) {
7901 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7903 DO_ASSERT(get_jenv_res == JNI_OK);
7905 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7907 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
7908 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
7909 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7910 if (ret_constr.datalen > 0)
7911 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7913 ret_constr.data = NULL;
7914 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7915 for (size_t l = 0; l < ret_constr.datalen; l++) {
7916 int64_t ret_conv_63 = ret_vals[l];
7917 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
7918 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
7919 ret_constr.data[l] = ret_conv_63_conv;
7921 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7922 if (get_jenv_res == JNI_EDETACHED) {
7923 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7927 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
7928 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7930 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7931 if (get_jenv_res == JNI_EDETACHED) {
7932 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7934 DO_ASSERT(get_jenv_res == JNI_OK);
7936 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
7937 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
7938 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7940 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
7941 LDKCVec_NodeAnnouncementZ ret_constr;
7942 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7943 if (ret_constr.datalen > 0)
7944 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7946 ret_constr.data = NULL;
7947 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7948 for (size_t s = 0; s < ret_constr.datalen; s++) {
7949 int64_t ret_conv_18 = ret_vals[s];
7950 LDKNodeAnnouncement ret_conv_18_conv;
7951 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
7952 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
7953 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
7954 ret_constr.data[s] = ret_conv_18_conv;
7956 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7957 if (get_jenv_res == JNI_EDETACHED) {
7958 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7962 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
7963 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7965 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7966 if (get_jenv_res == JNI_EDETACHED) {
7967 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7969 DO_ASSERT(get_jenv_res == JNI_OK);
7971 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7972 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7973 LDKInit init_var = *init;
7974 init_var = Init_clone(init);
7975 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7976 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7977 uint64_t init_ref = (uint64_t)init_var.inner;
7978 if (init_var.is_owned) {
7981 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7983 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
7984 if (get_jenv_res == JNI_EDETACHED) {
7985 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7988 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
7989 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7991 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7992 if (get_jenv_res == JNI_EDETACHED) {
7993 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7995 DO_ASSERT(get_jenv_res == JNI_OK);
7997 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7998 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7999 LDKReplyChannelRange msg_var = msg;
8000 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8001 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8002 uint64_t msg_ref = (uint64_t)msg_var.inner;
8003 if (msg_var.is_owned) {
8006 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8008 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8009 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8010 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8011 if (get_jenv_res == JNI_EDETACHED) {
8012 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8016 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8017 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8019 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8020 if (get_jenv_res == JNI_EDETACHED) {
8021 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8023 DO_ASSERT(get_jenv_res == JNI_OK);
8025 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8026 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8027 LDKReplyShortChannelIdsEnd msg_var = msg;
8028 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8029 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8030 uint64_t msg_ref = (uint64_t)msg_var.inner;
8031 if (msg_var.is_owned) {
8034 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8036 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8037 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8038 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8039 if (get_jenv_res == JNI_EDETACHED) {
8040 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8044 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8045 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8047 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8048 if (get_jenv_res == JNI_EDETACHED) {
8049 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8051 DO_ASSERT(get_jenv_res == JNI_OK);
8053 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8054 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8055 LDKQueryChannelRange msg_var = msg;
8056 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8057 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8058 uint64_t msg_ref = (uint64_t)msg_var.inner;
8059 if (msg_var.is_owned) {
8062 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8064 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8065 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8066 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8067 if (get_jenv_res == JNI_EDETACHED) {
8068 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8072 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8073 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8075 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8076 if (get_jenv_res == JNI_EDETACHED) {
8077 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8079 DO_ASSERT(get_jenv_res == JNI_OK);
8081 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8082 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8083 LDKQueryShortChannelIds msg_var = msg;
8084 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8085 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8086 uint64_t msg_ref = (uint64_t)msg_var.inner;
8087 if (msg_var.is_owned) {
8090 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8092 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8093 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8094 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8095 if (get_jenv_res == JNI_EDETACHED) {
8096 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8100 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
8101 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8102 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8103 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8104 return (void*) this_arg;
8106 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8107 jclass c = (*env)->GetObjectClass(env, o);
8109 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8110 atomic_init(&calls->refcnt, 1);
8111 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8112 calls->o = (*env)->NewWeakGlobalRef(env, o);
8113 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8114 CHECK(calls->handle_node_announcement_meth != NULL);
8115 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8116 CHECK(calls->handle_channel_announcement_meth != NULL);
8117 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8118 CHECK(calls->handle_channel_update_meth != NULL);
8119 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8120 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8121 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8122 CHECK(calls->get_next_channel_announcements_meth != NULL);
8123 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8124 CHECK(calls->get_next_node_announcements_meth != NULL);
8125 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8126 CHECK(calls->sync_routing_table_meth != NULL);
8127 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8128 CHECK(calls->handle_reply_channel_range_meth != NULL);
8129 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8130 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8131 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8132 CHECK(calls->handle_query_channel_range_meth != NULL);
8133 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8134 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8136 LDKRoutingMessageHandler ret = {
8137 .this_arg = (void*) calls,
8138 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8139 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8140 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8141 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8142 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8143 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8144 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8145 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8146 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8147 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8148 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8149 .free = LDKRoutingMessageHandler_JCalls_free,
8150 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8152 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8156 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8157 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8158 return (uint64_t)res_ptr;
8160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8161 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8162 LDKNodeAnnouncement msg_conv;
8163 msg_conv.inner = (void*)(msg & (~1));
8164 msg_conv.is_owned = false;
8165 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8166 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8167 return (uint64_t)ret_conv;
8170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8171 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8172 LDKChannelAnnouncement msg_conv;
8173 msg_conv.inner = (void*)(msg & (~1));
8174 msg_conv.is_owned = false;
8175 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8176 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8177 return (uint64_t)ret_conv;
8180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8181 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8182 LDKChannelUpdate msg_conv;
8183 msg_conv.inner = (void*)(msg & (~1));
8184 msg_conv.is_owned = false;
8185 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8186 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8187 return (uint64_t)ret_conv;
8190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
8191 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8192 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8193 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8196 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
8197 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8198 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8199 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8200 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8201 for (size_t l = 0; l < ret_var.datalen; l++) {
8202 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8203 *ret_conv_63_ref = ret_var.data[l];
8204 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8206 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8211 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
8212 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8213 LDKPublicKey starting_point_ref;
8214 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8215 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8216 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8217 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8218 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8219 for (size_t s = 0; s < ret_var.datalen; s++) {
8220 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8221 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8222 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8223 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8224 if (ret_conv_18_var.is_owned) {
8225 ret_conv_18_ref |= 1;
8227 ret_arr_ptr[s] = ret_conv_18_ref;
8229 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
8235 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8236 LDKPublicKey their_node_id_ref;
8237 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8238 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8240 init_conv.inner = (void*)(init & (~1));
8241 init_conv.is_owned = false;
8242 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
8246 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8247 LDKPublicKey their_node_id_ref;
8248 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8249 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8250 LDKReplyChannelRange msg_conv;
8251 msg_conv.inner = (void*)(msg & (~1));
8252 msg_conv.is_owned = (msg & 1) || (msg == 0);
8253 msg_conv = ReplyChannelRange_clone(&msg_conv);
8254 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8255 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8256 return (uint64_t)ret_conv;
8259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
8260 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8261 LDKPublicKey their_node_id_ref;
8262 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8263 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8264 LDKReplyShortChannelIdsEnd msg_conv;
8265 msg_conv.inner = (void*)(msg & (~1));
8266 msg_conv.is_owned = (msg & 1) || (msg == 0);
8267 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8268 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8269 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8270 return (uint64_t)ret_conv;
8273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
8274 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8275 LDKPublicKey their_node_id_ref;
8276 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8277 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8278 LDKQueryChannelRange msg_conv;
8279 msg_conv.inner = (void*)(msg & (~1));
8280 msg_conv.is_owned = (msg & 1) || (msg == 0);
8281 msg_conv = QueryChannelRange_clone(&msg_conv);
8282 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8283 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8284 return (uint64_t)ret_conv;
8287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
8288 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8289 LDKPublicKey their_node_id_ref;
8290 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8291 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8292 LDKQueryShortChannelIds msg_conv;
8293 msg_conv.inner = (void*)(msg & (~1));
8294 msg_conv.is_owned = (msg & 1) || (msg == 0);
8295 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8296 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8297 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8298 return (uint64_t)ret_conv;
8301 typedef struct LDKSocketDescriptor_JCalls {
8302 atomic_size_t refcnt;
8305 jmethodID send_data_meth;
8306 jmethodID disconnect_socket_meth;
8308 jmethodID hash_meth;
8309 } LDKSocketDescriptor_JCalls;
8310 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8311 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8312 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8314 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8315 if (get_jenv_res == JNI_EDETACHED) {
8316 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8318 DO_ASSERT(get_jenv_res == JNI_OK);
8320 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8321 if (get_jenv_res == JNI_EDETACHED) {
8322 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8327 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8328 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8330 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8331 if (get_jenv_res == JNI_EDETACHED) {
8332 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8334 DO_ASSERT(get_jenv_res == JNI_OK);
8336 LDKu8slice data_var = data;
8337 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8338 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8339 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8341 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8342 if (get_jenv_res == JNI_EDETACHED) {
8343 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8347 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8348 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8350 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8351 if (get_jenv_res == JNI_EDETACHED) {
8352 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8354 DO_ASSERT(get_jenv_res == JNI_OK);
8356 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8358 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8359 if (get_jenv_res == JNI_EDETACHED) {
8360 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8363 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8364 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8366 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8367 if (get_jenv_res == JNI_EDETACHED) {
8368 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8370 DO_ASSERT(get_jenv_res == JNI_OK);
8372 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8373 *other_arg_clone = SocketDescriptor_clone(other_arg);
8374 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8376 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8377 if (get_jenv_res == JNI_EDETACHED) {
8378 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8382 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8383 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8385 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8386 if (get_jenv_res == JNI_EDETACHED) {
8387 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8389 DO_ASSERT(get_jenv_res == JNI_OK);
8391 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8393 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8394 if (get_jenv_res == JNI_EDETACHED) {
8395 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8399 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
8400 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8401 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8402 return (void*) this_arg;
8404 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8405 jclass c = (*env)->GetObjectClass(env, o);
8407 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8408 atomic_init(&calls->refcnt, 1);
8409 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8410 calls->o = (*env)->NewWeakGlobalRef(env, o);
8411 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8412 CHECK(calls->send_data_meth != NULL);
8413 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8414 CHECK(calls->disconnect_socket_meth != NULL);
8415 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8416 CHECK(calls->eq_meth != NULL);
8417 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8418 CHECK(calls->hash_meth != NULL);
8420 LDKSocketDescriptor ret = {
8421 .this_arg = (void*) calls,
8422 .send_data = send_data_LDKSocketDescriptor_jcall,
8423 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8424 .eq = eq_LDKSocketDescriptor_jcall,
8425 .hash = hash_LDKSocketDescriptor_jcall,
8426 .clone = LDKSocketDescriptor_JCalls_clone,
8427 .free = LDKSocketDescriptor_JCalls_free,
8431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8432 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8433 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8434 return (uint64_t)res_ptr;
8436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
8437 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8438 LDKu8slice data_ref;
8439 data_ref.datalen = (*env)->GetArrayLength(env, data);
8440 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8441 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8442 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8447 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8448 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8452 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8453 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8457 typedef struct LDKChannelManagerPersister_JCalls {
8458 atomic_size_t refcnt;
8461 jmethodID persist_manager_meth;
8462 } LDKChannelManagerPersister_JCalls;
8463 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8464 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8465 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8467 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8468 if (get_jenv_res == JNI_EDETACHED) {
8469 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8471 DO_ASSERT(get_jenv_res == JNI_OK);
8473 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8474 if (get_jenv_res == JNI_EDETACHED) {
8475 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8480 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8481 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8483 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8484 if (get_jenv_res == JNI_EDETACHED) {
8485 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8487 DO_ASSERT(get_jenv_res == JNI_OK);
8489 LDKChannelManager channel_manager_var = *channel_manager;
8490 // Warning: we may need a move here but no clone is available for LDKChannelManager
8491 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8492 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8493 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8494 if (channel_manager_var.is_owned) {
8495 channel_manager_ref |= 1;
8497 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8499 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
8500 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
8501 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
8502 if (get_jenv_res == JNI_EDETACHED) {
8503 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8507 static void* LDKChannelManagerPersister_JCalls_clone(const void* this_arg) {
8508 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8509 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8510 return (void*) this_arg;
8512 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
8513 jclass c = (*env)->GetObjectClass(env, o);
8515 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
8516 atomic_init(&calls->refcnt, 1);
8517 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8518 calls->o = (*env)->NewWeakGlobalRef(env, o);
8519 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
8520 CHECK(calls->persist_manager_meth != NULL);
8522 LDKChannelManagerPersister ret = {
8523 .this_arg = (void*) calls,
8524 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
8525 .free = LDKChannelManagerPersister_JCalls_free,
8529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
8530 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
8531 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
8532 return (uint64_t)res_ptr;
8534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
8535 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
8536 LDKChannelManager channel_manager_conv;
8537 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8538 channel_manager_conv.is_owned = false;
8539 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8540 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8541 return (uint64_t)ret_conv;
8544 static jclass LDKFallback_SegWitProgram_class = NULL;
8545 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
8546 static jclass LDKFallback_PubKeyHash_class = NULL;
8547 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
8548 static jclass LDKFallback_ScriptHash_class = NULL;
8549 static jmethodID LDKFallback_ScriptHash_meth = NULL;
8550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
8551 LDKFallback_SegWitProgram_class =
8552 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
8553 CHECK(LDKFallback_SegWitProgram_class != NULL);
8554 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
8555 CHECK(LDKFallback_SegWitProgram_meth != NULL);
8556 LDKFallback_PubKeyHash_class =
8557 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
8558 CHECK(LDKFallback_PubKeyHash_class != NULL);
8559 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
8560 CHECK(LDKFallback_PubKeyHash_meth != NULL);
8561 LDKFallback_ScriptHash_class =
8562 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
8563 CHECK(LDKFallback_ScriptHash_class != NULL);
8564 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
8565 CHECK(LDKFallback_ScriptHash_meth != NULL);
8567 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8568 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
8570 case LDKFallback_SegWitProgram: {
8571 uint8_t version_val = obj->seg_wit_program.version._0;
8572 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
8573 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
8574 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
8575 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
8577 case LDKFallback_PubKeyHash: {
8578 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
8579 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
8580 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
8582 case LDKFallback_ScriptHash: {
8583 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
8584 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
8585 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
8590 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8591 LDKStr ret_str = _ldk_get_compiled_version();
8592 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8596 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8597 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8598 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
8603 LDKTransaction _res_ref;
8604 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
8605 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8606 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
8607 _res_ref.data_is_owned = true;
8608 Transaction_free(_res_ref);
8611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
8612 if ((_res & 1) != 0) return;
8613 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
8615 TxOut_free(_res_conv);
8618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8619 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8620 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8621 *ret_ref = TxOut_clone(orig_conv);
8622 return (uint64_t)ret_ref;
8625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
8626 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8632 CHECK((*env)->GetArrayLength(env, o) == 32);
8633 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
8634 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8635 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8636 return (uint64_t)ret_conv;
8639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8640 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8641 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8642 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8643 return (uint64_t)ret_conv;
8646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8647 if ((_res & 1) != 0) return;
8648 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
8650 CResult_SecretKeyErrorZ_free(_res_conv);
8653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8655 CHECK((*env)->GetArrayLength(env, o) == 33);
8656 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
8657 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8658 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8659 return (uint64_t)ret_conv;
8662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8663 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8664 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8665 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8666 return (uint64_t)ret_conv;
8669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8670 if ((_res & 1) != 0) return;
8671 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
8673 CResult_PublicKeyErrorZ_free(_res_conv);
8676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8677 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8678 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8679 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8680 return (uint64_t)ret_conv;
8683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8684 LDKTxCreationKeys o_conv;
8685 o_conv.inner = (void*)(o & (~1));
8686 o_conv.is_owned = (o & 1) || (o == 0);
8687 o_conv = TxCreationKeys_clone(&o_conv);
8688 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8689 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8690 return (uint64_t)ret_conv;
8693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8694 LDKDecodeError e_conv;
8695 e_conv.inner = (void*)(e & (~1));
8696 e_conv.is_owned = (e & 1) || (e == 0);
8697 e_conv = DecodeError_clone(&e_conv);
8698 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8699 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8700 return (uint64_t)ret_conv;
8703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8704 if ((_res & 1) != 0) return;
8705 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8707 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8711 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8712 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8713 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8714 return (uint64_t)ret_conv;
8717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8718 LDKChannelPublicKeys o_conv;
8719 o_conv.inner = (void*)(o & (~1));
8720 o_conv.is_owned = (o & 1) || (o == 0);
8721 o_conv = ChannelPublicKeys_clone(&o_conv);
8722 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8723 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8724 return (uint64_t)ret_conv;
8727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8728 LDKDecodeError e_conv;
8729 e_conv.inner = (void*)(e & (~1));
8730 e_conv.is_owned = (e & 1) || (e == 0);
8731 e_conv = DecodeError_clone(&e_conv);
8732 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8733 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8734 return (uint64_t)ret_conv;
8737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8738 if ((_res & 1) != 0) return;
8739 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8741 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8745 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8746 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8747 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8748 return (uint64_t)ret_conv;
8751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8752 LDKTxCreationKeys o_conv;
8753 o_conv.inner = (void*)(o & (~1));
8754 o_conv.is_owned = (o & 1) || (o == 0);
8755 o_conv = TxCreationKeys_clone(&o_conv);
8756 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8757 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8758 return (uint64_t)ret_conv;
8761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8762 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8763 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8764 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8765 return (uint64_t)ret_conv;
8768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8769 if ((_res & 1) != 0) return;
8770 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
8772 CResult_TxCreationKeysErrorZ_free(_res_conv);
8775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8776 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8777 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8778 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8779 return (uint64_t)ret_conv;
8782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
8783 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8784 *ret_copy = COption_u32Z_some(o);
8785 uint64_t ret_ref = (uint64_t)ret_copy;
8789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
8790 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8791 *ret_copy = COption_u32Z_none();
8792 uint64_t ret_ref = (uint64_t)ret_copy;
8796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8797 if ((_res & 1) != 0) return;
8798 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
8800 COption_u32Z_free(_res_conv);
8803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8804 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8805 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8806 *ret_copy = COption_u32Z_clone(orig_conv);
8807 uint64_t ret_ref = (uint64_t)ret_copy;
8811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8812 LDKHTLCOutputInCommitment o_conv;
8813 o_conv.inner = (void*)(o & (~1));
8814 o_conv.is_owned = (o & 1) || (o == 0);
8815 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8816 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8817 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8818 return (uint64_t)ret_conv;
8821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8822 LDKDecodeError e_conv;
8823 e_conv.inner = (void*)(e & (~1));
8824 e_conv.is_owned = (e & 1) || (e == 0);
8825 e_conv = DecodeError_clone(&e_conv);
8826 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8827 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8828 return (uint64_t)ret_conv;
8831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8832 if ((_res & 1) != 0) return;
8833 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
8835 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8839 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8840 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8841 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8842 return (uint64_t)ret_conv;
8845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8846 LDKCounterpartyChannelTransactionParameters o_conv;
8847 o_conv.inner = (void*)(o & (~1));
8848 o_conv.is_owned = (o & 1) || (o == 0);
8849 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8850 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8851 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8852 return (uint64_t)ret_conv;
8855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8856 LDKDecodeError e_conv;
8857 e_conv.inner = (void*)(e & (~1));
8858 e_conv.is_owned = (e & 1) || (e == 0);
8859 e_conv = DecodeError_clone(&e_conv);
8860 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8861 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8862 return (uint64_t)ret_conv;
8865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8866 if ((_res & 1) != 0) return;
8867 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8869 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8873 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8874 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8875 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8876 return (uint64_t)ret_conv;
8879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8880 LDKChannelTransactionParameters o_conv;
8881 o_conv.inner = (void*)(o & (~1));
8882 o_conv.is_owned = (o & 1) || (o == 0);
8883 o_conv = ChannelTransactionParameters_clone(&o_conv);
8884 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8885 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8886 return (uint64_t)ret_conv;
8889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8890 LDKDecodeError e_conv;
8891 e_conv.inner = (void*)(e & (~1));
8892 e_conv.is_owned = (e & 1) || (e == 0);
8893 e_conv = DecodeError_clone(&e_conv);
8894 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8895 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8896 return (uint64_t)ret_conv;
8899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8900 if ((_res & 1) != 0) return;
8901 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8903 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8907 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8908 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8909 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8910 return (uint64_t)ret_conv;
8913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8914 LDKCVec_SignatureZ _res_constr;
8915 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8916 if (_res_constr.datalen > 0)
8917 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8919 _res_constr.data = NULL;
8920 for (size_t i = 0; i < _res_constr.datalen; i++) {
8921 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8922 LDKSignature _res_conv_8_ref;
8923 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
8924 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
8925 _res_constr.data[i] = _res_conv_8_ref;
8927 CVec_SignatureZ_free(_res_constr);
8930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8931 LDKHolderCommitmentTransaction o_conv;
8932 o_conv.inner = (void*)(o & (~1));
8933 o_conv.is_owned = (o & 1) || (o == 0);
8934 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8935 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8936 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8937 return (uint64_t)ret_conv;
8940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8941 LDKDecodeError e_conv;
8942 e_conv.inner = (void*)(e & (~1));
8943 e_conv.is_owned = (e & 1) || (e == 0);
8944 e_conv = DecodeError_clone(&e_conv);
8945 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8946 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8947 return (uint64_t)ret_conv;
8950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8951 if ((_res & 1) != 0) return;
8952 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8954 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8958 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8959 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8960 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8961 return (uint64_t)ret_conv;
8964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8965 LDKBuiltCommitmentTransaction o_conv;
8966 o_conv.inner = (void*)(o & (~1));
8967 o_conv.is_owned = (o & 1) || (o == 0);
8968 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8969 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8970 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8971 return (uint64_t)ret_conv;
8974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8975 LDKDecodeError e_conv;
8976 e_conv.inner = (void*)(e & (~1));
8977 e_conv.is_owned = (e & 1) || (e == 0);
8978 e_conv = DecodeError_clone(&e_conv);
8979 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8980 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8981 return (uint64_t)ret_conv;
8984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8985 if ((_res & 1) != 0) return;
8986 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8988 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8992 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8993 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8994 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8995 return (uint64_t)ret_conv;
8998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8999 LDKCommitmentTransaction o_conv;
9000 o_conv.inner = (void*)(o & (~1));
9001 o_conv.is_owned = (o & 1) || (o == 0);
9002 o_conv = CommitmentTransaction_clone(&o_conv);
9003 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9004 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9005 return (uint64_t)ret_conv;
9008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9009 LDKDecodeError e_conv;
9010 e_conv.inner = (void*)(e & (~1));
9011 e_conv.is_owned = (e & 1) || (e == 0);
9012 e_conv = DecodeError_clone(&e_conv);
9013 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9014 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9015 return (uint64_t)ret_conv;
9018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9019 if ((_res & 1) != 0) return;
9020 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9022 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9026 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9027 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9028 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9029 return (uint64_t)ret_conv;
9032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9033 LDKTrustedCommitmentTransaction o_conv;
9034 o_conv.inner = (void*)(o & (~1));
9035 o_conv.is_owned = (o & 1) || (o == 0);
9036 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9037 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9038 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9039 return (uint64_t)ret_conv;
9042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9043 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9044 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9045 return (uint64_t)ret_conv;
9048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9049 if ((_res & 1) != 0) return;
9050 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9052 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9056 LDKCVec_SignatureZ o_constr;
9057 o_constr.datalen = (*env)->GetArrayLength(env, o);
9058 if (o_constr.datalen > 0)
9059 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9061 o_constr.data = NULL;
9062 for (size_t i = 0; i < o_constr.datalen; i++) {
9063 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9064 LDKSignature o_conv_8_ref;
9065 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9066 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9067 o_constr.data[i] = o_conv_8_ref;
9069 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9070 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9071 return (uint64_t)ret_conv;
9074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9075 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9076 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9077 return (uint64_t)ret_conv;
9080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9081 if ((_res & 1) != 0) return;
9082 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9084 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9088 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9089 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9090 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9091 return (uint64_t)ret_conv;
9094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9095 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9096 *ret_conv = CResult_NoneErrorZ_ok();
9097 return (uint64_t)ret_conv;
9100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9101 LDKIOError e_conv = LDKIOError_from_java(env, e);
9102 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9103 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9104 return (uint64_t)ret_conv;
9107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9108 if ((_res & 1) != 0) return;
9109 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9111 CResult_NoneErrorZ_free(_res_conv);
9114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9115 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9116 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9117 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9118 return (uint64_t)ret_conv;
9121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9123 o_conv.inner = (void*)(o & (~1));
9124 o_conv.is_owned = (o & 1) || (o == 0);
9125 o_conv = RouteHop_clone(&o_conv);
9126 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9127 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9128 return (uint64_t)ret_conv;
9131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9132 LDKDecodeError e_conv;
9133 e_conv.inner = (void*)(e & (~1));
9134 e_conv.is_owned = (e & 1) || (e == 0);
9135 e_conv = DecodeError_clone(&e_conv);
9136 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9137 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9138 return (uint64_t)ret_conv;
9141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9142 if ((_res & 1) != 0) return;
9143 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9145 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9149 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9150 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9151 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9152 return (uint64_t)ret_conv;
9155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9156 LDKCVec_RouteHopZ _res_constr;
9157 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9158 if (_res_constr.datalen > 0)
9159 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9161 _res_constr.data = NULL;
9162 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9163 for (size_t k = 0; k < _res_constr.datalen; k++) {
9164 int64_t _res_conv_10 = _res_vals[k];
9165 LDKRouteHop _res_conv_10_conv;
9166 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9167 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9168 _res_constr.data[k] = _res_conv_10_conv;
9170 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9171 CVec_RouteHopZ_free(_res_constr);
9174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9175 LDKCVec_CVec_RouteHopZZ _res_constr;
9176 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9177 if (_res_constr.datalen > 0)
9178 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9180 _res_constr.data = NULL;
9181 for (size_t m = 0; m < _res_constr.datalen; m++) {
9182 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9183 LDKCVec_RouteHopZ _res_conv_12_constr;
9184 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9185 if (_res_conv_12_constr.datalen > 0)
9186 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9188 _res_conv_12_constr.data = NULL;
9189 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9190 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9191 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9192 LDKRouteHop _res_conv_12_conv_10_conv;
9193 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9194 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9195 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9197 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9198 _res_constr.data[m] = _res_conv_12_constr;
9200 CVec_CVec_RouteHopZZ_free(_res_constr);
9203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9205 o_conv.inner = (void*)(o & (~1));
9206 o_conv.is_owned = (o & 1) || (o == 0);
9207 o_conv = Route_clone(&o_conv);
9208 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9209 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9210 return (uint64_t)ret_conv;
9213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9214 LDKDecodeError e_conv;
9215 e_conv.inner = (void*)(e & (~1));
9216 e_conv.is_owned = (e & 1) || (e == 0);
9217 e_conv = DecodeError_clone(&e_conv);
9218 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9219 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9220 return (uint64_t)ret_conv;
9223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9224 if ((_res & 1) != 0) return;
9225 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9227 CResult_RouteDecodeErrorZ_free(_res_conv);
9230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9231 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9232 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9233 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9234 return (uint64_t)ret_conv;
9237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9238 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9239 *ret_copy = COption_u64Z_some(o);
9240 uint64_t ret_ref = (uint64_t)ret_copy;
9244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9245 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9246 *ret_copy = COption_u64Z_none();
9247 uint64_t ret_ref = (uint64_t)ret_copy;
9251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9252 if ((_res & 1) != 0) return;
9253 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9255 COption_u64Z_free(_res_conv);
9258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9259 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9260 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9261 *ret_copy = COption_u64Z_clone(orig_conv);
9262 uint64_t ret_ref = (uint64_t)ret_copy;
9266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9267 LDKCVec_ChannelDetailsZ _res_constr;
9268 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9269 if (_res_constr.datalen > 0)
9270 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9272 _res_constr.data = NULL;
9273 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9274 for (size_t q = 0; q < _res_constr.datalen; q++) {
9275 int64_t _res_conv_16 = _res_vals[q];
9276 LDKChannelDetails _res_conv_16_conv;
9277 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9278 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9279 _res_constr.data[q] = _res_conv_16_conv;
9281 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9282 CVec_ChannelDetailsZ_free(_res_constr);
9285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9286 LDKCVec_RouteHintZ _res_constr;
9287 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9288 if (_res_constr.datalen > 0)
9289 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9291 _res_constr.data = NULL;
9292 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9293 for (size_t l = 0; l < _res_constr.datalen; l++) {
9294 int64_t _res_conv_11 = _res_vals[l];
9295 LDKRouteHint _res_conv_11_conv;
9296 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9297 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9298 _res_constr.data[l] = _res_conv_11_conv;
9300 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9301 CVec_RouteHintZ_free(_res_constr);
9304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9306 o_conv.inner = (void*)(o & (~1));
9307 o_conv.is_owned = (o & 1) || (o == 0);
9308 o_conv = Route_clone(&o_conv);
9309 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9310 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9311 return (uint64_t)ret_conv;
9314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9315 LDKLightningError e_conv;
9316 e_conv.inner = (void*)(e & (~1));
9317 e_conv.is_owned = (e & 1) || (e == 0);
9318 e_conv = LightningError_clone(&e_conv);
9319 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9320 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9321 return (uint64_t)ret_conv;
9324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9325 if ((_res & 1) != 0) return;
9326 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9328 CResult_RouteLightningErrorZ_free(_res_conv);
9331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9332 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9333 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9334 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9335 return (uint64_t)ret_conv;
9338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9339 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9340 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9341 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9342 return (uint64_t)ret_conv;
9345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9346 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9347 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9348 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9349 return (uint64_t)ret_conv;
9352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9353 if ((_res & 1) != 0) return;
9354 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9356 CResult_TxOutAccessErrorZ_free(_res_conv);
9359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9360 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9361 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9362 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9363 return (uint64_t)ret_conv;
9366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9367 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9368 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9369 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9370 return (uint64_t)ret_ref;
9373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9374 LDKTransaction b_ref;
9375 b_ref.datalen = (*env)->GetArrayLength(env, b);
9376 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9377 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9378 b_ref.data_is_owned = true;
9379 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9380 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9381 return (uint64_t)ret_ref;
9384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9385 if ((_res & 1) != 0) return;
9386 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9388 C2Tuple_usizeTransactionZ_free(_res_conv);
9391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9392 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9393 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9394 if (_res_constr.datalen > 0)
9395 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9397 _res_constr.data = NULL;
9398 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9399 for (size_t y = 0; y < _res_constr.datalen; y++) {
9400 int64_t _res_conv_24 = _res_vals[y];
9401 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9402 FREE((void*)_res_conv_24);
9403 _res_constr.data[y] = _res_conv_24_conv;
9405 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9406 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9410 LDKCVec_TxidZ _res_constr;
9411 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9412 if (_res_constr.datalen > 0)
9413 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9415 _res_constr.data = NULL;
9416 for (size_t i = 0; i < _res_constr.datalen; i++) {
9417 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9418 LDKThirtyTwoBytes _res_conv_8_ref;
9419 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9420 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9421 _res_constr.data[i] = _res_conv_8_ref;
9423 CVec_TxidZ_free(_res_constr);
9426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
9427 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9428 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9429 return (uint64_t)ret_conv;
9432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
9433 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
9434 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9435 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9436 return (uint64_t)ret_conv;
9439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9440 if ((_res & 1) != 0) return;
9441 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
9443 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9447 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9448 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9449 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9450 return (uint64_t)ret_conv;
9453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9454 LDKCVec_MonitorEventZ _res_constr;
9455 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9456 if (_res_constr.datalen > 0)
9457 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9459 _res_constr.data = NULL;
9460 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9461 for (size_t o = 0; o < _res_constr.datalen; o++) {
9462 int64_t _res_conv_14 = _res_vals[o];
9463 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
9464 FREE((void*)_res_conv_14);
9465 _res_constr.data[o] = _res_conv_14_conv;
9467 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9468 CVec_MonitorEventZ_free(_res_constr);
9471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
9472 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
9473 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9474 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9475 uint64_t ret_ref = (uint64_t)ret_copy;
9479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
9480 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9481 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9482 uint64_t ret_ref = (uint64_t)ret_copy;
9486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9487 if ((_res & 1) != 0) return;
9488 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
9490 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9494 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9495 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9496 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9497 uint64_t ret_ref = (uint64_t)ret_copy;
9501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9502 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9503 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9504 if (_res_constr.datalen > 0)
9505 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9507 _res_constr.data = NULL;
9508 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9509 for (size_t b = 0; b < _res_constr.datalen; b++) {
9510 int64_t _res_conv_27 = _res_vals[b];
9511 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
9512 FREE((void*)_res_conv_27);
9513 _res_constr.data[b] = _res_conv_27_conv;
9515 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9516 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9520 LDKCVec_MessageSendEventZ _res_constr;
9521 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9522 if (_res_constr.datalen > 0)
9523 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9525 _res_constr.data = NULL;
9526 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9527 for (size_t s = 0; s < _res_constr.datalen; s++) {
9528 int64_t _res_conv_18 = _res_vals[s];
9529 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
9530 FREE((void*)_res_conv_18);
9531 _res_constr.data[s] = _res_conv_18_conv;
9533 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9534 CVec_MessageSendEventZ_free(_res_constr);
9537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9538 LDKInitFeatures o_conv;
9539 o_conv.inner = (void*)(o & (~1));
9540 o_conv.is_owned = (o & 1) || (o == 0);
9541 o_conv = InitFeatures_clone(&o_conv);
9542 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9543 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9544 return (uint64_t)ret_conv;
9547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9548 LDKDecodeError e_conv;
9549 e_conv.inner = (void*)(e & (~1));
9550 e_conv.is_owned = (e & 1) || (e == 0);
9551 e_conv = DecodeError_clone(&e_conv);
9552 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9553 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9554 return (uint64_t)ret_conv;
9557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9558 if ((_res & 1) != 0) return;
9559 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9561 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9565 LDKNodeFeatures o_conv;
9566 o_conv.inner = (void*)(o & (~1));
9567 o_conv.is_owned = (o & 1) || (o == 0);
9568 o_conv = NodeFeatures_clone(&o_conv);
9569 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9570 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9571 return (uint64_t)ret_conv;
9574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9575 LDKDecodeError e_conv;
9576 e_conv.inner = (void*)(e & (~1));
9577 e_conv.is_owned = (e & 1) || (e == 0);
9578 e_conv = DecodeError_clone(&e_conv);
9579 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9580 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9581 return (uint64_t)ret_conv;
9584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9585 if ((_res & 1) != 0) return;
9586 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9588 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9592 LDKChannelFeatures o_conv;
9593 o_conv.inner = (void*)(o & (~1));
9594 o_conv.is_owned = (o & 1) || (o == 0);
9595 o_conv = ChannelFeatures_clone(&o_conv);
9596 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9597 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9598 return (uint64_t)ret_conv;
9601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9602 LDKDecodeError e_conv;
9603 e_conv.inner = (void*)(e & (~1));
9604 e_conv.is_owned = (e & 1) || (e == 0);
9605 e_conv = DecodeError_clone(&e_conv);
9606 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9607 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9608 return (uint64_t)ret_conv;
9611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9612 if ((_res & 1) != 0) return;
9613 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9615 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
9618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9619 LDKInvoiceFeatures o_conv;
9620 o_conv.inner = (void*)(o & (~1));
9621 o_conv.is_owned = (o & 1) || (o == 0);
9622 o_conv = InvoiceFeatures_clone(&o_conv);
9623 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9624 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
9625 return (uint64_t)ret_conv;
9628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9629 LDKDecodeError e_conv;
9630 e_conv.inner = (void*)(e & (~1));
9631 e_conv.is_owned = (e & 1) || (e == 0);
9632 e_conv = DecodeError_clone(&e_conv);
9633 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9634 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
9635 return (uint64_t)ret_conv;
9638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9639 if ((_res & 1) != 0) return;
9640 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9642 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
9645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9646 LDKDelayedPaymentOutputDescriptor o_conv;
9647 o_conv.inner = (void*)(o & (~1));
9648 o_conv.is_owned = (o & 1) || (o == 0);
9649 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
9650 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9651 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9652 return (uint64_t)ret_conv;
9655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9656 LDKDecodeError e_conv;
9657 e_conv.inner = (void*)(e & (~1));
9658 e_conv.is_owned = (e & 1) || (e == 0);
9659 e_conv = DecodeError_clone(&e_conv);
9660 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9661 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9662 return (uint64_t)ret_conv;
9665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9666 if ((_res & 1) != 0) return;
9667 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9669 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9673 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9674 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9675 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9676 return (uint64_t)ret_conv;
9679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9680 LDKStaticPaymentOutputDescriptor o_conv;
9681 o_conv.inner = (void*)(o & (~1));
9682 o_conv.is_owned = (o & 1) || (o == 0);
9683 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
9684 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9685 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9686 return (uint64_t)ret_conv;
9689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9690 LDKDecodeError e_conv;
9691 e_conv.inner = (void*)(e & (~1));
9692 e_conv.is_owned = (e & 1) || (e == 0);
9693 e_conv = DecodeError_clone(&e_conv);
9694 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9695 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9696 return (uint64_t)ret_conv;
9699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9700 if ((_res & 1) != 0) return;
9701 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9703 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9707 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9708 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9709 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9710 return (uint64_t)ret_conv;
9713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9714 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
9715 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9716 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
9717 return (uint64_t)ret_conv;
9720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9721 LDKDecodeError e_conv;
9722 e_conv.inner = (void*)(e & (~1));
9723 e_conv.is_owned = (e & 1) || (e == 0);
9724 e_conv = DecodeError_clone(&e_conv);
9725 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9726 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
9727 return (uint64_t)ret_conv;
9730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9731 if ((_res & 1) != 0) return;
9732 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9734 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
9737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9738 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
9739 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9740 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
9741 return (uint64_t)ret_conv;
9744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9745 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
9746 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9747 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
9748 return (uint64_t)ret_ref;
9751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
9753 CHECK((*env)->GetArrayLength(env, a) == 64);
9754 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
9755 LDKCVec_SignatureZ b_constr;
9756 b_constr.datalen = (*env)->GetArrayLength(env, b);
9757 if (b_constr.datalen > 0)
9758 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9760 b_constr.data = NULL;
9761 for (size_t i = 0; i < b_constr.datalen; i++) {
9762 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
9763 LDKSignature b_conv_8_ref;
9764 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
9765 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
9766 b_constr.data[i] = b_conv_8_ref;
9768 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9769 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
9770 return (uint64_t)ret_ref;
9773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9774 if ((_res & 1) != 0) return;
9775 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
9777 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
9780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9781 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
9782 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9783 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
9784 return (uint64_t)ret_conv;
9787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
9788 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9789 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
9790 return (uint64_t)ret_conv;
9793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9794 if ((_res & 1) != 0) return;
9795 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
9797 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
9800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9801 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
9802 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9803 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
9804 return (uint64_t)ret_conv;
9807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9809 CHECK((*env)->GetArrayLength(env, o) == 64);
9810 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
9811 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9812 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
9813 return (uint64_t)ret_conv;
9816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9817 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9818 *ret_conv = CResult_SignatureNoneZ_err();
9819 return (uint64_t)ret_conv;
9822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9823 if ((_res & 1) != 0) return;
9824 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
9826 CResult_SignatureNoneZ_free(_res_conv);
9829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9830 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
9831 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9832 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
9833 return (uint64_t)ret_conv;
9836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9837 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
9838 if (o_conv.free == LDKSign_JCalls_free) {
9839 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9840 LDKSign_JCalls_clone(o_conv.this_arg);
9842 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9843 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
9844 return (uint64_t)ret_conv;
9847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9848 LDKDecodeError e_conv;
9849 e_conv.inner = (void*)(e & (~1));
9850 e_conv.is_owned = (e & 1) || (e == 0);
9851 e_conv = DecodeError_clone(&e_conv);
9852 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9853 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
9854 return (uint64_t)ret_conv;
9857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9858 if ((_res & 1) != 0) return;
9859 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
9861 CResult_SignDecodeErrorZ_free(_res_conv);
9864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9865 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
9866 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9867 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
9868 return (uint64_t)ret_conv;
9871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9872 LDKCVec_u8Z _res_ref;
9873 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9874 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
9875 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9876 CVec_u8Z_free(_res_ref);
9879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
9880 LDKRecoverableSignature arg_ref;
9881 CHECK((*env)->GetArrayLength(env, arg) == 68);
9882 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
9883 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9884 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
9885 return (uint64_t)ret_conv;
9888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9889 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9890 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
9891 return (uint64_t)ret_conv;
9894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9895 if ((_res & 1) != 0) return;
9896 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
9898 CResult_RecoverableSignatureNoneZ_free(_res_conv);
9901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9902 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
9903 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9904 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
9905 return (uint64_t)ret_conv;
9908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9909 LDKCVec_CVec_u8ZZ _res_constr;
9910 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9911 if (_res_constr.datalen > 0)
9912 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9914 _res_constr.data = NULL;
9915 for (size_t i = 0; i < _res_constr.datalen; i++) {
9916 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9917 LDKCVec_u8Z _res_conv_8_ref;
9918 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
9919 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9920 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
9921 _res_constr.data[i] = _res_conv_8_ref;
9923 CVec_CVec_u8ZZ_free(_res_constr);
9926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9927 LDKCVec_CVec_u8ZZ o_constr;
9928 o_constr.datalen = (*env)->GetArrayLength(env, o);
9929 if (o_constr.datalen > 0)
9930 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9932 o_constr.data = NULL;
9933 for (size_t i = 0; i < o_constr.datalen; i++) {
9934 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9935 LDKCVec_u8Z o_conv_8_ref;
9936 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
9937 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9938 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
9939 o_constr.data[i] = o_conv_8_ref;
9941 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9942 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
9943 return (uint64_t)ret_conv;
9946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
9947 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9948 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
9949 return (uint64_t)ret_conv;
9952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9953 if ((_res & 1) != 0) return;
9954 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
9956 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
9959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9960 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
9961 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9962 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
9963 return (uint64_t)ret_conv;
9966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9967 LDKInMemorySigner o_conv;
9968 o_conv.inner = (void*)(o & (~1));
9969 o_conv.is_owned = (o & 1) || (o == 0);
9970 o_conv = InMemorySigner_clone(&o_conv);
9971 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9972 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
9973 return (uint64_t)ret_conv;
9976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9977 LDKDecodeError e_conv;
9978 e_conv.inner = (void*)(e & (~1));
9979 e_conv.is_owned = (e & 1) || (e == 0);
9980 e_conv = DecodeError_clone(&e_conv);
9981 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9982 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
9983 return (uint64_t)ret_conv;
9986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9987 if ((_res & 1) != 0) return;
9988 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
9990 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
9993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9994 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
9995 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9996 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
9997 return (uint64_t)ret_conv;
10000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10001 LDKCVec_TxOutZ _res_constr;
10002 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10003 if (_res_constr.datalen > 0)
10004 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10006 _res_constr.data = NULL;
10007 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10008 for (size_t h = 0; h < _res_constr.datalen; h++) {
10009 int64_t _res_conv_7 = _res_vals[h];
10010 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10011 FREE((void*)_res_conv_7);
10012 _res_constr.data[h] = _res_conv_7_conv;
10014 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10015 CVec_TxOutZ_free(_res_constr);
10018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10019 LDKTransaction o_ref;
10020 o_ref.datalen = (*env)->GetArrayLength(env, o);
10021 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10022 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10023 o_ref.data_is_owned = true;
10024 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10025 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10026 return (uint64_t)ret_conv;
10029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10030 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10031 *ret_conv = CResult_TransactionNoneZ_err();
10032 return (uint64_t)ret_conv;
10035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10036 if ((_res & 1) != 0) return;
10037 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10039 CResult_TransactionNoneZ_free(_res_conv);
10042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10043 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10044 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10045 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10046 return (uint64_t)ret_conv;
10049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10050 LDKThirtyTwoBytes a_ref;
10051 CHECK((*env)->GetArrayLength(env, a) == 32);
10052 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10053 LDKChannelMonitor b_conv;
10054 b_conv.inner = (void*)(b & (~1));
10055 b_conv.is_owned = (b & 1) || (b == 0);
10056 b_conv = ChannelMonitor_clone(&b_conv);
10057 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10058 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10059 return (uint64_t)ret_ref;
10062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10063 if ((_res & 1) != 0) return;
10064 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10066 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10070 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10071 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10072 if (_res_constr.datalen > 0)
10073 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10075 _res_constr.data = NULL;
10076 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10077 for (size_t i = 0; i < _res_constr.datalen; i++) {
10078 int64_t _res_conv_34 = _res_vals[i];
10079 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10080 FREE((void*)_res_conv_34);
10081 _res_constr.data[i] = _res_conv_34_conv;
10083 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10084 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10088 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10089 o_constr.datalen = (*env)->GetArrayLength(env, o);
10090 if (o_constr.datalen > 0)
10091 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10093 o_constr.data = NULL;
10094 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10095 for (size_t i = 0; i < o_constr.datalen; i++) {
10096 int64_t o_conv_34 = o_vals[i];
10097 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10098 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10099 o_constr.data[i] = o_conv_34_conv;
10101 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10102 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10103 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10104 return (uint64_t)ret_conv;
10107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10108 LDKIOError e_conv = LDKIOError_from_java(env, e);
10109 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10110 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10111 return (uint64_t)ret_conv;
10114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10115 if ((_res & 1) != 0) return;
10116 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10118 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10122 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10123 *ret_conv = CResult_NoneAPIErrorZ_ok();
10124 return (uint64_t)ret_conv;
10127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10128 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10129 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10130 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10131 return (uint64_t)ret_conv;
10134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10135 if ((_res & 1) != 0) return;
10136 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10138 CResult_NoneAPIErrorZ_free(_res_conv);
10141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10142 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10143 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10144 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10145 return (uint64_t)ret_conv;
10148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10149 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10150 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10151 if (_res_constr.datalen > 0)
10152 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10154 _res_constr.data = NULL;
10155 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10156 for (size_t w = 0; w < _res_constr.datalen; w++) {
10157 int64_t _res_conv_22 = _res_vals[w];
10158 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10159 FREE((void*)_res_conv_22);
10160 _res_constr.data[w] = _res_conv_22_conv;
10162 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10163 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10167 LDKCVec_APIErrorZ _res_constr;
10168 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10169 if (_res_constr.datalen > 0)
10170 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10172 _res_constr.data = NULL;
10173 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10174 for (size_t k = 0; k < _res_constr.datalen; k++) {
10175 int64_t _res_conv_10 = _res_vals[k];
10176 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10177 FREE((void*)_res_conv_10);
10178 _res_constr.data[k] = _res_conv_10_conv;
10180 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10181 CVec_APIErrorZ_free(_res_constr);
10184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10185 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10186 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10187 return (uint64_t)ret_conv;
10190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10191 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10192 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10193 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10194 return (uint64_t)ret_conv;
10197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10198 if ((_res & 1) != 0) return;
10199 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10201 CResult_NonePaymentSendFailureZ_free(_res_conv);
10204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10205 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10206 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10207 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10208 return (uint64_t)ret_conv;
10211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10212 LDKCVec_NetAddressZ _res_constr;
10213 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10214 if (_res_constr.datalen > 0)
10215 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10217 _res_constr.data = NULL;
10218 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10219 for (size_t m = 0; m < _res_constr.datalen; m++) {
10220 int64_t _res_conv_12 = _res_vals[m];
10221 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10222 FREE((void*)_res_conv_12);
10223 _res_constr.data[m] = _res_conv_12_conv;
10225 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10226 CVec_NetAddressZ_free(_res_constr);
10229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10230 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10231 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10232 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10233 return (uint64_t)ret_ref;
10236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10237 LDKThirtyTwoBytes a_ref;
10238 CHECK((*env)->GetArrayLength(env, a) == 32);
10239 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10240 LDKThirtyTwoBytes b_ref;
10241 CHECK((*env)->GetArrayLength(env, b) == 32);
10242 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10243 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10244 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10245 return (uint64_t)ret_ref;
10248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10249 if ((_res & 1) != 0) return;
10250 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10252 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10256 LDKThirtyTwoBytes o_ref;
10257 CHECK((*env)->GetArrayLength(env, o) == 32);
10258 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10259 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10260 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10261 return (uint64_t)ret_conv;
10264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10265 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10266 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10267 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10268 return (uint64_t)ret_conv;
10271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10272 if ((_res & 1) != 0) return;
10273 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10275 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10279 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10280 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10281 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10282 return (uint64_t)ret_conv;
10285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10286 LDKCVec_ChannelMonitorZ _res_constr;
10287 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10288 if (_res_constr.datalen > 0)
10289 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10291 _res_constr.data = NULL;
10292 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10293 for (size_t q = 0; q < _res_constr.datalen; q++) {
10294 int64_t _res_conv_16 = _res_vals[q];
10295 LDKChannelMonitor _res_conv_16_conv;
10296 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10297 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10298 _res_constr.data[q] = _res_conv_16_conv;
10300 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10301 CVec_ChannelMonitorZ_free(_res_constr);
10304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10305 LDKThirtyTwoBytes a_ref;
10306 CHECK((*env)->GetArrayLength(env, a) == 32);
10307 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10308 LDKChannelManager b_conv;
10309 b_conv.inner = (void*)(b & (~1));
10310 b_conv.is_owned = (b & 1) || (b == 0);
10311 // Warning: we need a move here but no clone is available for LDKChannelManager
10312 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10313 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10314 return (uint64_t)ret_ref;
10317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10318 if ((_res & 1) != 0) return;
10319 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10321 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10325 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10326 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10327 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10328 return (uint64_t)ret_conv;
10331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10332 LDKDecodeError e_conv;
10333 e_conv.inner = (void*)(e & (~1));
10334 e_conv.is_owned = (e & 1) || (e == 0);
10335 e_conv = DecodeError_clone(&e_conv);
10336 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10337 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10338 return (uint64_t)ret_conv;
10341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10342 if ((_res & 1) != 0) return;
10343 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10345 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10349 LDKChannelConfig o_conv;
10350 o_conv.inner = (void*)(o & (~1));
10351 o_conv.is_owned = (o & 1) || (o == 0);
10352 o_conv = ChannelConfig_clone(&o_conv);
10353 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10354 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10355 return (uint64_t)ret_conv;
10358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10359 LDKDecodeError e_conv;
10360 e_conv.inner = (void*)(e & (~1));
10361 e_conv.is_owned = (e & 1) || (e == 0);
10362 e_conv = DecodeError_clone(&e_conv);
10363 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10364 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10365 return (uint64_t)ret_conv;
10368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10369 if ((_res & 1) != 0) return;
10370 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
10372 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10376 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10377 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10378 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10379 return (uint64_t)ret_conv;
10382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10383 LDKOutPoint o_conv;
10384 o_conv.inner = (void*)(o & (~1));
10385 o_conv.is_owned = (o & 1) || (o == 0);
10386 o_conv = OutPoint_clone(&o_conv);
10387 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10388 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10389 return (uint64_t)ret_conv;
10392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10393 LDKDecodeError e_conv;
10394 e_conv.inner = (void*)(e & (~1));
10395 e_conv.is_owned = (e & 1) || (e == 0);
10396 e_conv = DecodeError_clone(&e_conv);
10397 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10398 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10399 return (uint64_t)ret_conv;
10402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10403 if ((_res & 1) != 0) return;
10404 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
10406 CResult_OutPointDecodeErrorZ_free(_res_conv);
10409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10410 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10411 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10412 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10413 return (uint64_t)ret_conv;
10416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
10417 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
10418 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10419 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10420 return (uint64_t)ret_conv;
10423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
10424 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10425 *ret_conv = CResult_SiPrefixNoneZ_err();
10426 return (uint64_t)ret_conv;
10429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10430 if ((_res & 1) != 0) return;
10431 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
10433 CResult_SiPrefixNoneZ_free(_res_conv);
10436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10437 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
10438 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10439 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
10440 return (uint64_t)ret_conv;
10443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10445 o_conv.inner = (void*)(o & (~1));
10446 o_conv.is_owned = (o & 1) || (o == 0);
10447 o_conv = Invoice_clone(&o_conv);
10448 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10449 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
10450 return (uint64_t)ret_conv;
10453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10454 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10455 *ret_conv = CResult_InvoiceNoneZ_err();
10456 return (uint64_t)ret_conv;
10459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10460 if ((_res & 1) != 0) return;
10461 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
10463 CResult_InvoiceNoneZ_free(_res_conv);
10466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10467 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
10468 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10469 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
10470 return (uint64_t)ret_conv;
10473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10474 LDKSignedRawInvoice o_conv;
10475 o_conv.inner = (void*)(o & (~1));
10476 o_conv.is_owned = (o & 1) || (o == 0);
10477 o_conv = SignedRawInvoice_clone(&o_conv);
10478 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10479 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
10480 return (uint64_t)ret_conv;
10483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10484 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10485 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
10486 return (uint64_t)ret_conv;
10489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10490 if ((_res & 1) != 0) return;
10491 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
10493 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
10496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10497 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
10498 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10499 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
10500 return (uint64_t)ret_conv;
10503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10504 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
10505 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10506 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10507 return (uint64_t)ret_ref;
10510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
10511 LDKRawInvoice a_conv;
10512 a_conv.inner = (void*)(a & (~1));
10513 a_conv.is_owned = (a & 1) || (a == 0);
10514 a_conv = RawInvoice_clone(&a_conv);
10515 LDKThirtyTwoBytes b_ref;
10516 CHECK((*env)->GetArrayLength(env, b) == 32);
10517 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10518 LDKInvoiceSignature c_conv;
10519 c_conv.inner = (void*)(c & (~1));
10520 c_conv.is_owned = (c & 1) || (c == 0);
10521 c_conv = InvoiceSignature_clone(&c_conv);
10522 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10523 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10524 return (uint64_t)ret_ref;
10527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10528 if ((_res & 1) != 0) return;
10529 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
10531 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10535 LDKPayeePubKey o_conv;
10536 o_conv.inner = (void*)(o & (~1));
10537 o_conv.is_owned = (o & 1) || (o == 0);
10538 o_conv = PayeePubKey_clone(&o_conv);
10539 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10540 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10541 return (uint64_t)ret_conv;
10544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10545 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10546 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10547 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10548 return (uint64_t)ret_conv;
10551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10552 if ((_res & 1) != 0) return;
10553 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
10555 CResult_PayeePubKeyErrorZ_free(_res_conv);
10558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10559 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10560 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10561 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10562 return (uint64_t)ret_conv;
10565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10566 LDKCVec_PrivateRouteZ _res_constr;
10567 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10568 if (_res_constr.datalen > 0)
10569 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
10571 _res_constr.data = NULL;
10572 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10573 for (size_t o = 0; o < _res_constr.datalen; o++) {
10574 int64_t _res_conv_14 = _res_vals[o];
10575 LDKPrivateRoute _res_conv_14_conv;
10576 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10577 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10578 _res_constr.data[o] = _res_conv_14_conv;
10580 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10581 CVec_PrivateRouteZ_free(_res_constr);
10584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10585 LDKPositiveTimestamp o_conv;
10586 o_conv.inner = (void*)(o & (~1));
10587 o_conv.is_owned = (o & 1) || (o == 0);
10588 o_conv = PositiveTimestamp_clone(&o_conv);
10589 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10590 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10591 return (uint64_t)ret_conv;
10594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10595 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10596 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10597 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10598 return (uint64_t)ret_conv;
10601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10602 if ((_res & 1) != 0) return;
10603 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
10605 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10609 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10610 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10611 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10612 return (uint64_t)ret_conv;
10615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
10616 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10617 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10618 return (uint64_t)ret_conv;
10621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10622 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10623 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10624 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10625 return (uint64_t)ret_conv;
10628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10629 if ((_res & 1) != 0) return;
10630 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
10632 CResult_NoneSemanticErrorZ_free(_res_conv);
10635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10636 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10637 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10638 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10639 return (uint64_t)ret_conv;
10642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10644 o_conv.inner = (void*)(o & (~1));
10645 o_conv.is_owned = (o & 1) || (o == 0);
10646 o_conv = Invoice_clone(&o_conv);
10647 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10648 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10649 return (uint64_t)ret_conv;
10652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10653 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10654 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10655 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10656 return (uint64_t)ret_conv;
10659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10660 if ((_res & 1) != 0) return;
10661 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
10663 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10667 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10668 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10669 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10670 return (uint64_t)ret_conv;
10673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10674 LDKDescription o_conv;
10675 o_conv.inner = (void*)(o & (~1));
10676 o_conv.is_owned = (o & 1) || (o == 0);
10677 o_conv = Description_clone(&o_conv);
10678 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10679 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10680 return (uint64_t)ret_conv;
10683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10684 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10685 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10686 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10687 return (uint64_t)ret_conv;
10690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10691 if ((_res & 1) != 0) return;
10692 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
10694 CResult_DescriptionCreationErrorZ_free(_res_conv);
10697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10698 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
10699 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10700 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
10701 return (uint64_t)ret_conv;
10704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10705 LDKExpiryTime o_conv;
10706 o_conv.inner = (void*)(o & (~1));
10707 o_conv.is_owned = (o & 1) || (o == 0);
10708 o_conv = ExpiryTime_clone(&o_conv);
10709 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10710 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
10711 return (uint64_t)ret_conv;
10714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10715 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10716 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10717 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
10718 return (uint64_t)ret_conv;
10721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10722 if ((_res & 1) != 0) return;
10723 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
10725 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
10728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10729 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
10730 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10731 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
10732 return (uint64_t)ret_conv;
10735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10736 LDKPrivateRoute o_conv;
10737 o_conv.inner = (void*)(o & (~1));
10738 o_conv.is_owned = (o & 1) || (o == 0);
10739 o_conv = PrivateRoute_clone(&o_conv);
10740 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10741 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
10742 return (uint64_t)ret_conv;
10745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10746 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10747 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10748 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
10749 return (uint64_t)ret_conv;
10752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10753 if ((_res & 1) != 0) return;
10754 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
10756 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
10759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10760 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
10761 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10762 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
10763 return (uint64_t)ret_conv;
10766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
10767 LDKStr o_conv = java_to_owned_str(env, o);
10768 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10769 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10770 return (uint64_t)ret_conv;
10773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10774 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10775 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10776 *ret_conv = CResult_StringErrorZ_err(e_conv);
10777 return (uint64_t)ret_conv;
10780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10781 if ((_res & 1) != 0) return;
10782 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
10784 CResult_StringErrorZ_free(_res_conv);
10787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10788 LDKChannelMonitorUpdate o_conv;
10789 o_conv.inner = (void*)(o & (~1));
10790 o_conv.is_owned = (o & 1) || (o == 0);
10791 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10792 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10793 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10794 return (uint64_t)ret_conv;
10797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10798 LDKDecodeError e_conv;
10799 e_conv.inner = (void*)(e & (~1));
10800 e_conv.is_owned = (e & 1) || (e == 0);
10801 e_conv = DecodeError_clone(&e_conv);
10802 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10803 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10804 return (uint64_t)ret_conv;
10807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10808 if ((_res & 1) != 0) return;
10809 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10811 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10815 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10816 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10817 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10818 return (uint64_t)ret_conv;
10821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10822 LDKHTLCUpdate o_conv;
10823 o_conv.inner = (void*)(o & (~1));
10824 o_conv.is_owned = (o & 1) || (o == 0);
10825 o_conv = HTLCUpdate_clone(&o_conv);
10826 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10827 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10828 return (uint64_t)ret_conv;
10831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10832 LDKDecodeError e_conv;
10833 e_conv.inner = (void*)(e & (~1));
10834 e_conv.is_owned = (e & 1) || (e == 0);
10835 e_conv = DecodeError_clone(&e_conv);
10836 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10837 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10838 return (uint64_t)ret_conv;
10841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10842 if ((_res & 1) != 0) return;
10843 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10845 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10849 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10850 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10851 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10852 return (uint64_t)ret_conv;
10855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
10856 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10857 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
10858 return (uint64_t)ret_conv;
10861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10862 LDKMonitorUpdateError e_conv;
10863 e_conv.inner = (void*)(e & (~1));
10864 e_conv.is_owned = (e & 1) || (e == 0);
10865 e_conv = MonitorUpdateError_clone(&e_conv);
10866 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10867 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
10868 return (uint64_t)ret_conv;
10871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10872 if ((_res & 1) != 0) return;
10873 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
10875 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
10878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10879 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
10880 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10881 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
10882 return (uint64_t)ret_conv;
10885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10886 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
10887 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10888 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
10889 return (uint64_t)ret_ref;
10892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
10893 LDKOutPoint a_conv;
10894 a_conv.inner = (void*)(a & (~1));
10895 a_conv.is_owned = (a & 1) || (a == 0);
10896 a_conv = OutPoint_clone(&a_conv);
10898 b_ref.datalen = (*env)->GetArrayLength(env, b);
10899 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10900 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10901 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10902 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10903 return (uint64_t)ret_ref;
10906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10907 if ((_res & 1) != 0) return;
10908 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
10910 C2Tuple_OutPointScriptZ_free(_res_conv);
10913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10914 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
10915 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10916 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
10917 return (uint64_t)ret_ref;
10920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
10922 b_ref.datalen = (*env)->GetArrayLength(env, b);
10923 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10924 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10925 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10926 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
10927 return (uint64_t)ret_ref;
10930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10931 if ((_res & 1) != 0) return;
10932 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
10934 C2Tuple_u32ScriptZ_free(_res_conv);
10937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10938 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10939 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10940 if (_res_constr.datalen > 0)
10941 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10943 _res_constr.data = NULL;
10944 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10945 for (size_t b = 0; b < _res_constr.datalen; b++) {
10946 int64_t _res_conv_27 = _res_vals[b];
10947 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
10948 FREE((void*)_res_conv_27);
10949 _res_constr.data[b] = _res_conv_27_conv;
10951 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10952 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10956 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
10957 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10958 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
10959 return (uint64_t)ret_ref;
10962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
10963 LDKThirtyTwoBytes a_ref;
10964 CHECK((*env)->GetArrayLength(env, a) == 32);
10965 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10966 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10967 b_constr.datalen = (*env)->GetArrayLength(env, b);
10968 if (b_constr.datalen > 0)
10969 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10971 b_constr.data = NULL;
10972 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
10973 for (size_t b = 0; b < b_constr.datalen; b++) {
10974 int64_t b_conv_27 = b_vals[b];
10975 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
10976 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
10977 b_constr.data[b] = b_conv_27_conv;
10979 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
10980 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10981 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10982 return (uint64_t)ret_ref;
10985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10986 if ((_res & 1) != 0) return;
10987 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
10989 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10993 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10994 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10995 if (_res_constr.datalen > 0)
10996 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
10998 _res_constr.data = NULL;
10999 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11000 for (size_t v = 0; v < _res_constr.datalen; v++) {
11001 int64_t _res_conv_47 = _res_vals[v];
11002 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11003 FREE((void*)_res_conv_47);
11004 _res_constr.data[v] = _res_conv_47_conv;
11006 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11007 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11011 LDKCVec_EventZ _res_constr;
11012 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11013 if (_res_constr.datalen > 0)
11014 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11016 _res_constr.data = NULL;
11017 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11018 for (size_t h = 0; h < _res_constr.datalen; h++) {
11019 int64_t _res_conv_7 = _res_vals[h];
11020 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11021 FREE((void*)_res_conv_7);
11022 _res_constr.data[h] = _res_conv_7_conv;
11024 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11025 CVec_EventZ_free(_res_constr);
11028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11029 LDKCVec_TransactionZ _res_constr;
11030 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11031 if (_res_constr.datalen > 0)
11032 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11034 _res_constr.data = NULL;
11035 for (size_t i = 0; i < _res_constr.datalen; i++) {
11036 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11037 LDKTransaction _res_conv_8_ref;
11038 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11039 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11040 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11041 _res_conv_8_ref.data_is_owned = true;
11042 _res_constr.data[i] = _res_conv_8_ref;
11044 CVec_TransactionZ_free(_res_constr);
11047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11048 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11049 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11050 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11051 return (uint64_t)ret_ref;
11054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11055 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11056 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11057 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11058 return (uint64_t)ret_ref;
11061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11062 if ((_res & 1) != 0) return;
11063 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11065 C2Tuple_u32TxOutZ_free(_res_conv);
11068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11069 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11070 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11071 if (_res_constr.datalen > 0)
11072 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11074 _res_constr.data = NULL;
11075 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11076 for (size_t a = 0; a < _res_constr.datalen; a++) {
11077 int64_t _res_conv_26 = _res_vals[a];
11078 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11079 FREE((void*)_res_conv_26);
11080 _res_constr.data[a] = _res_conv_26_conv;
11082 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11083 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11087 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11088 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11089 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11090 return (uint64_t)ret_ref;
11093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11094 LDKThirtyTwoBytes a_ref;
11095 CHECK((*env)->GetArrayLength(env, a) == 32);
11096 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11097 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11098 b_constr.datalen = (*env)->GetArrayLength(env, b);
11099 if (b_constr.datalen > 0)
11100 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11102 b_constr.data = NULL;
11103 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11104 for (size_t a = 0; a < b_constr.datalen; a++) {
11105 int64_t b_conv_26 = b_vals[a];
11106 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11107 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11108 b_constr.data[a] = b_conv_26_conv;
11110 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11111 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11112 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11113 return (uint64_t)ret_ref;
11116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11117 if ((_res & 1) != 0) return;
11118 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11120 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11124 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11125 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11126 if (_res_constr.datalen > 0)
11127 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11129 _res_constr.data = NULL;
11130 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11131 for (size_t u = 0; u < _res_constr.datalen; u++) {
11132 int64_t _res_conv_46 = _res_vals[u];
11133 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11134 FREE((void*)_res_conv_46);
11135 _res_constr.data[u] = _res_conv_46_conv;
11137 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11138 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11142 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11143 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11144 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11145 return (uint64_t)ret_conv;
11148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11149 LDKDecodeError e_conv;
11150 e_conv.inner = (void*)(e & (~1));
11151 e_conv.is_owned = (e & 1) || (e == 0);
11152 e_conv = DecodeError_clone(&e_conv);
11153 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11154 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11155 return (uint64_t)ret_conv;
11158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11159 if ((_res & 1) != 0) return;
11160 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11162 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11166 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11167 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11168 return (uint64_t)ret_conv;
11171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11172 LDKLightningError e_conv;
11173 e_conv.inner = (void*)(e & (~1));
11174 e_conv.is_owned = (e & 1) || (e == 0);
11175 e_conv = LightningError_clone(&e_conv);
11176 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11177 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11178 return (uint64_t)ret_conv;
11181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11182 if ((_res & 1) != 0) return;
11183 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11185 CResult_boolLightningErrorZ_free(_res_conv);
11188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11189 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11190 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11191 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11192 return (uint64_t)ret_conv;
11195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11196 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11197 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11198 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11199 return (uint64_t)ret_ref;
11202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
11203 LDKChannelAnnouncement a_conv;
11204 a_conv.inner = (void*)(a & (~1));
11205 a_conv.is_owned = (a & 1) || (a == 0);
11206 a_conv = ChannelAnnouncement_clone(&a_conv);
11207 LDKChannelUpdate b_conv;
11208 b_conv.inner = (void*)(b & (~1));
11209 b_conv.is_owned = (b & 1) || (b == 0);
11210 b_conv = ChannelUpdate_clone(&b_conv);
11211 LDKChannelUpdate c_conv;
11212 c_conv.inner = (void*)(c & (~1));
11213 c_conv.is_owned = (c & 1) || (c == 0);
11214 c_conv = ChannelUpdate_clone(&c_conv);
11215 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11216 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11217 return (uint64_t)ret_ref;
11220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11221 if ((_res & 1) != 0) return;
11222 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11224 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11228 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11229 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11230 if (_res_constr.datalen > 0)
11231 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11233 _res_constr.data = NULL;
11234 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11235 for (size_t l = 0; l < _res_constr.datalen; l++) {
11236 int64_t _res_conv_63 = _res_vals[l];
11237 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11238 FREE((void*)_res_conv_63);
11239 _res_constr.data[l] = _res_conv_63_conv;
11241 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11242 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11246 LDKCVec_NodeAnnouncementZ _res_constr;
11247 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11248 if (_res_constr.datalen > 0)
11249 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11251 _res_constr.data = NULL;
11252 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11253 for (size_t s = 0; s < _res_constr.datalen; s++) {
11254 int64_t _res_conv_18 = _res_vals[s];
11255 LDKNodeAnnouncement _res_conv_18_conv;
11256 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11257 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11258 _res_constr.data[s] = _res_conv_18_conv;
11260 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11261 CVec_NodeAnnouncementZ_free(_res_constr);
11264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11265 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11266 *ret_conv = CResult_NoneLightningErrorZ_ok();
11267 return (uint64_t)ret_conv;
11270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11271 LDKLightningError e_conv;
11272 e_conv.inner = (void*)(e & (~1));
11273 e_conv.is_owned = (e & 1) || (e == 0);
11274 e_conv = LightningError_clone(&e_conv);
11275 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11276 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11277 return (uint64_t)ret_conv;
11280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11281 if ((_res & 1) != 0) return;
11282 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11284 CResult_NoneLightningErrorZ_free(_res_conv);
11287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11288 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11289 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11290 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11291 return (uint64_t)ret_conv;
11294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11295 LDKCVec_PublicKeyZ _res_constr;
11296 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11297 if (_res_constr.datalen > 0)
11298 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11300 _res_constr.data = NULL;
11301 for (size_t i = 0; i < _res_constr.datalen; i++) {
11302 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11303 LDKPublicKey _res_conv_8_ref;
11304 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11305 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11306 _res_constr.data[i] = _res_conv_8_ref;
11308 CVec_PublicKeyZ_free(_res_constr);
11311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11313 o_ref.datalen = (*env)->GetArrayLength(env, o);
11314 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11315 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11316 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11317 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11318 return (uint64_t)ret_conv;
11321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11322 LDKPeerHandleError e_conv;
11323 e_conv.inner = (void*)(e & (~1));
11324 e_conv.is_owned = (e & 1) || (e == 0);
11325 e_conv = PeerHandleError_clone(&e_conv);
11326 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11327 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11328 return (uint64_t)ret_conv;
11331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11332 if ((_res & 1) != 0) return;
11333 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11335 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11339 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11340 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11341 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11342 return (uint64_t)ret_conv;
11345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11346 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11347 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11348 return (uint64_t)ret_conv;
11351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11352 LDKPeerHandleError e_conv;
11353 e_conv.inner = (void*)(e & (~1));
11354 e_conv.is_owned = (e & 1) || (e == 0);
11355 e_conv = PeerHandleError_clone(&e_conv);
11356 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11357 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11358 return (uint64_t)ret_conv;
11361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11362 if ((_res & 1) != 0) return;
11363 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11365 CResult_NonePeerHandleErrorZ_free(_res_conv);
11368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11369 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11370 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11371 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11372 return (uint64_t)ret_conv;
11375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11376 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11377 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11378 return (uint64_t)ret_conv;
11381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11382 LDKPeerHandleError e_conv;
11383 e_conv.inner = (void*)(e & (~1));
11384 e_conv.is_owned = (e & 1) || (e == 0);
11385 e_conv = PeerHandleError_clone(&e_conv);
11386 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11387 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11388 return (uint64_t)ret_conv;
11391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11392 if ((_res & 1) != 0) return;
11393 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11395 CResult_boolPeerHandleErrorZ_free(_res_conv);
11398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11399 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11400 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11401 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11402 return (uint64_t)ret_conv;
11405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11406 LDKDirectionalChannelInfo o_conv;
11407 o_conv.inner = (void*)(o & (~1));
11408 o_conv.is_owned = (o & 1) || (o == 0);
11409 o_conv = DirectionalChannelInfo_clone(&o_conv);
11410 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11411 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11412 return (uint64_t)ret_conv;
11415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11416 LDKDecodeError e_conv;
11417 e_conv.inner = (void*)(e & (~1));
11418 e_conv.is_owned = (e & 1) || (e == 0);
11419 e_conv = DecodeError_clone(&e_conv);
11420 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11421 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11422 return (uint64_t)ret_conv;
11425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11426 if ((_res & 1) != 0) return;
11427 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11429 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11433 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11434 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11435 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11436 return (uint64_t)ret_conv;
11439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11440 LDKChannelInfo o_conv;
11441 o_conv.inner = (void*)(o & (~1));
11442 o_conv.is_owned = (o & 1) || (o == 0);
11443 o_conv = ChannelInfo_clone(&o_conv);
11444 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11445 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11446 return (uint64_t)ret_conv;
11449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11450 LDKDecodeError e_conv;
11451 e_conv.inner = (void*)(e & (~1));
11452 e_conv.is_owned = (e & 1) || (e == 0);
11453 e_conv = DecodeError_clone(&e_conv);
11454 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11455 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11456 return (uint64_t)ret_conv;
11459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11460 if ((_res & 1) != 0) return;
11461 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11463 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11467 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11468 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11469 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11470 return (uint64_t)ret_conv;
11473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11474 LDKRoutingFees o_conv;
11475 o_conv.inner = (void*)(o & (~1));
11476 o_conv.is_owned = (o & 1) || (o == 0);
11477 o_conv = RoutingFees_clone(&o_conv);
11478 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11479 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11480 return (uint64_t)ret_conv;
11483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11484 LDKDecodeError e_conv;
11485 e_conv.inner = (void*)(e & (~1));
11486 e_conv.is_owned = (e & 1) || (e == 0);
11487 e_conv = DecodeError_clone(&e_conv);
11488 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11489 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11490 return (uint64_t)ret_conv;
11493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11494 if ((_res & 1) != 0) return;
11495 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11497 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11501 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11502 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11503 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11504 return (uint64_t)ret_conv;
11507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11508 LDKNodeAnnouncementInfo o_conv;
11509 o_conv.inner = (void*)(o & (~1));
11510 o_conv.is_owned = (o & 1) || (o == 0);
11511 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11512 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11513 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11514 return (uint64_t)ret_conv;
11517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11518 LDKDecodeError e_conv;
11519 e_conv.inner = (void*)(e & (~1));
11520 e_conv.is_owned = (e & 1) || (e == 0);
11521 e_conv = DecodeError_clone(&e_conv);
11522 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11523 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11524 return (uint64_t)ret_conv;
11527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11528 if ((_res & 1) != 0) return;
11529 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11531 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11535 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11536 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11537 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11538 return (uint64_t)ret_conv;
11541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11542 LDKCVec_u64Z _res_constr;
11543 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11544 if (_res_constr.datalen > 0)
11545 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11547 _res_constr.data = NULL;
11548 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11549 for (size_t g = 0; g < _res_constr.datalen; g++) {
11550 int64_t _res_conv_6 = _res_vals[g];
11551 _res_constr.data[g] = _res_conv_6;
11553 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11554 CVec_u64Z_free(_res_constr);
11557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11558 LDKNodeInfo o_conv;
11559 o_conv.inner = (void*)(o & (~1));
11560 o_conv.is_owned = (o & 1) || (o == 0);
11561 o_conv = NodeInfo_clone(&o_conv);
11562 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11563 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11564 return (uint64_t)ret_conv;
11567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11568 LDKDecodeError e_conv;
11569 e_conv.inner = (void*)(e & (~1));
11570 e_conv.is_owned = (e & 1) || (e == 0);
11571 e_conv = DecodeError_clone(&e_conv);
11572 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11573 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11574 return (uint64_t)ret_conv;
11577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11578 if ((_res & 1) != 0) return;
11579 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11581 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11585 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11586 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11587 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11588 return (uint64_t)ret_conv;
11591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11592 LDKNetworkGraph o_conv;
11593 o_conv.inner = (void*)(o & (~1));
11594 o_conv.is_owned = (o & 1) || (o == 0);
11595 o_conv = NetworkGraph_clone(&o_conv);
11596 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11597 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11598 return (uint64_t)ret_conv;
11601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11602 LDKDecodeError e_conv;
11603 e_conv.inner = (void*)(e & (~1));
11604 e_conv.is_owned = (e & 1) || (e == 0);
11605 e_conv = DecodeError_clone(&e_conv);
11606 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11607 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11608 return (uint64_t)ret_conv;
11611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11612 if ((_res & 1) != 0) return;
11613 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
11615 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11619 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11620 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11621 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11622 return (uint64_t)ret_conv;
11625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
11626 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11627 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11628 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11629 return (uint64_t)ret_conv;
11632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
11633 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11634 *ret_conv = CResult_NetAddressu8Z_err(e);
11635 return (uint64_t)ret_conv;
11638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11639 if ((_res & 1) != 0) return;
11640 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
11642 CResult_NetAddressu8Z_free(_res_conv);
11645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11646 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11647 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11648 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11649 return (uint64_t)ret_conv;
11652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11653 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
11654 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11655 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11656 return (uint64_t)ret_conv;
11659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11660 LDKDecodeError e_conv;
11661 e_conv.inner = (void*)(e & (~1));
11662 e_conv.is_owned = (e & 1) || (e == 0);
11663 e_conv = DecodeError_clone(&e_conv);
11664 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11665 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11666 return (uint64_t)ret_conv;
11669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11670 if ((_res & 1) != 0) return;
11671 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11673 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11677 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11678 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11679 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11680 return (uint64_t)ret_conv;
11683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11684 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11685 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11686 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11687 return (uint64_t)ret_conv;
11690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11691 LDKDecodeError e_conv;
11692 e_conv.inner = (void*)(e & (~1));
11693 e_conv.is_owned = (e & 1) || (e == 0);
11694 e_conv = DecodeError_clone(&e_conv);
11695 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11696 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11697 return (uint64_t)ret_conv;
11700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11701 if ((_res & 1) != 0) return;
11702 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
11704 CResult_NetAddressDecodeErrorZ_free(_res_conv);
11707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11708 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
11709 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11710 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
11711 return (uint64_t)ret_conv;
11714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11715 LDKCVec_UpdateAddHTLCZ _res_constr;
11716 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11717 if (_res_constr.datalen > 0)
11718 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11720 _res_constr.data = NULL;
11721 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11722 for (size_t p = 0; p < _res_constr.datalen; p++) {
11723 int64_t _res_conv_15 = _res_vals[p];
11724 LDKUpdateAddHTLC _res_conv_15_conv;
11725 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
11726 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
11727 _res_constr.data[p] = _res_conv_15_conv;
11729 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11730 CVec_UpdateAddHTLCZ_free(_res_constr);
11733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11734 LDKCVec_UpdateFulfillHTLCZ _res_constr;
11735 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11736 if (_res_constr.datalen > 0)
11737 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11739 _res_constr.data = NULL;
11740 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11741 for (size_t t = 0; t < _res_constr.datalen; t++) {
11742 int64_t _res_conv_19 = _res_vals[t];
11743 LDKUpdateFulfillHTLC _res_conv_19_conv;
11744 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
11745 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
11746 _res_constr.data[t] = _res_conv_19_conv;
11748 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11749 CVec_UpdateFulfillHTLCZ_free(_res_constr);
11752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11753 LDKCVec_UpdateFailHTLCZ _res_constr;
11754 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11755 if (_res_constr.datalen > 0)
11756 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11758 _res_constr.data = NULL;
11759 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11760 for (size_t q = 0; q < _res_constr.datalen; q++) {
11761 int64_t _res_conv_16 = _res_vals[q];
11762 LDKUpdateFailHTLC _res_conv_16_conv;
11763 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11764 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11765 _res_constr.data[q] = _res_conv_16_conv;
11767 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11768 CVec_UpdateFailHTLCZ_free(_res_constr);
11771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11772 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
11773 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11774 if (_res_constr.datalen > 0)
11775 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11777 _res_constr.data = NULL;
11778 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11779 for (size_t z = 0; z < _res_constr.datalen; z++) {
11780 int64_t _res_conv_25 = _res_vals[z];
11781 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
11782 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
11783 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
11784 _res_constr.data[z] = _res_conv_25_conv;
11786 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11787 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
11790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11791 LDKAcceptChannel o_conv;
11792 o_conv.inner = (void*)(o & (~1));
11793 o_conv.is_owned = (o & 1) || (o == 0);
11794 o_conv = AcceptChannel_clone(&o_conv);
11795 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11796 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
11797 return (uint64_t)ret_conv;
11800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11801 LDKDecodeError e_conv;
11802 e_conv.inner = (void*)(e & (~1));
11803 e_conv.is_owned = (e & 1) || (e == 0);
11804 e_conv = DecodeError_clone(&e_conv);
11805 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11806 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
11807 return (uint64_t)ret_conv;
11810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11811 if ((_res & 1) != 0) return;
11812 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
11814 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
11817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11818 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
11819 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11820 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
11821 return (uint64_t)ret_conv;
11824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11825 LDKAnnouncementSignatures o_conv;
11826 o_conv.inner = (void*)(o & (~1));
11827 o_conv.is_owned = (o & 1) || (o == 0);
11828 o_conv = AnnouncementSignatures_clone(&o_conv);
11829 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11830 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
11831 return (uint64_t)ret_conv;
11834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11835 LDKDecodeError e_conv;
11836 e_conv.inner = (void*)(e & (~1));
11837 e_conv.is_owned = (e & 1) || (e == 0);
11838 e_conv = DecodeError_clone(&e_conv);
11839 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11840 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
11841 return (uint64_t)ret_conv;
11844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11845 if ((_res & 1) != 0) return;
11846 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11848 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
11851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11852 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
11853 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11854 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
11855 return (uint64_t)ret_conv;
11858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11859 LDKChannelReestablish o_conv;
11860 o_conv.inner = (void*)(o & (~1));
11861 o_conv.is_owned = (o & 1) || (o == 0);
11862 o_conv = ChannelReestablish_clone(&o_conv);
11863 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11864 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
11865 return (uint64_t)ret_conv;
11868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11869 LDKDecodeError e_conv;
11870 e_conv.inner = (void*)(e & (~1));
11871 e_conv.is_owned = (e & 1) || (e == 0);
11872 e_conv = DecodeError_clone(&e_conv);
11873 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11874 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
11875 return (uint64_t)ret_conv;
11878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11879 if ((_res & 1) != 0) return;
11880 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
11882 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
11885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11886 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
11887 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11888 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
11889 return (uint64_t)ret_conv;
11892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11893 LDKClosingSigned o_conv;
11894 o_conv.inner = (void*)(o & (~1));
11895 o_conv.is_owned = (o & 1) || (o == 0);
11896 o_conv = ClosingSigned_clone(&o_conv);
11897 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11898 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
11899 return (uint64_t)ret_conv;
11902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11903 LDKDecodeError e_conv;
11904 e_conv.inner = (void*)(e & (~1));
11905 e_conv.is_owned = (e & 1) || (e == 0);
11906 e_conv = DecodeError_clone(&e_conv);
11907 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11908 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
11909 return (uint64_t)ret_conv;
11912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11913 if ((_res & 1) != 0) return;
11914 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11916 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
11919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11920 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
11921 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11922 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
11923 return (uint64_t)ret_conv;
11926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11927 LDKCommitmentSigned o_conv;
11928 o_conv.inner = (void*)(o & (~1));
11929 o_conv.is_owned = (o & 1) || (o == 0);
11930 o_conv = CommitmentSigned_clone(&o_conv);
11931 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11932 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
11933 return (uint64_t)ret_conv;
11936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11937 LDKDecodeError e_conv;
11938 e_conv.inner = (void*)(e & (~1));
11939 e_conv.is_owned = (e & 1) || (e == 0);
11940 e_conv = DecodeError_clone(&e_conv);
11941 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11942 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
11943 return (uint64_t)ret_conv;
11946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11947 if ((_res & 1) != 0) return;
11948 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11950 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
11953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11954 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
11955 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11956 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
11957 return (uint64_t)ret_conv;
11960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11961 LDKFundingCreated o_conv;
11962 o_conv.inner = (void*)(o & (~1));
11963 o_conv.is_owned = (o & 1) || (o == 0);
11964 o_conv = FundingCreated_clone(&o_conv);
11965 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11966 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
11967 return (uint64_t)ret_conv;
11970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11971 LDKDecodeError e_conv;
11972 e_conv.inner = (void*)(e & (~1));
11973 e_conv.is_owned = (e & 1) || (e == 0);
11974 e_conv = DecodeError_clone(&e_conv);
11975 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11976 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
11977 return (uint64_t)ret_conv;
11980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11981 if ((_res & 1) != 0) return;
11982 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11984 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
11987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11988 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
11989 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11990 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
11991 return (uint64_t)ret_conv;
11994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11995 LDKFundingSigned o_conv;
11996 o_conv.inner = (void*)(o & (~1));
11997 o_conv.is_owned = (o & 1) || (o == 0);
11998 o_conv = FundingSigned_clone(&o_conv);
11999 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12000 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12001 return (uint64_t)ret_conv;
12004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12005 LDKDecodeError e_conv;
12006 e_conv.inner = (void*)(e & (~1));
12007 e_conv.is_owned = (e & 1) || (e == 0);
12008 e_conv = DecodeError_clone(&e_conv);
12009 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12010 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12011 return (uint64_t)ret_conv;
12014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12015 if ((_res & 1) != 0) return;
12016 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12018 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12022 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12023 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12024 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12025 return (uint64_t)ret_conv;
12028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12029 LDKFundingLocked o_conv;
12030 o_conv.inner = (void*)(o & (~1));
12031 o_conv.is_owned = (o & 1) || (o == 0);
12032 o_conv = FundingLocked_clone(&o_conv);
12033 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12034 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12035 return (uint64_t)ret_conv;
12038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12039 LDKDecodeError e_conv;
12040 e_conv.inner = (void*)(e & (~1));
12041 e_conv.is_owned = (e & 1) || (e == 0);
12042 e_conv = DecodeError_clone(&e_conv);
12043 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12044 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12045 return (uint64_t)ret_conv;
12048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12049 if ((_res & 1) != 0) return;
12050 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12052 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12056 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12057 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12058 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12059 return (uint64_t)ret_conv;
12062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12064 o_conv.inner = (void*)(o & (~1));
12065 o_conv.is_owned = (o & 1) || (o == 0);
12066 o_conv = Init_clone(&o_conv);
12067 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12068 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12069 return (uint64_t)ret_conv;
12072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12073 LDKDecodeError e_conv;
12074 e_conv.inner = (void*)(e & (~1));
12075 e_conv.is_owned = (e & 1) || (e == 0);
12076 e_conv = DecodeError_clone(&e_conv);
12077 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12078 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12079 return (uint64_t)ret_conv;
12082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12083 if ((_res & 1) != 0) return;
12084 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12086 CResult_InitDecodeErrorZ_free(_res_conv);
12089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12090 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12091 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12092 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12093 return (uint64_t)ret_conv;
12096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12097 LDKOpenChannel o_conv;
12098 o_conv.inner = (void*)(o & (~1));
12099 o_conv.is_owned = (o & 1) || (o == 0);
12100 o_conv = OpenChannel_clone(&o_conv);
12101 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12102 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12103 return (uint64_t)ret_conv;
12106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12107 LDKDecodeError e_conv;
12108 e_conv.inner = (void*)(e & (~1));
12109 e_conv.is_owned = (e & 1) || (e == 0);
12110 e_conv = DecodeError_clone(&e_conv);
12111 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12112 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12113 return (uint64_t)ret_conv;
12116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12117 if ((_res & 1) != 0) return;
12118 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12120 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12124 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12125 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12126 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12127 return (uint64_t)ret_conv;
12130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12131 LDKRevokeAndACK o_conv;
12132 o_conv.inner = (void*)(o & (~1));
12133 o_conv.is_owned = (o & 1) || (o == 0);
12134 o_conv = RevokeAndACK_clone(&o_conv);
12135 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12136 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12137 return (uint64_t)ret_conv;
12140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12141 LDKDecodeError e_conv;
12142 e_conv.inner = (void*)(e & (~1));
12143 e_conv.is_owned = (e & 1) || (e == 0);
12144 e_conv = DecodeError_clone(&e_conv);
12145 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12146 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12147 return (uint64_t)ret_conv;
12150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12151 if ((_res & 1) != 0) return;
12152 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12154 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12158 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12159 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12160 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12161 return (uint64_t)ret_conv;
12164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12165 LDKShutdown o_conv;
12166 o_conv.inner = (void*)(o & (~1));
12167 o_conv.is_owned = (o & 1) || (o == 0);
12168 o_conv = Shutdown_clone(&o_conv);
12169 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12170 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12171 return (uint64_t)ret_conv;
12174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12175 LDKDecodeError e_conv;
12176 e_conv.inner = (void*)(e & (~1));
12177 e_conv.is_owned = (e & 1) || (e == 0);
12178 e_conv = DecodeError_clone(&e_conv);
12179 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12180 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12181 return (uint64_t)ret_conv;
12184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12185 if ((_res & 1) != 0) return;
12186 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12188 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12192 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12193 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12194 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12195 return (uint64_t)ret_conv;
12198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12199 LDKUpdateFailHTLC o_conv;
12200 o_conv.inner = (void*)(o & (~1));
12201 o_conv.is_owned = (o & 1) || (o == 0);
12202 o_conv = UpdateFailHTLC_clone(&o_conv);
12203 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12204 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12205 return (uint64_t)ret_conv;
12208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12209 LDKDecodeError e_conv;
12210 e_conv.inner = (void*)(e & (~1));
12211 e_conv.is_owned = (e & 1) || (e == 0);
12212 e_conv = DecodeError_clone(&e_conv);
12213 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12214 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12215 return (uint64_t)ret_conv;
12218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12219 if ((_res & 1) != 0) return;
12220 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12222 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12226 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12227 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12228 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12229 return (uint64_t)ret_conv;
12232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12233 LDKUpdateFailMalformedHTLC o_conv;
12234 o_conv.inner = (void*)(o & (~1));
12235 o_conv.is_owned = (o & 1) || (o == 0);
12236 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12237 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12238 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12239 return (uint64_t)ret_conv;
12242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12243 LDKDecodeError e_conv;
12244 e_conv.inner = (void*)(e & (~1));
12245 e_conv.is_owned = (e & 1) || (e == 0);
12246 e_conv = DecodeError_clone(&e_conv);
12247 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12248 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12249 return (uint64_t)ret_conv;
12252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12253 if ((_res & 1) != 0) return;
12254 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12256 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12260 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12261 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12262 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12263 return (uint64_t)ret_conv;
12266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12267 LDKUpdateFee o_conv;
12268 o_conv.inner = (void*)(o & (~1));
12269 o_conv.is_owned = (o & 1) || (o == 0);
12270 o_conv = UpdateFee_clone(&o_conv);
12271 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12272 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12273 return (uint64_t)ret_conv;
12276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12277 LDKDecodeError e_conv;
12278 e_conv.inner = (void*)(e & (~1));
12279 e_conv.is_owned = (e & 1) || (e == 0);
12280 e_conv = DecodeError_clone(&e_conv);
12281 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12282 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12283 return (uint64_t)ret_conv;
12286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12287 if ((_res & 1) != 0) return;
12288 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12290 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12294 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12295 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12296 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12297 return (uint64_t)ret_conv;
12300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12301 LDKUpdateFulfillHTLC o_conv;
12302 o_conv.inner = (void*)(o & (~1));
12303 o_conv.is_owned = (o & 1) || (o == 0);
12304 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12305 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12306 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12307 return (uint64_t)ret_conv;
12310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12311 LDKDecodeError e_conv;
12312 e_conv.inner = (void*)(e & (~1));
12313 e_conv.is_owned = (e & 1) || (e == 0);
12314 e_conv = DecodeError_clone(&e_conv);
12315 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12316 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12317 return (uint64_t)ret_conv;
12320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12321 if ((_res & 1) != 0) return;
12322 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12324 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12328 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12329 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12330 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12331 return (uint64_t)ret_conv;
12334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12335 LDKUpdateAddHTLC o_conv;
12336 o_conv.inner = (void*)(o & (~1));
12337 o_conv.is_owned = (o & 1) || (o == 0);
12338 o_conv = UpdateAddHTLC_clone(&o_conv);
12339 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12340 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12341 return (uint64_t)ret_conv;
12344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12345 LDKDecodeError e_conv;
12346 e_conv.inner = (void*)(e & (~1));
12347 e_conv.is_owned = (e & 1) || (e == 0);
12348 e_conv = DecodeError_clone(&e_conv);
12349 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12350 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12351 return (uint64_t)ret_conv;
12354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12355 if ((_res & 1) != 0) return;
12356 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12358 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12362 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12363 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12364 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12365 return (uint64_t)ret_conv;
12368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12370 o_conv.inner = (void*)(o & (~1));
12371 o_conv.is_owned = (o & 1) || (o == 0);
12372 o_conv = Ping_clone(&o_conv);
12373 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12374 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12375 return (uint64_t)ret_conv;
12378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12379 LDKDecodeError e_conv;
12380 e_conv.inner = (void*)(e & (~1));
12381 e_conv.is_owned = (e & 1) || (e == 0);
12382 e_conv = DecodeError_clone(&e_conv);
12383 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12384 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12385 return (uint64_t)ret_conv;
12388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12389 if ((_res & 1) != 0) return;
12390 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
12392 CResult_PingDecodeErrorZ_free(_res_conv);
12395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12396 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12397 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12398 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12399 return (uint64_t)ret_conv;
12402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12404 o_conv.inner = (void*)(o & (~1));
12405 o_conv.is_owned = (o & 1) || (o == 0);
12406 o_conv = Pong_clone(&o_conv);
12407 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12408 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12409 return (uint64_t)ret_conv;
12412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12413 LDKDecodeError e_conv;
12414 e_conv.inner = (void*)(e & (~1));
12415 e_conv.is_owned = (e & 1) || (e == 0);
12416 e_conv = DecodeError_clone(&e_conv);
12417 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12418 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12419 return (uint64_t)ret_conv;
12422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12423 if ((_res & 1) != 0) return;
12424 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
12426 CResult_PongDecodeErrorZ_free(_res_conv);
12429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12430 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12431 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12432 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12433 return (uint64_t)ret_conv;
12436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12437 LDKUnsignedChannelAnnouncement o_conv;
12438 o_conv.inner = (void*)(o & (~1));
12439 o_conv.is_owned = (o & 1) || (o == 0);
12440 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12441 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12442 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12443 return (uint64_t)ret_conv;
12446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12447 LDKDecodeError e_conv;
12448 e_conv.inner = (void*)(e & (~1));
12449 e_conv.is_owned = (e & 1) || (e == 0);
12450 e_conv = DecodeError_clone(&e_conv);
12451 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12452 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12453 return (uint64_t)ret_conv;
12456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12457 if ((_res & 1) != 0) return;
12458 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12460 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12464 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12465 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12466 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12467 return (uint64_t)ret_conv;
12470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12471 LDKChannelAnnouncement o_conv;
12472 o_conv.inner = (void*)(o & (~1));
12473 o_conv.is_owned = (o & 1) || (o == 0);
12474 o_conv = ChannelAnnouncement_clone(&o_conv);
12475 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12476 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12477 return (uint64_t)ret_conv;
12480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12481 LDKDecodeError e_conv;
12482 e_conv.inner = (void*)(e & (~1));
12483 e_conv.is_owned = (e & 1) || (e == 0);
12484 e_conv = DecodeError_clone(&e_conv);
12485 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12486 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12487 return (uint64_t)ret_conv;
12490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12491 if ((_res & 1) != 0) return;
12492 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12494 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12498 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12499 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12500 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12501 return (uint64_t)ret_conv;
12504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12505 LDKUnsignedChannelUpdate o_conv;
12506 o_conv.inner = (void*)(o & (~1));
12507 o_conv.is_owned = (o & 1) || (o == 0);
12508 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12509 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12510 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12511 return (uint64_t)ret_conv;
12514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12515 LDKDecodeError e_conv;
12516 e_conv.inner = (void*)(e & (~1));
12517 e_conv.is_owned = (e & 1) || (e == 0);
12518 e_conv = DecodeError_clone(&e_conv);
12519 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12520 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12521 return (uint64_t)ret_conv;
12524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12525 if ((_res & 1) != 0) return;
12526 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12528 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12532 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12533 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12534 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12535 return (uint64_t)ret_conv;
12538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12539 LDKChannelUpdate o_conv;
12540 o_conv.inner = (void*)(o & (~1));
12541 o_conv.is_owned = (o & 1) || (o == 0);
12542 o_conv = ChannelUpdate_clone(&o_conv);
12543 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12544 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12545 return (uint64_t)ret_conv;
12548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12549 LDKDecodeError e_conv;
12550 e_conv.inner = (void*)(e & (~1));
12551 e_conv.is_owned = (e & 1) || (e == 0);
12552 e_conv = DecodeError_clone(&e_conv);
12553 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12554 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12555 return (uint64_t)ret_conv;
12558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12559 if ((_res & 1) != 0) return;
12560 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12562 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12566 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12567 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12568 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12569 return (uint64_t)ret_conv;
12572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12573 LDKErrorMessage o_conv;
12574 o_conv.inner = (void*)(o & (~1));
12575 o_conv.is_owned = (o & 1) || (o == 0);
12576 o_conv = ErrorMessage_clone(&o_conv);
12577 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12578 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12579 return (uint64_t)ret_conv;
12582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12583 LDKDecodeError e_conv;
12584 e_conv.inner = (void*)(e & (~1));
12585 e_conv.is_owned = (e & 1) || (e == 0);
12586 e_conv = DecodeError_clone(&e_conv);
12587 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12588 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12589 return (uint64_t)ret_conv;
12592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12593 if ((_res & 1) != 0) return;
12594 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
12596 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12600 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12601 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12602 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12603 return (uint64_t)ret_conv;
12606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12607 LDKUnsignedNodeAnnouncement o_conv;
12608 o_conv.inner = (void*)(o & (~1));
12609 o_conv.is_owned = (o & 1) || (o == 0);
12610 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12611 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12612 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12613 return (uint64_t)ret_conv;
12616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12617 LDKDecodeError e_conv;
12618 e_conv.inner = (void*)(e & (~1));
12619 e_conv.is_owned = (e & 1) || (e == 0);
12620 e_conv = DecodeError_clone(&e_conv);
12621 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12622 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12623 return (uint64_t)ret_conv;
12626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12627 if ((_res & 1) != 0) return;
12628 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12630 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12634 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12635 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12636 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12637 return (uint64_t)ret_conv;
12640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12641 LDKNodeAnnouncement o_conv;
12642 o_conv.inner = (void*)(o & (~1));
12643 o_conv.is_owned = (o & 1) || (o == 0);
12644 o_conv = NodeAnnouncement_clone(&o_conv);
12645 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12646 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12647 return (uint64_t)ret_conv;
12650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12651 LDKDecodeError e_conv;
12652 e_conv.inner = (void*)(e & (~1));
12653 e_conv.is_owned = (e & 1) || (e == 0);
12654 e_conv = DecodeError_clone(&e_conv);
12655 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12656 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12657 return (uint64_t)ret_conv;
12660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12661 if ((_res & 1) != 0) return;
12662 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12664 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12668 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12669 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12670 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12671 return (uint64_t)ret_conv;
12674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12675 LDKQueryShortChannelIds o_conv;
12676 o_conv.inner = (void*)(o & (~1));
12677 o_conv.is_owned = (o & 1) || (o == 0);
12678 o_conv = QueryShortChannelIds_clone(&o_conv);
12679 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12680 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12681 return (uint64_t)ret_conv;
12684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12685 LDKDecodeError e_conv;
12686 e_conv.inner = (void*)(e & (~1));
12687 e_conv.is_owned = (e & 1) || (e == 0);
12688 e_conv = DecodeError_clone(&e_conv);
12689 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12690 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12691 return (uint64_t)ret_conv;
12694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12695 if ((_res & 1) != 0) return;
12696 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
12698 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
12701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12702 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
12703 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12704 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
12705 return (uint64_t)ret_conv;
12708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12709 LDKReplyShortChannelIdsEnd o_conv;
12710 o_conv.inner = (void*)(o & (~1));
12711 o_conv.is_owned = (o & 1) || (o == 0);
12712 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
12713 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12714 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
12715 return (uint64_t)ret_conv;
12718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12719 LDKDecodeError e_conv;
12720 e_conv.inner = (void*)(e & (~1));
12721 e_conv.is_owned = (e & 1) || (e == 0);
12722 e_conv = DecodeError_clone(&e_conv);
12723 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12724 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
12725 return (uint64_t)ret_conv;
12728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12729 if ((_res & 1) != 0) return;
12730 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
12732 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
12735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12736 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
12737 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12738 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
12739 return (uint64_t)ret_conv;
12742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12743 LDKQueryChannelRange o_conv;
12744 o_conv.inner = (void*)(o & (~1));
12745 o_conv.is_owned = (o & 1) || (o == 0);
12746 o_conv = QueryChannelRange_clone(&o_conv);
12747 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12748 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
12749 return (uint64_t)ret_conv;
12752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12753 LDKDecodeError e_conv;
12754 e_conv.inner = (void*)(e & (~1));
12755 e_conv.is_owned = (e & 1) || (e == 0);
12756 e_conv = DecodeError_clone(&e_conv);
12757 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12758 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
12759 return (uint64_t)ret_conv;
12762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12763 if ((_res & 1) != 0) return;
12764 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12766 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
12769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12770 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
12771 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12772 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
12773 return (uint64_t)ret_conv;
12776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12777 LDKReplyChannelRange o_conv;
12778 o_conv.inner = (void*)(o & (~1));
12779 o_conv.is_owned = (o & 1) || (o == 0);
12780 o_conv = ReplyChannelRange_clone(&o_conv);
12781 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12782 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
12783 return (uint64_t)ret_conv;
12786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12787 LDKDecodeError e_conv;
12788 e_conv.inner = (void*)(e & (~1));
12789 e_conv.is_owned = (e & 1) || (e == 0);
12790 e_conv = DecodeError_clone(&e_conv);
12791 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12792 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
12793 return (uint64_t)ret_conv;
12796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12797 if ((_res & 1) != 0) return;
12798 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12800 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
12803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12804 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
12805 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12806 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
12807 return (uint64_t)ret_conv;
12810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12811 LDKGossipTimestampFilter o_conv;
12812 o_conv.inner = (void*)(o & (~1));
12813 o_conv.is_owned = (o & 1) || (o == 0);
12814 o_conv = GossipTimestampFilter_clone(&o_conv);
12815 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12816 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
12817 return (uint64_t)ret_conv;
12820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12821 LDKDecodeError e_conv;
12822 e_conv.inner = (void*)(e & (~1));
12823 e_conv.is_owned = (e & 1) || (e == 0);
12824 e_conv = DecodeError_clone(&e_conv);
12825 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12826 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
12827 return (uint64_t)ret_conv;
12830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12831 if ((_res & 1) != 0) return;
12832 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
12834 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
12837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12838 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
12839 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12840 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
12841 return (uint64_t)ret_conv;
12844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12846 o_conv.inner = (void*)(o & (~1));
12847 o_conv.is_owned = (o & 1) || (o == 0);
12848 o_conv = Invoice_clone(&o_conv);
12849 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12850 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
12851 return (uint64_t)ret_conv;
12854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12855 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
12856 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12857 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
12858 return (uint64_t)ret_conv;
12861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12862 if ((_res & 1) != 0) return;
12863 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
12865 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
12868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12869 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
12870 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12871 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
12872 return (uint64_t)ret_conv;
12875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12876 if ((this_ptr & 1) != 0) return;
12877 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
12878 FREE((void*)this_ptr);
12879 Event_free(this_ptr_conv);
12882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12883 LDKEvent* orig_conv = (LDKEvent*)orig;
12884 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12885 *ret_copy = Event_clone(orig_conv);
12886 uint64_t ret_ref = (uint64_t)ret_copy;
12890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
12891 LDKEvent* obj_conv = (LDKEvent*)obj;
12892 LDKCVec_u8Z ret_var = Event_write(obj_conv);
12893 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12894 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12895 CVec_u8Z_free(ret_var);
12899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12900 if ((this_ptr & 1) != 0) return;
12901 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
12902 FREE((void*)this_ptr);
12903 MessageSendEvent_free(this_ptr_conv);
12906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12907 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
12908 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12909 *ret_copy = MessageSendEvent_clone(orig_conv);
12910 uint64_t ret_ref = (uint64_t)ret_copy;
12914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12915 if ((this_ptr & 1) != 0) return;
12916 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12917 FREE((void*)this_ptr);
12918 MessageSendEventsProvider_free(this_ptr_conv);
12921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12922 if ((this_ptr & 1) != 0) return;
12923 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12924 FREE((void*)this_ptr);
12925 EventsProvider_free(this_ptr_conv);
12928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12929 if ((this_ptr & 1) != 0) return;
12930 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12931 FREE((void*)this_ptr);
12932 EventHandler_free(this_ptr_conv);
12935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12936 if ((this_ptr & 1) != 0) return;
12937 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12938 FREE((void*)this_ptr);
12939 APIError_free(this_ptr_conv);
12942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12943 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12944 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12945 *ret_copy = APIError_clone(orig_conv);
12946 uint64_t ret_ref = (uint64_t)ret_copy;
12950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
12951 LDKu8slice msg_ref;
12952 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12953 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12954 LDKSecretKey sk_ref;
12955 CHECK((*env)->GetArrayLength(env, sk) == 32);
12956 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_ref.bytes);
12957 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12958 *ret_conv = sign(msg_ref, sk_ref);
12959 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12960 return (uint64_t)ret_conv;
12963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
12964 LDKu8slice msg_ref;
12965 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12966 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12967 LDKStr sig_conv = java_to_owned_str(env, sig);
12968 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
12969 *ret_conv = recover_pk(msg_ref, sig_conv);
12970 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12971 return (uint64_t)ret_conv;
12974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
12975 LDKu8slice msg_ref;
12976 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12977 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12978 LDKStr sig_conv = java_to_owned_str(env, sig);
12979 LDKPublicKey pk_ref;
12980 CHECK((*env)->GetArrayLength(env, pk) == 33);
12981 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
12982 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
12983 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12987 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12988 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
12989 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
12993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
12994 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
12995 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
12996 jboolean ret_val = Level_eq(a_conv, b_conv);
13000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
13001 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13002 int64_t ret_val = Level_hash(o_conv);
13006 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
13007 jclass ret_conv = LDKLevel_to_java(env, Level_max());
13011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13012 if ((this_ptr & 1) != 0) return;
13013 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13014 FREE((void*)this_ptr);
13015 Logger_free(this_ptr_conv);
13018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13019 LDKChannelHandshakeConfig this_obj_conv;
13020 this_obj_conv.inner = (void*)(this_obj & (~1));
13021 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13022 ChannelHandshakeConfig_free(this_obj_conv);
13025 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13026 LDKChannelHandshakeConfig this_ptr_conv;
13027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13028 this_ptr_conv.is_owned = false;
13029 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13034 LDKChannelHandshakeConfig this_ptr_conv;
13035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13036 this_ptr_conv.is_owned = false;
13037 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13040 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13041 LDKChannelHandshakeConfig this_ptr_conv;
13042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13043 this_ptr_conv.is_owned = false;
13044 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13049 LDKChannelHandshakeConfig this_ptr_conv;
13050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13051 this_ptr_conv.is_owned = false;
13052 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13056 LDKChannelHandshakeConfig this_ptr_conv;
13057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13058 this_ptr_conv.is_owned = false;
13059 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13064 LDKChannelHandshakeConfig this_ptr_conv;
13065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13066 this_ptr_conv.is_owned = false;
13067 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
13071 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13074 uint64_t ret_ref = (uint64_t)ret_var.inner;
13075 if (ret_var.is_owned) {
13081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13082 LDKChannelHandshakeConfig orig_conv;
13083 orig_conv.inner = (void*)(orig & (~1));
13084 orig_conv.is_owned = false;
13085 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13088 uint64_t ret_ref = (uint64_t)ret_var.inner;
13089 if (ret_var.is_owned) {
13095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
13096 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13099 uint64_t ret_ref = (uint64_t)ret_var.inner;
13100 if (ret_var.is_owned) {
13106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13107 LDKChannelHandshakeLimits this_obj_conv;
13108 this_obj_conv.inner = (void*)(this_obj & (~1));
13109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13110 ChannelHandshakeLimits_free(this_obj_conv);
13113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13114 LDKChannelHandshakeLimits this_ptr_conv;
13115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13116 this_ptr_conv.is_owned = false;
13117 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13122 LDKChannelHandshakeLimits this_ptr_conv;
13123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13124 this_ptr_conv.is_owned = false;
13125 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13129 LDKChannelHandshakeLimits this_ptr_conv;
13130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13131 this_ptr_conv.is_owned = false;
13132 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13137 LDKChannelHandshakeLimits this_ptr_conv;
13138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13139 this_ptr_conv.is_owned = false;
13140 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13144 LDKChannelHandshakeLimits this_ptr_conv;
13145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13146 this_ptr_conv.is_owned = false;
13147 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13152 LDKChannelHandshakeLimits this_ptr_conv;
13153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13154 this_ptr_conv.is_owned = false;
13155 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13159 LDKChannelHandshakeLimits this_ptr_conv;
13160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13161 this_ptr_conv.is_owned = false;
13162 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13167 LDKChannelHandshakeLimits this_ptr_conv;
13168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13169 this_ptr_conv.is_owned = false;
13170 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13173 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13174 LDKChannelHandshakeLimits this_ptr_conv;
13175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13176 this_ptr_conv.is_owned = false;
13177 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13182 LDKChannelHandshakeLimits this_ptr_conv;
13183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13184 this_ptr_conv.is_owned = false;
13185 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13188 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13189 LDKChannelHandshakeLimits this_ptr_conv;
13190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13191 this_ptr_conv.is_owned = false;
13192 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13197 LDKChannelHandshakeLimits this_ptr_conv;
13198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13199 this_ptr_conv.is_owned = false;
13200 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
13204 LDKChannelHandshakeLimits this_ptr_conv;
13205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13206 this_ptr_conv.is_owned = false;
13207 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13212 LDKChannelHandshakeLimits this_ptr_conv;
13213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13214 this_ptr_conv.is_owned = false;
13215 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13218 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13219 LDKChannelHandshakeLimits this_ptr_conv;
13220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13221 this_ptr_conv.is_owned = false;
13222 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13227 LDKChannelHandshakeLimits this_ptr_conv;
13228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13229 this_ptr_conv.is_owned = false;
13230 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, 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, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
13234 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, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
13235 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13236 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13237 uint64_t ret_ref = (uint64_t)ret_var.inner;
13238 if (ret_var.is_owned) {
13244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13245 LDKChannelHandshakeLimits orig_conv;
13246 orig_conv.inner = (void*)(orig & (~1));
13247 orig_conv.is_owned = false;
13248 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13249 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13250 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13251 uint64_t ret_ref = (uint64_t)ret_var.inner;
13252 if (ret_var.is_owned) {
13258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
13259 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13262 uint64_t ret_ref = (uint64_t)ret_var.inner;
13263 if (ret_var.is_owned) {
13269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13270 LDKChannelConfig this_obj_conv;
13271 this_obj_conv.inner = (void*)(this_obj & (~1));
13272 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13273 ChannelConfig_free(this_obj_conv);
13276 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
13277 LDKChannelConfig this_ptr_conv;
13278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13279 this_ptr_conv.is_owned = false;
13280 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
13284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13285 LDKChannelConfig this_ptr_conv;
13286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13287 this_ptr_conv.is_owned = false;
13288 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
13291 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
13292 LDKChannelConfig this_ptr_conv;
13293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13294 this_ptr_conv.is_owned = false;
13295 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13300 LDKChannelConfig this_ptr_conv;
13301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13302 this_ptr_conv.is_owned = false;
13303 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
13307 LDKChannelConfig this_ptr_conv;
13308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13309 this_ptr_conv.is_owned = false;
13310 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13315 LDKChannelConfig this_ptr_conv;
13316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13317 this_ptr_conv.is_owned = false;
13318 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13322 LDKChannelConfig this_ptr_conv;
13323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13324 this_ptr_conv.is_owned = false;
13325 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13330 LDKChannelConfig this_ptr_conv;
13331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13332 this_ptr_conv.is_owned = false;
13333 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
13337 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
13338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13340 uint64_t ret_ref = (uint64_t)ret_var.inner;
13341 if (ret_var.is_owned) {
13347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13348 LDKChannelConfig orig_conv;
13349 orig_conv.inner = (void*)(orig & (~1));
13350 orig_conv.is_owned = false;
13351 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13354 uint64_t ret_ref = (uint64_t)ret_var.inner;
13355 if (ret_var.is_owned) {
13361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
13362 LDKChannelConfig ret_var = ChannelConfig_default();
13363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13365 uint64_t ret_ref = (uint64_t)ret_var.inner;
13366 if (ret_var.is_owned) {
13372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
13373 LDKChannelConfig obj_conv;
13374 obj_conv.inner = (void*)(obj & (~1));
13375 obj_conv.is_owned = false;
13376 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13377 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13378 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13379 CVec_u8Z_free(ret_var);
13383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13384 LDKu8slice ser_ref;
13385 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13386 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13387 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13388 *ret_conv = ChannelConfig_read(ser_ref);
13389 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13390 return (uint64_t)ret_conv;
13393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13394 LDKUserConfig this_obj_conv;
13395 this_obj_conv.inner = (void*)(this_obj & (~1));
13396 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13397 UserConfig_free(this_obj_conv);
13400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
13401 LDKUserConfig this_ptr_conv;
13402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13403 this_ptr_conv.is_owned = false;
13404 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13405 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13406 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13407 uint64_t ret_ref = (uint64_t)ret_var.inner;
13408 if (ret_var.is_owned) {
13414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13415 LDKUserConfig this_ptr_conv;
13416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13417 this_ptr_conv.is_owned = false;
13418 LDKChannelHandshakeConfig val_conv;
13419 val_conv.inner = (void*)(val & (~1));
13420 val_conv.is_owned = (val & 1) || (val == 0);
13421 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13422 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
13426 LDKUserConfig this_ptr_conv;
13427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13428 this_ptr_conv.is_owned = false;
13429 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13432 uint64_t ret_ref = (uint64_t)ret_var.inner;
13433 if (ret_var.is_owned) {
13439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13440 LDKUserConfig this_ptr_conv;
13441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13442 this_ptr_conv.is_owned = false;
13443 LDKChannelHandshakeLimits val_conv;
13444 val_conv.inner = (void*)(val & (~1));
13445 val_conv.is_owned = (val & 1) || (val == 0);
13446 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13447 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
13451 LDKUserConfig this_ptr_conv;
13452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13453 this_ptr_conv.is_owned = false;
13454 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13455 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13456 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13457 uint64_t ret_ref = (uint64_t)ret_var.inner;
13458 if (ret_var.is_owned) {
13464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13465 LDKUserConfig this_ptr_conv;
13466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13467 this_ptr_conv.is_owned = false;
13468 LDKChannelConfig val_conv;
13469 val_conv.inner = (void*)(val & (~1));
13470 val_conv.is_owned = (val & 1) || (val == 0);
13471 val_conv = ChannelConfig_clone(&val_conv);
13472 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg) {
13476 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13477 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13478 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13479 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13480 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13481 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13482 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13483 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13484 LDKChannelConfig channel_options_arg_conv;
13485 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13486 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13487 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13488 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
13489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13491 uint64_t ret_ref = (uint64_t)ret_var.inner;
13492 if (ret_var.is_owned) {
13498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13499 LDKUserConfig orig_conv;
13500 orig_conv.inner = (void*)(orig & (~1));
13501 orig_conv.is_owned = false;
13502 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
13503 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13504 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13505 uint64_t ret_ref = (uint64_t)ret_var.inner;
13506 if (ret_var.is_owned) {
13512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
13513 LDKUserConfig ret_var = UserConfig_default();
13514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13516 uint64_t ret_ref = (uint64_t)ret_var.inner;
13517 if (ret_var.is_owned) {
13523 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13524 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13525 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
13529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13530 if ((this_ptr & 1) != 0) return;
13531 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13532 FREE((void*)this_ptr);
13533 Access_free(this_ptr_conv);
13536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13537 if ((this_ptr & 1) != 0) return;
13538 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13539 FREE((void*)this_ptr);
13540 Listen_free(this_ptr_conv);
13543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13544 if ((this_ptr & 1) != 0) return;
13545 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13546 FREE((void*)this_ptr);
13547 Confirm_free(this_ptr_conv);
13550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13551 if ((this_ptr & 1) != 0) return;
13552 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13553 FREE((void*)this_ptr);
13554 Watch_free(this_ptr_conv);
13557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13558 if ((this_ptr & 1) != 0) return;
13559 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13560 FREE((void*)this_ptr);
13561 Filter_free(this_ptr_conv);
13564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13565 LDKWatchedOutput this_obj_conv;
13566 this_obj_conv.inner = (void*)(this_obj & (~1));
13567 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13568 WatchedOutput_free(this_obj_conv);
13571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13572 LDKWatchedOutput this_ptr_conv;
13573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13574 this_ptr_conv.is_owned = false;
13575 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13576 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
13580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13581 LDKWatchedOutput this_ptr_conv;
13582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13583 this_ptr_conv.is_owned = false;
13584 LDKThirtyTwoBytes val_ref;
13585 CHECK((*env)->GetArrayLength(env, val) == 32);
13586 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13587 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13591 LDKWatchedOutput this_ptr_conv;
13592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13593 this_ptr_conv.is_owned = false;
13594 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13597 uint64_t ret_ref = (uint64_t)ret_var.inner;
13598 if (ret_var.is_owned) {
13604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13605 LDKWatchedOutput this_ptr_conv;
13606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13607 this_ptr_conv.is_owned = false;
13608 LDKOutPoint val_conv;
13609 val_conv.inner = (void*)(val & (~1));
13610 val_conv.is_owned = (val & 1) || (val == 0);
13611 val_conv = OutPoint_clone(&val_conv);
13612 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13616 LDKWatchedOutput this_ptr_conv;
13617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13618 this_ptr_conv.is_owned = false;
13619 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13620 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13621 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13626 LDKWatchedOutput this_ptr_conv;
13627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13628 this_ptr_conv.is_owned = false;
13629 LDKCVec_u8Z val_ref;
13630 val_ref.datalen = (*env)->GetArrayLength(env, val);
13631 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13632 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13633 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
13637 LDKThirtyTwoBytes block_hash_arg_ref;
13638 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
13639 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
13640 LDKOutPoint outpoint_arg_conv;
13641 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13642 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13643 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13644 LDKCVec_u8Z script_pubkey_arg_ref;
13645 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
13646 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13647 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
13648 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13651 uint64_t ret_ref = (uint64_t)ret_var.inner;
13652 if (ret_var.is_owned) {
13658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13659 LDKWatchedOutput orig_conv;
13660 orig_conv.inner = (void*)(orig & (~1));
13661 orig_conv.is_owned = false;
13662 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13663 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13664 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13665 uint64_t ret_ref = (uint64_t)ret_var.inner;
13666 if (ret_var.is_owned) {
13672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
13673 LDKWatchedOutput o_conv;
13674 o_conv.inner = (void*)(o & (~1));
13675 o_conv.is_owned = false;
13676 int64_t ret_val = WatchedOutput_hash(&o_conv);
13680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13681 if ((this_ptr & 1) != 0) return;
13682 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13683 FREE((void*)this_ptr);
13684 BroadcasterInterface_free(this_ptr_conv);
13687 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13688 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13689 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
13693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13694 if ((this_ptr & 1) != 0) return;
13695 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13696 FREE((void*)this_ptr);
13697 FeeEstimator_free(this_ptr_conv);
13700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13701 LDKChainMonitor this_obj_conv;
13702 this_obj_conv.inner = (void*)(this_obj & (~1));
13703 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13704 ChainMonitor_free(this_obj_conv);
13707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *env, jclass clz, int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
13708 LDKFilter *chain_source_conv_ptr = NULL;
13709 if (chain_source != 0) {
13710 LDKFilter chain_source_conv;
13711 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
13712 if (chain_source_conv.free == LDKFilter_JCalls_free) {
13713 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13714 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
13716 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13717 *chain_source_conv_ptr = chain_source_conv;
13719 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13720 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
13721 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13722 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
13724 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13725 if (logger_conv.free == LDKLogger_JCalls_free) {
13726 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13727 LDKLogger_JCalls_clone(logger_conv.this_arg);
13729 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13730 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
13731 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13732 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
13734 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13735 if (persister_conv.free == LDKPersist_JCalls_free) {
13736 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13737 LDKPersist_JCalls_clone(persister_conv.this_arg);
13739 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
13740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13742 uint64_t ret_ref = (uint64_t)ret_var.inner;
13743 if (ret_var.is_owned) {
13749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
13750 LDKChainMonitor this_arg_conv;
13751 this_arg_conv.inner = (void*)(this_arg & (~1));
13752 this_arg_conv.is_owned = false;
13753 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
13754 *ret = ChainMonitor_as_Listen(&this_arg_conv);
13755 return (uint64_t)ret;
13758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
13759 LDKChainMonitor this_arg_conv;
13760 this_arg_conv.inner = (void*)(this_arg & (~1));
13761 this_arg_conv.is_owned = false;
13762 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13763 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
13764 return (uint64_t)ret;
13767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13768 LDKChainMonitor this_arg_conv;
13769 this_arg_conv.inner = (void*)(this_arg & (~1));
13770 this_arg_conv.is_owned = false;
13771 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
13772 *ret = ChainMonitor_as_Watch(&this_arg_conv);
13773 return (uint64_t)ret;
13776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
13777 LDKChainMonitor this_arg_conv;
13778 this_arg_conv.inner = (void*)(this_arg & (~1));
13779 this_arg_conv.is_owned = false;
13780 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13781 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
13782 return (uint64_t)ret;
13785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13786 LDKChannelMonitorUpdate this_obj_conv;
13787 this_obj_conv.inner = (void*)(this_obj & (~1));
13788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13789 ChannelMonitorUpdate_free(this_obj_conv);
13792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13793 LDKChannelMonitorUpdate this_ptr_conv;
13794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13795 this_ptr_conv.is_owned = false;
13796 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
13800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13801 LDKChannelMonitorUpdate this_ptr_conv;
13802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13803 this_ptr_conv.is_owned = false;
13804 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
13807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13808 LDKChannelMonitorUpdate orig_conv;
13809 orig_conv.inner = (void*)(orig & (~1));
13810 orig_conv.is_owned = false;
13811 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
13812 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13813 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13814 uint64_t ret_ref = (uint64_t)ret_var.inner;
13815 if (ret_var.is_owned) {
13821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13822 LDKChannelMonitorUpdate obj_conv;
13823 obj_conv.inner = (void*)(obj & (~1));
13824 obj_conv.is_owned = false;
13825 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
13826 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13827 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13828 CVec_u8Z_free(ret_var);
13832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13833 LDKu8slice ser_ref;
13834 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13835 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13836 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13837 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
13838 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13839 return (uint64_t)ret_conv;
13842 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13843 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13844 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
13848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13849 LDKMonitorUpdateError this_obj_conv;
13850 this_obj_conv.inner = (void*)(this_obj & (~1));
13851 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13852 MonitorUpdateError_free(this_obj_conv);
13855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13856 LDKMonitorUpdateError orig_conv;
13857 orig_conv.inner = (void*)(orig & (~1));
13858 orig_conv.is_owned = false;
13859 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
13860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13862 uint64_t ret_ref = (uint64_t)ret_var.inner;
13863 if (ret_var.is_owned) {
13869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13870 if ((this_ptr & 1) != 0) return;
13871 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
13872 FREE((void*)this_ptr);
13873 MonitorEvent_free(this_ptr_conv);
13876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13877 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
13878 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13879 *ret_copy = MonitorEvent_clone(orig_conv);
13880 uint64_t ret_ref = (uint64_t)ret_copy;
13884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13885 LDKHTLCUpdate this_obj_conv;
13886 this_obj_conv.inner = (void*)(this_obj & (~1));
13887 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13888 HTLCUpdate_free(this_obj_conv);
13891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13892 LDKHTLCUpdate orig_conv;
13893 orig_conv.inner = (void*)(orig & (~1));
13894 orig_conv.is_owned = false;
13895 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
13896 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13897 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13898 uint64_t ret_ref = (uint64_t)ret_var.inner;
13899 if (ret_var.is_owned) {
13905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13906 LDKHTLCUpdate obj_conv;
13907 obj_conv.inner = (void*)(obj & (~1));
13908 obj_conv.is_owned = false;
13909 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
13910 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13911 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13912 CVec_u8Z_free(ret_var);
13916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13917 LDKu8slice ser_ref;
13918 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13919 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13920 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13921 *ret_conv = HTLCUpdate_read(ser_ref);
13922 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13923 return (uint64_t)ret_conv;
13926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13927 LDKChannelMonitor this_obj_conv;
13928 this_obj_conv.inner = (void*)(this_obj & (~1));
13929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13930 ChannelMonitor_free(this_obj_conv);
13933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13934 LDKChannelMonitor orig_conv;
13935 orig_conv.inner = (void*)(orig & (~1));
13936 orig_conv.is_owned = false;
13937 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
13938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13940 uint64_t ret_ref = (uint64_t)ret_var.inner;
13941 if (ret_var.is_owned) {
13947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
13948 LDKChannelMonitor obj_conv;
13949 obj_conv.inner = (void*)(obj & (~1));
13950 obj_conv.is_owned = false;
13951 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
13952 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13953 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13954 CVec_u8Z_free(ret_var);
13958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
13959 LDKChannelMonitor this_arg_conv;
13960 this_arg_conv.inner = (void*)(this_arg & (~1));
13961 this_arg_conv.is_owned = false;
13962 LDKChannelMonitorUpdate updates_conv;
13963 updates_conv.inner = (void*)(updates & (~1));
13964 updates_conv.is_owned = false;
13965 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13966 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13967 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13968 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13969 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
13970 return (uint64_t)ret_conv;
13973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13974 LDKChannelMonitor this_arg_conv;
13975 this_arg_conv.inner = (void*)(this_arg & (~1));
13976 this_arg_conv.is_owned = false;
13977 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
13981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
13982 LDKChannelMonitor this_arg_conv;
13983 this_arg_conv.inner = (void*)(this_arg & (~1));
13984 this_arg_conv.is_owned = false;
13985 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13986 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
13987 return (uint64_t)ret_ref;
13990 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13991 LDKChannelMonitor this_arg_conv;
13992 this_arg_conv.inner = (void*)(this_arg & (~1));
13993 this_arg_conv.is_owned = false;
13994 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
13995 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13996 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13997 for (size_t v = 0; v < ret_var.datalen; v++) {
13998 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
13999 *ret_conv_47_ref = ret_var.data[v];
14000 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
14002 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14003 FREE(ret_var.data);
14007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
14008 LDKChannelMonitor this_arg_conv;
14009 this_arg_conv.inner = (void*)(this_arg & (~1));
14010 this_arg_conv.is_owned = false;
14011 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14012 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14015 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14016 LDKChannelMonitor this_arg_conv;
14017 this_arg_conv.inner = (void*)(this_arg & (~1));
14018 this_arg_conv.is_owned = false;
14019 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14020 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14021 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14022 for (size_t o = 0; o < ret_var.datalen; o++) {
14023 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14024 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14025 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14026 ret_arr_ptr[o] = ret_conv_14_ref;
14028 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14029 FREE(ret_var.data);
14033 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14034 LDKChannelMonitor this_arg_conv;
14035 this_arg_conv.inner = (void*)(this_arg & (~1));
14036 this_arg_conv.is_owned = false;
14037 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14038 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14039 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14040 for (size_t h = 0; h < ret_var.datalen; h++) {
14041 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14042 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14043 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14044 ret_arr_ptr[h] = ret_conv_7_ref;
14046 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14047 FREE(ret_var.data);
14051 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
14052 LDKChannelMonitor this_arg_conv;
14053 this_arg_conv.inner = (void*)(this_arg & (~1));
14054 this_arg_conv.is_owned = false;
14055 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14056 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14057 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14059 for (size_t i = 0; i < ret_var.datalen; i++) {
14060 LDKTransaction ret_conv_8_var = ret_var.data[i];
14061 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
14062 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
14063 Transaction_free(ret_conv_8_var);
14064 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14066 FREE(ret_var.data);
14070 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
14071 LDKChannelMonitor this_arg_conv;
14072 this_arg_conv.inner = (void*)(this_arg & (~1));
14073 this_arg_conv.is_owned = false;
14074 unsigned char header_arr[80];
14075 CHECK((*env)->GetArrayLength(env, header) == 80);
14076 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14077 unsigned char (*header_ref)[80] = &header_arr;
14078 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14079 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14080 if (txdata_constr.datalen > 0)
14081 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14083 txdata_constr.data = NULL;
14084 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14085 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14086 int64_t txdata_conv_24 = txdata_vals[y];
14087 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14088 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14089 txdata_constr.data[y] = txdata_conv_24_conv;
14091 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14092 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14093 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14094 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14095 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14097 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14098 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14099 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14100 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14102 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14103 if (logger_conv.free == LDKLogger_JCalls_free) {
14104 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14105 LDKLogger_JCalls_clone(logger_conv.this_arg);
14107 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);
14108 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14109 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14110 for (size_t u = 0; u < ret_var.datalen; u++) {
14111 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14112 *ret_conv_46_ref = ret_var.data[u];
14113 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14115 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14116 FREE(ret_var.data);
14120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
14121 LDKChannelMonitor this_arg_conv;
14122 this_arg_conv.inner = (void*)(this_arg & (~1));
14123 this_arg_conv.is_owned = false;
14124 unsigned char header_arr[80];
14125 CHECK((*env)->GetArrayLength(env, header) == 80);
14126 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14127 unsigned char (*header_ref)[80] = &header_arr;
14128 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14129 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14130 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14131 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14133 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14134 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14135 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14136 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14138 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14139 if (logger_conv.free == LDKLogger_JCalls_free) {
14140 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14141 LDKLogger_JCalls_clone(logger_conv.this_arg);
14143 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14146 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
14147 LDKChannelMonitor this_arg_conv;
14148 this_arg_conv.inner = (void*)(this_arg & (~1));
14149 this_arg_conv.is_owned = false;
14150 unsigned char header_arr[80];
14151 CHECK((*env)->GetArrayLength(env, header) == 80);
14152 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14153 unsigned char (*header_ref)[80] = &header_arr;
14154 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14155 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14156 if (txdata_constr.datalen > 0)
14157 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14159 txdata_constr.data = NULL;
14160 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14161 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14162 int64_t txdata_conv_24 = txdata_vals[y];
14163 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14164 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14165 txdata_constr.data[y] = txdata_conv_24_conv;
14167 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14168 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14169 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14170 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14171 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14173 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14174 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14175 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14176 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14178 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14179 if (logger_conv.free == LDKLogger_JCalls_free) {
14180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14181 LDKLogger_JCalls_clone(logger_conv.this_arg);
14183 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14184 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14185 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14186 for (size_t u = 0; u < ret_var.datalen; u++) {
14187 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14188 *ret_conv_46_ref = ret_var.data[u];
14189 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14191 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14192 FREE(ret_var.data);
14196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
14197 LDKChannelMonitor this_arg_conv;
14198 this_arg_conv.inner = (void*)(this_arg & (~1));
14199 this_arg_conv.is_owned = false;
14200 unsigned char txid_arr[32];
14201 CHECK((*env)->GetArrayLength(env, txid) == 32);
14202 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14203 unsigned char (*txid_ref)[32] = &txid_arr;
14204 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14205 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14206 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14207 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14209 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14210 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14211 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14212 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14214 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14215 if (logger_conv.free == LDKLogger_JCalls_free) {
14216 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14217 LDKLogger_JCalls_clone(logger_conv.this_arg);
14219 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14222 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
14223 LDKChannelMonitor this_arg_conv;
14224 this_arg_conv.inner = (void*)(this_arg & (~1));
14225 this_arg_conv.is_owned = false;
14226 unsigned char header_arr[80];
14227 CHECK((*env)->GetArrayLength(env, header) == 80);
14228 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14229 unsigned char (*header_ref)[80] = &header_arr;
14230 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14231 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14232 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14233 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14235 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14236 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14237 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14238 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14240 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14241 if (logger_conv.free == LDKLogger_JCalls_free) {
14242 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14243 LDKLogger_JCalls_clone(logger_conv.this_arg);
14245 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14246 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14247 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14248 for (size_t u = 0; u < ret_var.datalen; u++) {
14249 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14250 *ret_conv_46_ref = ret_var.data[u];
14251 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14253 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14254 FREE(ret_var.data);
14258 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14259 LDKChannelMonitor this_arg_conv;
14260 this_arg_conv.inner = (void*)(this_arg & (~1));
14261 this_arg_conv.is_owned = false;
14262 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14263 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14265 for (size_t i = 0; i < ret_var.datalen; i++) {
14266 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
14267 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
14268 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14270 FREE(ret_var.data);
14274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14275 if ((this_ptr & 1) != 0) return;
14276 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14277 FREE((void*)this_ptr);
14278 Persist_free(this_ptr_conv);
14281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
14282 LDKu8slice ser_ref;
14283 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14284 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14285 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14286 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14287 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14288 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14289 return (uint64_t)ret_conv;
14292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14293 LDKOutPoint this_obj_conv;
14294 this_obj_conv.inner = (void*)(this_obj & (~1));
14295 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14296 OutPoint_free(this_obj_conv);
14299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
14300 LDKOutPoint this_ptr_conv;
14301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14302 this_ptr_conv.is_owned = false;
14303 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
14308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14309 LDKOutPoint this_ptr_conv;
14310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14311 this_ptr_conv.is_owned = false;
14312 LDKThirtyTwoBytes val_ref;
14313 CHECK((*env)->GetArrayLength(env, val) == 32);
14314 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14315 OutPoint_set_txid(&this_ptr_conv, val_ref);
14318 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
14319 LDKOutPoint this_ptr_conv;
14320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14321 this_ptr_conv.is_owned = false;
14322 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14327 LDKOutPoint this_ptr_conv;
14328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14329 this_ptr_conv.is_owned = false;
14330 OutPoint_set_index(&this_ptr_conv, val);
14333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
14334 LDKThirtyTwoBytes txid_arg_ref;
14335 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
14336 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
14337 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14340 uint64_t ret_ref = (uint64_t)ret_var.inner;
14341 if (ret_var.is_owned) {
14347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14348 LDKOutPoint orig_conv;
14349 orig_conv.inner = (void*)(orig & (~1));
14350 orig_conv.is_owned = false;
14351 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14354 uint64_t ret_ref = (uint64_t)ret_var.inner;
14355 if (ret_var.is_owned) {
14361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14362 LDKOutPoint a_conv;
14363 a_conv.inner = (void*)(a & (~1));
14364 a_conv.is_owned = false;
14365 LDKOutPoint b_conv;
14366 b_conv.inner = (void*)(b & (~1));
14367 b_conv.is_owned = false;
14368 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
14373 LDKOutPoint o_conv;
14374 o_conv.inner = (void*)(o & (~1));
14375 o_conv.is_owned = false;
14376 int64_t ret_val = OutPoint_hash(&o_conv);
14380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14381 LDKOutPoint this_arg_conv;
14382 this_arg_conv.inner = (void*)(this_arg & (~1));
14383 this_arg_conv.is_owned = false;
14384 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14385 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
14389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
14390 LDKOutPoint obj_conv;
14391 obj_conv.inner = (void*)(obj & (~1));
14392 obj_conv.is_owned = false;
14393 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14394 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14395 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14396 CVec_u8Z_free(ret_var);
14400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14401 LDKu8slice ser_ref;
14402 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14403 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14404 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14405 *ret_conv = OutPoint_read(ser_ref);
14406 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14407 return (uint64_t)ret_conv;
14410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14411 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14412 this_obj_conv.inner = (void*)(this_obj & (~1));
14413 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14414 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14418 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14420 this_ptr_conv.is_owned = false;
14421 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14424 uint64_t ret_ref = (uint64_t)ret_var.inner;
14425 if (ret_var.is_owned) {
14431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14432 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14434 this_ptr_conv.is_owned = false;
14435 LDKOutPoint val_conv;
14436 val_conv.inner = (void*)(val & (~1));
14437 val_conv.is_owned = (val & 1) || (val == 0);
14438 val_conv = OutPoint_clone(&val_conv);
14439 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14442 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14443 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14445 this_ptr_conv.is_owned = false;
14446 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14447 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
14451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14452 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14454 this_ptr_conv.is_owned = false;
14455 LDKPublicKey val_ref;
14456 CHECK((*env)->GetArrayLength(env, val) == 33);
14457 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14458 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14461 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14462 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14464 this_ptr_conv.is_owned = false;
14465 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14470 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14472 this_ptr_conv.is_owned = false;
14473 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14477 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14479 this_ptr_conv.is_owned = false;
14480 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14481 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14485 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14487 this_ptr_conv.is_owned = false;
14488 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
14493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14494 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14496 this_ptr_conv.is_owned = false;
14497 LDKPublicKey val_ref;
14498 CHECK((*env)->GetArrayLength(env, val) == 33);
14499 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14500 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14504 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14506 this_ptr_conv.is_owned = false;
14507 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14508 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14513 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14515 this_ptr_conv.is_owned = false;
14516 LDKThirtyTwoBytes val_ref;
14517 CHECK((*env)->GetArrayLength(env, val) == 32);
14518 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14519 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14523 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14525 this_ptr_conv.is_owned = false;
14526 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14531 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14533 this_ptr_conv.is_owned = false;
14534 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
14538 LDKOutPoint outpoint_arg_conv;
14539 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14540 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14541 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14542 LDKPublicKey per_commitment_point_arg_ref;
14543 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14544 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14545 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14546 LDKPublicKey revocation_pubkey_arg_ref;
14547 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
14548 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
14549 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14550 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14551 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14552 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);
14553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14555 uint64_t ret_ref = (uint64_t)ret_var.inner;
14556 if (ret_var.is_owned) {
14562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14563 LDKDelayedPaymentOutputDescriptor orig_conv;
14564 orig_conv.inner = (void*)(orig & (~1));
14565 orig_conv.is_owned = false;
14566 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14569 uint64_t ret_ref = (uint64_t)ret_var.inner;
14570 if (ret_var.is_owned) {
14576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14577 LDKDelayedPaymentOutputDescriptor obj_conv;
14578 obj_conv.inner = (void*)(obj & (~1));
14579 obj_conv.is_owned = false;
14580 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14581 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14582 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14583 CVec_u8Z_free(ret_var);
14587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14588 LDKu8slice ser_ref;
14589 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14590 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14591 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14592 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14593 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14594 return (uint64_t)ret_conv;
14597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14598 LDKStaticPaymentOutputDescriptor this_obj_conv;
14599 this_obj_conv.inner = (void*)(this_obj & (~1));
14600 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14601 StaticPaymentOutputDescriptor_free(this_obj_conv);
14604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14605 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14607 this_ptr_conv.is_owned = false;
14608 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14611 uint64_t ret_ref = (uint64_t)ret_var.inner;
14612 if (ret_var.is_owned) {
14618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14619 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14621 this_ptr_conv.is_owned = false;
14622 LDKOutPoint val_conv;
14623 val_conv.inner = (void*)(val & (~1));
14624 val_conv.is_owned = (val & 1) || (val == 0);
14625 val_conv = OutPoint_clone(&val_conv);
14626 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14630 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14632 this_ptr_conv.is_owned = false;
14633 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14634 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14638 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14640 this_ptr_conv.is_owned = false;
14641 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14642 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14647 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14649 this_ptr_conv.is_owned = false;
14650 LDKThirtyTwoBytes val_ref;
14651 CHECK((*env)->GetArrayLength(env, val) == 32);
14652 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14653 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14657 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14659 this_ptr_conv.is_owned = false;
14660 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14665 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14667 this_ptr_conv.is_owned = false;
14668 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
14672 LDKOutPoint outpoint_arg_conv;
14673 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14674 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14675 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14676 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14677 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14678 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14679 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14680 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14683 uint64_t ret_ref = (uint64_t)ret_var.inner;
14684 if (ret_var.is_owned) {
14690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14691 LDKStaticPaymentOutputDescriptor orig_conv;
14692 orig_conv.inner = (void*)(orig & (~1));
14693 orig_conv.is_owned = false;
14694 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14697 uint64_t ret_ref = (uint64_t)ret_var.inner;
14698 if (ret_var.is_owned) {
14704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14705 LDKStaticPaymentOutputDescriptor obj_conv;
14706 obj_conv.inner = (void*)(obj & (~1));
14707 obj_conv.is_owned = false;
14708 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
14709 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14710 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14711 CVec_u8Z_free(ret_var);
14715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14716 LDKu8slice ser_ref;
14717 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14718 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14719 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14720 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
14721 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14722 return (uint64_t)ret_conv;
14725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14726 if ((this_ptr & 1) != 0) return;
14727 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
14728 FREE((void*)this_ptr);
14729 SpendableOutputDescriptor_free(this_ptr_conv);
14732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14733 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
14734 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14735 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
14736 uint64_t ret_ref = (uint64_t)ret_copy;
14740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14741 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
14742 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
14743 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14744 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14745 CVec_u8Z_free(ret_var);
14749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14750 LDKu8slice ser_ref;
14751 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14752 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14753 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14754 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
14755 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14756 return (uint64_t)ret_conv;
14759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14760 if ((this_ptr & 1) != 0) return;
14761 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
14762 FREE((void*)this_ptr);
14763 BaseSign_free(this_ptr_conv);
14766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14767 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
14768 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
14769 *ret = Sign_clone(orig_conv);
14770 return (uint64_t)ret;
14773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14774 if ((this_ptr & 1) != 0) return;
14775 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
14776 FREE((void*)this_ptr);
14777 Sign_free(this_ptr_conv);
14780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14781 if ((this_ptr & 1) != 0) return;
14782 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
14783 FREE((void*)this_ptr);
14784 KeysInterface_free(this_ptr_conv);
14787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14788 LDKInMemorySigner this_obj_conv;
14789 this_obj_conv.inner = (void*)(this_obj & (~1));
14790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14791 InMemorySigner_free(this_obj_conv);
14794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14795 LDKInMemorySigner this_ptr_conv;
14796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14797 this_ptr_conv.is_owned = false;
14798 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14799 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
14803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14804 LDKInMemorySigner this_ptr_conv;
14805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14806 this_ptr_conv.is_owned = false;
14807 LDKSecretKey val_ref;
14808 CHECK((*env)->GetArrayLength(env, val) == 32);
14809 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14810 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
14813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14814 LDKInMemorySigner this_ptr_conv;
14815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14816 this_ptr_conv.is_owned = false;
14817 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14818 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
14822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14823 LDKInMemorySigner this_ptr_conv;
14824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14825 this_ptr_conv.is_owned = false;
14826 LDKSecretKey val_ref;
14827 CHECK((*env)->GetArrayLength(env, val) == 32);
14828 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14829 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
14832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14833 LDKInMemorySigner this_ptr_conv;
14834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14835 this_ptr_conv.is_owned = false;
14836 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14837 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
14841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14842 LDKInMemorySigner this_ptr_conv;
14843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14844 this_ptr_conv.is_owned = false;
14845 LDKSecretKey val_ref;
14846 CHECK((*env)->GetArrayLength(env, val) == 32);
14847 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14848 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
14851 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14852 LDKInMemorySigner this_ptr_conv;
14853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14854 this_ptr_conv.is_owned = false;
14855 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14856 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
14860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14861 LDKInMemorySigner this_ptr_conv;
14862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14863 this_ptr_conv.is_owned = false;
14864 LDKSecretKey val_ref;
14865 CHECK((*env)->GetArrayLength(env, val) == 32);
14866 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14867 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
14870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14871 LDKInMemorySigner this_ptr_conv;
14872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14873 this_ptr_conv.is_owned = false;
14874 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14875 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
14879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14880 LDKInMemorySigner this_ptr_conv;
14881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14882 this_ptr_conv.is_owned = false;
14883 LDKSecretKey val_ref;
14884 CHECK((*env)->GetArrayLength(env, val) == 32);
14885 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14886 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
14889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
14890 LDKInMemorySigner this_ptr_conv;
14891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14892 this_ptr_conv.is_owned = false;
14893 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14894 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
14898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14899 LDKInMemorySigner this_ptr_conv;
14900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14901 this_ptr_conv.is_owned = false;
14902 LDKThirtyTwoBytes val_ref;
14903 CHECK((*env)->GetArrayLength(env, val) == 32);
14904 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14905 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
14908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14909 LDKInMemorySigner orig_conv;
14910 orig_conv.inner = (void*)(orig & (~1));
14911 orig_conv.is_owned = false;
14912 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
14913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14915 uint64_t ret_ref = (uint64_t)ret_var.inner;
14916 if (ret_var.is_owned) {
14922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, 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) {
14923 LDKSecretKey funding_key_ref;
14924 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
14925 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
14926 LDKSecretKey revocation_base_key_ref;
14927 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
14928 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
14929 LDKSecretKey payment_key_ref;
14930 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
14931 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
14932 LDKSecretKey delayed_payment_base_key_ref;
14933 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
14934 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
14935 LDKSecretKey htlc_base_key_ref;
14936 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
14937 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
14938 LDKThirtyTwoBytes commitment_seed_ref;
14939 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14940 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
14941 LDKThirtyTwoBytes channel_keys_id_ref;
14942 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
14943 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
14944 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);
14945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14947 uint64_t ret_ref = (uint64_t)ret_var.inner;
14948 if (ret_var.is_owned) {
14954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
14955 LDKInMemorySigner this_arg_conv;
14956 this_arg_conv.inner = (void*)(this_arg & (~1));
14957 this_arg_conv.is_owned = false;
14958 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
14959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14961 uint64_t ret_ref = (uint64_t)ret_var.inner;
14962 if (ret_var.is_owned) {
14968 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14969 LDKInMemorySigner this_arg_conv;
14970 this_arg_conv.inner = (void*)(this_arg & (~1));
14971 this_arg_conv.is_owned = false;
14972 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
14976 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14977 LDKInMemorySigner this_arg_conv;
14978 this_arg_conv.inner = (void*)(this_arg & (~1));
14979 this_arg_conv.is_owned = false;
14980 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
14984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
14985 LDKInMemorySigner this_arg_conv;
14986 this_arg_conv.inner = (void*)(this_arg & (~1));
14987 this_arg_conv.is_owned = false;
14988 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
14992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
14993 LDKInMemorySigner this_arg_conv;
14994 this_arg_conv.inner = (void*)(this_arg & (~1));
14995 this_arg_conv.is_owned = false;
14996 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
14997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14999 uint64_t ret_ref = (uint64_t)ret_var.inner;
15000 if (ret_var.is_owned) {
15006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
15007 LDKInMemorySigner this_arg_conv;
15008 this_arg_conv.inner = (void*)(this_arg & (~1));
15009 this_arg_conv.is_owned = false;
15010 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15013 uint64_t ret_ref = (uint64_t)ret_var.inner;
15014 if (ret_var.is_owned) {
15020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
15021 LDKInMemorySigner this_arg_conv;
15022 this_arg_conv.inner = (void*)(this_arg & (~1));
15023 this_arg_conv.is_owned = false;
15024 LDKTransaction spend_tx_ref;
15025 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15026 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15027 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15028 spend_tx_ref.data_is_owned = true;
15029 LDKStaticPaymentOutputDescriptor descriptor_conv;
15030 descriptor_conv.inner = (void*)(descriptor & (~1));
15031 descriptor_conv.is_owned = false;
15032 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15033 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15034 return (uint64_t)ret_conv;
15037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
15038 LDKInMemorySigner this_arg_conv;
15039 this_arg_conv.inner = (void*)(this_arg & (~1));
15040 this_arg_conv.is_owned = false;
15041 LDKTransaction spend_tx_ref;
15042 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15043 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15044 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15045 spend_tx_ref.data_is_owned = true;
15046 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15047 descriptor_conv.inner = (void*)(descriptor & (~1));
15048 descriptor_conv.is_owned = false;
15049 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15050 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15051 return (uint64_t)ret_conv;
15054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
15055 LDKInMemorySigner this_arg_conv;
15056 this_arg_conv.inner = (void*)(this_arg & (~1));
15057 this_arg_conv.is_owned = false;
15058 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15059 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15060 return (uint64_t)ret;
15063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
15064 LDKInMemorySigner this_arg_conv;
15065 this_arg_conv.inner = (void*)(this_arg & (~1));
15066 this_arg_conv.is_owned = false;
15067 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15068 *ret = InMemorySigner_as_Sign(&this_arg_conv);
15069 return (uint64_t)ret;
15072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
15073 LDKInMemorySigner obj_conv;
15074 obj_conv.inner = (void*)(obj & (~1));
15075 obj_conv.is_owned = false;
15076 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15077 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15078 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15079 CVec_u8Z_free(ret_var);
15083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15084 LDKu8slice ser_ref;
15085 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15086 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15087 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15088 *ret_conv = InMemorySigner_read(ser_ref);
15089 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15090 return (uint64_t)ret_conv;
15093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15094 LDKKeysManager this_obj_conv;
15095 this_obj_conv.inner = (void*)(this_obj & (~1));
15096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15097 KeysManager_free(this_obj_conv);
15100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
15101 unsigned char seed_arr[32];
15102 CHECK((*env)->GetArrayLength(env, seed) == 32);
15103 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
15104 unsigned char (*seed_ref)[32] = &seed_arr;
15105 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15108 uint64_t ret_ref = (uint64_t)ret_var.inner;
15109 if (ret_var.is_owned) {
15115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
15116 LDKKeysManager this_arg_conv;
15117 this_arg_conv.inner = (void*)(this_arg & (~1));
15118 this_arg_conv.is_owned = false;
15119 unsigned char params_arr[32];
15120 CHECK((*env)->GetArrayLength(env, params) == 32);
15121 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
15122 unsigned char (*params_ref)[32] = ¶ms_arr;
15123 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15126 uint64_t ret_ref = (uint64_t)ret_var.inner;
15127 if (ret_var.is_owned) {
15133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
15134 LDKKeysManager this_arg_conv;
15135 this_arg_conv.inner = (void*)(this_arg & (~1));
15136 this_arg_conv.is_owned = false;
15137 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15138 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
15139 if (descriptors_constr.datalen > 0)
15140 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15142 descriptors_constr.data = NULL;
15143 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
15144 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15145 int64_t descriptors_conv_27 = descriptors_vals[b];
15146 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15147 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15148 descriptors_constr.data[b] = descriptors_conv_27_conv;
15150 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
15151 LDKCVec_TxOutZ outputs_constr;
15152 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15153 if (outputs_constr.datalen > 0)
15154 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15156 outputs_constr.data = NULL;
15157 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15158 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15159 int64_t outputs_conv_7 = outputs_vals[h];
15160 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15161 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15162 outputs_constr.data[h] = outputs_conv_7_conv;
15164 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15165 LDKCVec_u8Z change_destination_script_ref;
15166 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
15167 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15168 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
15169 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15170 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15171 return (uint64_t)ret_conv;
15174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
15175 LDKKeysManager this_arg_conv;
15176 this_arg_conv.inner = (void*)(this_arg & (~1));
15177 this_arg_conv.is_owned = false;
15178 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15179 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
15180 return (uint64_t)ret;
15183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15184 LDKChannelManager this_obj_conv;
15185 this_obj_conv.inner = (void*)(this_obj & (~1));
15186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15187 ChannelManager_free(this_obj_conv);
15190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15191 LDKChainParameters this_obj_conv;
15192 this_obj_conv.inner = (void*)(this_obj & (~1));
15193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15194 ChainParameters_free(this_obj_conv);
15197 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
15198 LDKChainParameters this_ptr_conv;
15199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15200 this_ptr_conv.is_owned = false;
15201 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
15205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
15206 LDKChainParameters this_ptr_conv;
15207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15208 this_ptr_conv.is_owned = false;
15209 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
15210 ChainParameters_set_network(&this_ptr_conv, val_conv);
15213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
15214 LDKChainParameters this_ptr_conv;
15215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15216 this_ptr_conv.is_owned = false;
15217 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15220 uint64_t ret_ref = (uint64_t)ret_var.inner;
15221 if (ret_var.is_owned) {
15227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15228 LDKChainParameters this_ptr_conv;
15229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15230 this_ptr_conv.is_owned = false;
15231 LDKBestBlock val_conv;
15232 val_conv.inner = (void*)(val & (~1));
15233 val_conv.is_owned = (val & 1) || (val == 0);
15234 val_conv = BestBlock_clone(&val_conv);
15235 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
15239 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
15240 LDKBestBlock best_block_arg_conv;
15241 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15242 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15243 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15244 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15247 uint64_t ret_ref = (uint64_t)ret_var.inner;
15248 if (ret_var.is_owned) {
15254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15255 LDKChainParameters orig_conv;
15256 orig_conv.inner = (void*)(orig & (~1));
15257 orig_conv.is_owned = false;
15258 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15261 uint64_t ret_ref = (uint64_t)ret_var.inner;
15262 if (ret_var.is_owned) {
15268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15269 LDKBestBlock this_obj_conv;
15270 this_obj_conv.inner = (void*)(this_obj & (~1));
15271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15272 BestBlock_free(this_obj_conv);
15275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15276 LDKBestBlock orig_conv;
15277 orig_conv.inner = (void*)(orig & (~1));
15278 orig_conv.is_owned = false;
15279 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15280 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15281 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15282 uint64_t ret_ref = (uint64_t)ret_var.inner;
15283 if (ret_var.is_owned) {
15289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15290 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15291 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15294 uint64_t ret_ref = (uint64_t)ret_var.inner;
15295 if (ret_var.is_owned) {
15301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15302 LDKThirtyTwoBytes block_hash_ref;
15303 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15304 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15305 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15308 uint64_t ret_ref = (uint64_t)ret_var.inner;
15309 if (ret_var.is_owned) {
15315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15316 LDKBestBlock this_arg_conv;
15317 this_arg_conv.inner = (void*)(this_arg & (~1));
15318 this_arg_conv.is_owned = false;
15319 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15320 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15324 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15325 LDKBestBlock this_arg_conv;
15326 this_arg_conv.inner = (void*)(this_arg & (~1));
15327 this_arg_conv.is_owned = false;
15328 int32_t ret_val = BestBlock_height(&this_arg_conv);
15332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15333 LDKChannelDetails this_obj_conv;
15334 this_obj_conv.inner = (void*)(this_obj & (~1));
15335 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15336 ChannelDetails_free(this_obj_conv);
15339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15340 LDKChannelDetails this_ptr_conv;
15341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15342 this_ptr_conv.is_owned = false;
15343 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15344 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
15348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15349 LDKChannelDetails this_ptr_conv;
15350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15351 this_ptr_conv.is_owned = false;
15352 LDKThirtyTwoBytes val_ref;
15353 CHECK((*env)->GetArrayLength(env, val) == 32);
15354 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15355 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
15359 LDKChannelDetails this_ptr_conv;
15360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15361 this_ptr_conv.is_owned = false;
15362 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15365 uint64_t ret_ref = (uint64_t)ret_var.inner;
15366 if (ret_var.is_owned) {
15372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15373 LDKChannelDetails this_ptr_conv;
15374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15375 this_ptr_conv.is_owned = false;
15376 LDKOutPoint val_conv;
15377 val_conv.inner = (void*)(val & (~1));
15378 val_conv.is_owned = (val & 1) || (val == 0);
15379 val_conv = OutPoint_clone(&val_conv);
15380 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15384 LDKChannelDetails this_ptr_conv;
15385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15386 this_ptr_conv.is_owned = false;
15387 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15388 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15389 uint64_t ret_ref = (uint64_t)ret_copy;
15393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15394 LDKChannelDetails this_ptr_conv;
15395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15396 this_ptr_conv.is_owned = false;
15397 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15398 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15402 LDKChannelDetails this_ptr_conv;
15403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15404 this_ptr_conv.is_owned = false;
15405 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15406 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
15410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15411 LDKChannelDetails this_ptr_conv;
15412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15413 this_ptr_conv.is_owned = false;
15414 LDKPublicKey val_ref;
15415 CHECK((*env)->GetArrayLength(env, val) == 33);
15416 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15417 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
15420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15421 LDKChannelDetails this_ptr_conv;
15422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15423 this_ptr_conv.is_owned = false;
15424 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
15425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15427 uint64_t ret_ref = (uint64_t)ret_var.inner;
15428 if (ret_var.is_owned) {
15434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15435 LDKChannelDetails this_ptr_conv;
15436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15437 this_ptr_conv.is_owned = false;
15438 LDKInitFeatures val_conv;
15439 val_conv.inner = (void*)(val & (~1));
15440 val_conv.is_owned = (val & 1) || (val == 0);
15441 val_conv = InitFeatures_clone(&val_conv);
15442 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
15445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15446 LDKChannelDetails this_ptr_conv;
15447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15448 this_ptr_conv.is_owned = false;
15449 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15454 LDKChannelDetails this_ptr_conv;
15455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15456 this_ptr_conv.is_owned = false;
15457 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15461 LDKChannelDetails this_ptr_conv;
15462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15463 this_ptr_conv.is_owned = false;
15464 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15469 LDKChannelDetails this_ptr_conv;
15470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15471 this_ptr_conv.is_owned = false;
15472 ChannelDetails_set_user_id(&this_ptr_conv, val);
15475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15476 LDKChannelDetails this_ptr_conv;
15477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15478 this_ptr_conv.is_owned = false;
15479 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15484 LDKChannelDetails this_ptr_conv;
15485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15486 this_ptr_conv.is_owned = false;
15487 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15491 LDKChannelDetails this_ptr_conv;
15492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15493 this_ptr_conv.is_owned = false;
15494 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15499 LDKChannelDetails this_ptr_conv;
15500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15501 this_ptr_conv.is_owned = false;
15502 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
15506 LDKChannelDetails this_ptr_conv;
15507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15508 this_ptr_conv.is_owned = false;
15509 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15514 LDKChannelDetails this_ptr_conv;
15515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15516 this_ptr_conv.is_owned = false;
15517 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
15521 LDKChannelDetails this_ptr_conv;
15522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15523 this_ptr_conv.is_owned = false;
15524 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15529 LDKChannelDetails this_ptr_conv;
15530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15531 this_ptr_conv.is_owned = false;
15532 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
15536 LDKChannelDetails this_ptr_conv;
15537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15538 this_ptr_conv.is_owned = false;
15539 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15544 LDKChannelDetails this_ptr_conv;
15545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15546 this_ptr_conv.is_owned = false;
15547 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
15551 LDKChannelDetails this_ptr_conv;
15552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15553 this_ptr_conv.is_owned = false;
15554 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15559 LDKChannelDetails this_ptr_conv;
15560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15561 this_ptr_conv.is_owned = false;
15562 ChannelDetails_set_is_public(&this_ptr_conv, val);
15565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15566 LDKChannelDetails orig_conv;
15567 orig_conv.inner = (void*)(orig & (~1));
15568 orig_conv.is_owned = false;
15569 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15572 uint64_t ret_ref = (uint64_t)ret_var.inner;
15573 if (ret_var.is_owned) {
15579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15580 if ((this_ptr & 1) != 0) return;
15581 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15582 FREE((void*)this_ptr);
15583 PaymentSendFailure_free(this_ptr_conv);
15586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15587 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15588 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15589 *ret_copy = PaymentSendFailure_clone(orig_conv);
15590 uint64_t ret_ref = (uint64_t)ret_copy;
15594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) {
15595 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15596 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
15597 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15598 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
15600 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15601 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
15602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15603 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
15605 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15606 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15608 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
15610 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15611 if (logger_conv.free == LDKLogger_JCalls_free) {
15612 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15613 LDKLogger_JCalls_clone(logger_conv.this_arg);
15615 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15616 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
15617 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15618 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
15620 LDKUserConfig config_conv;
15621 config_conv.inner = (void*)(config & (~1));
15622 config_conv.is_owned = (config & 1) || (config == 0);
15623 config_conv = UserConfig_clone(&config_conv);
15624 LDKChainParameters params_conv;
15625 params_conv.inner = (void*)(params & (~1));
15626 params_conv.is_owned = (params & 1) || (params == 0);
15627 params_conv = ChainParameters_clone(¶ms_conv);
15628 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15631 uint64_t ret_ref = (uint64_t)ret_var.inner;
15632 if (ret_var.is_owned) {
15638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
15639 LDKChannelManager this_arg_conv;
15640 this_arg_conv.inner = (void*)(this_arg & (~1));
15641 this_arg_conv.is_owned = false;
15642 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15643 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15644 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15645 uint64_t ret_ref = (uint64_t)ret_var.inner;
15646 if (ret_var.is_owned) {
15652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, int64_t override_config) {
15653 LDKChannelManager this_arg_conv;
15654 this_arg_conv.inner = (void*)(this_arg & (~1));
15655 this_arg_conv.is_owned = false;
15656 LDKPublicKey their_network_key_ref;
15657 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
15658 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
15659 LDKUserConfig override_config_conv;
15660 override_config_conv.inner = (void*)(override_config & (~1));
15661 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15662 override_config_conv = UserConfig_clone(&override_config_conv);
15663 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15664 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15665 return (uint64_t)ret_conv;
15668 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15669 LDKChannelManager this_arg_conv;
15670 this_arg_conv.inner = (void*)(this_arg & (~1));
15671 this_arg_conv.is_owned = false;
15672 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15673 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15674 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15675 for (size_t q = 0; q < ret_var.datalen; q++) {
15676 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15677 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15678 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15679 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15680 if (ret_conv_16_var.is_owned) {
15681 ret_conv_16_ref |= 1;
15683 ret_arr_ptr[q] = ret_conv_16_ref;
15685 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15686 FREE(ret_var.data);
15690 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15691 LDKChannelManager this_arg_conv;
15692 this_arg_conv.inner = (void*)(this_arg & (~1));
15693 this_arg_conv.is_owned = false;
15694 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15695 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15696 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15697 for (size_t q = 0; q < ret_var.datalen; q++) {
15698 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15699 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15700 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15701 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15702 if (ret_conv_16_var.is_owned) {
15703 ret_conv_16_ref |= 1;
15705 ret_arr_ptr[q] = ret_conv_16_ref;
15707 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15708 FREE(ret_var.data);
15712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
15713 LDKChannelManager this_arg_conv;
15714 this_arg_conv.inner = (void*)(this_arg & (~1));
15715 this_arg_conv.is_owned = false;
15716 unsigned char channel_id_arr[32];
15717 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15718 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15719 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15720 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15721 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
15722 return (uint64_t)ret_conv;
15725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
15726 LDKChannelManager this_arg_conv;
15727 this_arg_conv.inner = (void*)(this_arg & (~1));
15728 this_arg_conv.is_owned = false;
15729 unsigned char channel_id_arr[32];
15730 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15731 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15732 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15733 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15734 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
15735 return (uint64_t)ret_conv;
15738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15739 LDKChannelManager this_arg_conv;
15740 this_arg_conv.inner = (void*)(this_arg & (~1));
15741 this_arg_conv.is_owned = false;
15742 ChannelManager_force_close_all_channels(&this_arg_conv);
15745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
15746 LDKChannelManager this_arg_conv;
15747 this_arg_conv.inner = (void*)(this_arg & (~1));
15748 this_arg_conv.is_owned = false;
15749 LDKRoute route_conv;
15750 route_conv.inner = (void*)(route & (~1));
15751 route_conv.is_owned = false;
15752 LDKThirtyTwoBytes payment_hash_ref;
15753 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15754 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15755 LDKThirtyTwoBytes payment_secret_ref;
15756 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
15757 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
15758 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15759 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
15760 return (uint64_t)ret_conv;
15763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
15764 LDKChannelManager this_arg_conv;
15765 this_arg_conv.inner = (void*)(this_arg & (~1));
15766 this_arg_conv.is_owned = false;
15767 unsigned char temporary_channel_id_arr[32];
15768 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
15769 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
15770 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
15771 LDKTransaction funding_transaction_ref;
15772 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
15773 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
15774 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
15775 funding_transaction_ref.data_is_owned = true;
15776 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15777 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
15778 return (uint64_t)ret_conv;
15781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
15782 LDKChannelManager this_arg_conv;
15783 this_arg_conv.inner = (void*)(this_arg & (~1));
15784 this_arg_conv.is_owned = false;
15785 LDKThreeBytes rgb_ref;
15786 CHECK((*env)->GetArrayLength(env, rgb) == 3);
15787 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
15788 LDKThirtyTwoBytes alias_ref;
15789 CHECK((*env)->GetArrayLength(env, alias) == 32);
15790 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
15791 LDKCVec_NetAddressZ addresses_constr;
15792 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
15793 if (addresses_constr.datalen > 0)
15794 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15796 addresses_constr.data = NULL;
15797 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
15798 for (size_t m = 0; m < addresses_constr.datalen; m++) {
15799 int64_t addresses_conv_12 = addresses_vals[m];
15800 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
15801 addresses_constr.data[m] = addresses_conv_12_conv;
15803 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
15804 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
15807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
15808 LDKChannelManager this_arg_conv;
15809 this_arg_conv.inner = (void*)(this_arg & (~1));
15810 this_arg_conv.is_owned = false;
15811 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
15814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
15815 LDKChannelManager this_arg_conv;
15816 this_arg_conv.inner = (void*)(this_arg & (~1));
15817 this_arg_conv.is_owned = false;
15818 ChannelManager_timer_tick_occurred(&this_arg_conv);
15821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
15822 LDKChannelManager this_arg_conv;
15823 this_arg_conv.inner = (void*)(this_arg & (~1));
15824 this_arg_conv.is_owned = false;
15825 unsigned char payment_hash_arr[32];
15826 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15827 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
15828 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
15829 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
15833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
15834 LDKChannelManager this_arg_conv;
15835 this_arg_conv.inner = (void*)(this_arg & (~1));
15836 this_arg_conv.is_owned = false;
15837 LDKThirtyTwoBytes payment_preimage_ref;
15838 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15839 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15840 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
15844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15845 LDKChannelManager this_arg_conv;
15846 this_arg_conv.inner = (void*)(this_arg & (~1));
15847 this_arg_conv.is_owned = false;
15848 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15849 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
15853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) {
15854 LDKChannelManager this_arg_conv;
15855 this_arg_conv.inner = (void*)(this_arg & (~1));
15856 this_arg_conv.is_owned = false;
15857 LDKOutPoint funding_txo_conv;
15858 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15859 funding_txo_conv.is_owned = false;
15860 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
15863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
15864 LDKChannelManager this_arg_conv;
15865 this_arg_conv.inner = (void*)(this_arg & (~1));
15866 this_arg_conv.is_owned = false;
15867 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15868 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15869 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15870 return (uint64_t)ret_ref;
15873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
15874 LDKChannelManager this_arg_conv;
15875 this_arg_conv.inner = (void*)(this_arg & (~1));
15876 this_arg_conv.is_owned = false;
15877 LDKThirtyTwoBytes payment_hash_ref;
15878 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15879 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15880 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15881 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15882 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15883 return (uint64_t)ret_conv;
15886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15887 LDKChannelManager this_arg_conv;
15888 this_arg_conv.inner = (void*)(this_arg & (~1));
15889 this_arg_conv.is_owned = false;
15890 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15891 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
15892 return (uint64_t)ret;
15895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15896 LDKChannelManager this_arg_conv;
15897 this_arg_conv.inner = (void*)(this_arg & (~1));
15898 this_arg_conv.is_owned = false;
15899 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15900 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
15901 return (uint64_t)ret;
15904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
15905 LDKChannelManager this_arg_conv;
15906 this_arg_conv.inner = (void*)(this_arg & (~1));
15907 this_arg_conv.is_owned = false;
15908 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
15909 *ret = ChannelManager_as_Listen(&this_arg_conv);
15910 return (uint64_t)ret;
15913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
15914 LDKChannelManager this_arg_conv;
15915 this_arg_conv.inner = (void*)(this_arg & (~1));
15916 this_arg_conv.is_owned = false;
15917 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15918 *ret = ChannelManager_as_Confirm(&this_arg_conv);
15919 return (uint64_t)ret;
15922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
15923 LDKChannelManager this_arg_conv;
15924 this_arg_conv.inner = (void*)(this_arg & (~1));
15925 this_arg_conv.is_owned = false;
15926 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
15930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
15931 LDKChannelManager this_arg_conv;
15932 this_arg_conv.inner = (void*)(this_arg & (~1));
15933 this_arg_conv.is_owned = false;
15934 ChannelManager_await_persistable_update(&this_arg_conv);
15937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
15938 LDKChannelManager this_arg_conv;
15939 this_arg_conv.inner = (void*)(this_arg & (~1));
15940 this_arg_conv.is_owned = false;
15941 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15942 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
15943 return (uint64_t)ret;
15946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
15947 LDKChannelManager obj_conv;
15948 obj_conv.inner = (void*)(obj & (~1));
15949 obj_conv.is_owned = false;
15950 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
15951 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15952 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15953 CVec_u8Z_free(ret_var);
15957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15958 LDKChannelManagerReadArgs this_obj_conv;
15959 this_obj_conv.inner = (void*)(this_obj & (~1));
15960 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15961 ChannelManagerReadArgs_free(this_obj_conv);
15964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
15965 LDKChannelManagerReadArgs this_ptr_conv;
15966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15967 this_ptr_conv.is_owned = false;
15968 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
15972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15973 LDKChannelManagerReadArgs this_ptr_conv;
15974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15975 this_ptr_conv.is_owned = false;
15976 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
15977 if (val_conv.free == LDKKeysInterface_JCalls_free) {
15978 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15979 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
15981 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
15984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
15985 LDKChannelManagerReadArgs this_ptr_conv;
15986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15987 this_ptr_conv.is_owned = false;
15988 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
15992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15993 LDKChannelManagerReadArgs this_ptr_conv;
15994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15995 this_ptr_conv.is_owned = false;
15996 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
15997 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
15998 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15999 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
16001 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
16005 LDKChannelManagerReadArgs this_ptr_conv;
16006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16007 this_ptr_conv.is_owned = false;
16008 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16013 LDKChannelManagerReadArgs this_ptr_conv;
16014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16015 this_ptr_conv.is_owned = false;
16016 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16017 if (val_conv.free == LDKWatch_JCalls_free) {
16018 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16019 LDKWatch_JCalls_clone(val_conv.this_arg);
16021 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
16025 LDKChannelManagerReadArgs this_ptr_conv;
16026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16027 this_ptr_conv.is_owned = false;
16028 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16033 LDKChannelManagerReadArgs this_ptr_conv;
16034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16035 this_ptr_conv.is_owned = false;
16036 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16037 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
16038 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16039 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
16041 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
16045 LDKChannelManagerReadArgs this_ptr_conv;
16046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16047 this_ptr_conv.is_owned = false;
16048 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16053 LDKChannelManagerReadArgs this_ptr_conv;
16054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16055 this_ptr_conv.is_owned = false;
16056 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16057 if (val_conv.free == LDKLogger_JCalls_free) {
16058 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16059 LDKLogger_JCalls_clone(val_conv.this_arg);
16061 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16065 LDKChannelManagerReadArgs this_ptr_conv;
16066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16067 this_ptr_conv.is_owned = false;
16068 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16071 uint64_t ret_ref = (uint64_t)ret_var.inner;
16072 if (ret_var.is_owned) {
16078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16079 LDKChannelManagerReadArgs this_ptr_conv;
16080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16081 this_ptr_conv.is_owned = false;
16082 LDKUserConfig val_conv;
16083 val_conv.inner = (void*)(val & (~1));
16084 val_conv.is_owned = (val & 1) || (val == 0);
16085 val_conv = UserConfig_clone(&val_conv);
16086 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
16090 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16091 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16092 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16093 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
16095 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16096 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16097 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16098 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
16100 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16101 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16102 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16103 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
16105 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16106 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16107 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16108 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
16110 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16111 if (logger_conv.free == LDKLogger_JCalls_free) {
16112 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16113 LDKLogger_JCalls_clone(logger_conv.this_arg);
16115 LDKUserConfig default_config_conv;
16116 default_config_conv.inner = (void*)(default_config & (~1));
16117 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16118 default_config_conv = UserConfig_clone(&default_config_conv);
16119 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16120 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
16121 if (channel_monitors_constr.datalen > 0)
16122 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16124 channel_monitors_constr.data = NULL;
16125 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
16126 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16127 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
16128 LDKChannelMonitor channel_monitors_conv_16_conv;
16129 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16130 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16131 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16133 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
16134 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);
16135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16137 uint64_t ret_ref = (uint64_t)ret_var.inner;
16138 if (ret_var.is_owned) {
16144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16145 LDKu8slice ser_ref;
16146 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16147 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16148 LDKChannelManagerReadArgs arg_conv;
16149 arg_conv.inner = (void*)(arg & (~1));
16150 arg_conv.is_owned = (arg & 1) || (arg == 0);
16151 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16152 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16153 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16154 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16155 return (uint64_t)ret_conv;
16158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16159 LDKDecodeError this_obj_conv;
16160 this_obj_conv.inner = (void*)(this_obj & (~1));
16161 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16162 DecodeError_free(this_obj_conv);
16165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16166 LDKDecodeError orig_conv;
16167 orig_conv.inner = (void*)(orig & (~1));
16168 orig_conv.is_owned = false;
16169 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16172 uint64_t ret_ref = (uint64_t)ret_var.inner;
16173 if (ret_var.is_owned) {
16179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16180 LDKInit this_obj_conv;
16181 this_obj_conv.inner = (void*)(this_obj & (~1));
16182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16183 Init_free(this_obj_conv);
16186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16187 LDKInit this_ptr_conv;
16188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16189 this_ptr_conv.is_owned = false;
16190 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16191 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16192 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16193 uint64_t ret_ref = (uint64_t)ret_var.inner;
16194 if (ret_var.is_owned) {
16200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16201 LDKInit this_ptr_conv;
16202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16203 this_ptr_conv.is_owned = false;
16204 LDKInitFeatures val_conv;
16205 val_conv.inner = (void*)(val & (~1));
16206 val_conv.is_owned = (val & 1) || (val == 0);
16207 val_conv = InitFeatures_clone(&val_conv);
16208 Init_set_features(&this_ptr_conv, val_conv);
16211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
16212 LDKInitFeatures features_arg_conv;
16213 features_arg_conv.inner = (void*)(features_arg & (~1));
16214 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16215 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16216 LDKInit ret_var = Init_new(features_arg_conv);
16217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16219 uint64_t ret_ref = (uint64_t)ret_var.inner;
16220 if (ret_var.is_owned) {
16226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16228 orig_conv.inner = (void*)(orig & (~1));
16229 orig_conv.is_owned = false;
16230 LDKInit ret_var = Init_clone(&orig_conv);
16231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16233 uint64_t ret_ref = (uint64_t)ret_var.inner;
16234 if (ret_var.is_owned) {
16240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16241 LDKErrorMessage this_obj_conv;
16242 this_obj_conv.inner = (void*)(this_obj & (~1));
16243 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16244 ErrorMessage_free(this_obj_conv);
16247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16248 LDKErrorMessage this_ptr_conv;
16249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16250 this_ptr_conv.is_owned = false;
16251 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16252 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
16256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16257 LDKErrorMessage this_ptr_conv;
16258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16259 this_ptr_conv.is_owned = false;
16260 LDKThirtyTwoBytes val_ref;
16261 CHECK((*env)->GetArrayLength(env, val) == 32);
16262 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16263 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16266 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
16267 LDKErrorMessage this_ptr_conv;
16268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16269 this_ptr_conv.is_owned = false;
16270 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16271 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
16276 LDKErrorMessage this_ptr_conv;
16277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16278 this_ptr_conv.is_owned = false;
16279 LDKStr val_conv = java_to_owned_str(env, val);
16280 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
16284 LDKThirtyTwoBytes channel_id_arg_ref;
16285 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16286 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16287 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
16288 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16289 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16290 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16291 uint64_t ret_ref = (uint64_t)ret_var.inner;
16292 if (ret_var.is_owned) {
16298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16299 LDKErrorMessage orig_conv;
16300 orig_conv.inner = (void*)(orig & (~1));
16301 orig_conv.is_owned = false;
16302 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16305 uint64_t ret_ref = (uint64_t)ret_var.inner;
16306 if (ret_var.is_owned) {
16312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16313 LDKPing this_obj_conv;
16314 this_obj_conv.inner = (void*)(this_obj & (~1));
16315 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16316 Ping_free(this_obj_conv);
16319 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16320 LDKPing this_ptr_conv;
16321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16322 this_ptr_conv.is_owned = false;
16323 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16328 LDKPing this_ptr_conv;
16329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16330 this_ptr_conv.is_owned = false;
16331 Ping_set_ponglen(&this_ptr_conv, val);
16334 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16335 LDKPing this_ptr_conv;
16336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16337 this_ptr_conv.is_owned = false;
16338 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16343 LDKPing this_ptr_conv;
16344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16345 this_ptr_conv.is_owned = false;
16346 Ping_set_byteslen(&this_ptr_conv, val);
16349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
16350 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16351 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16352 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16353 uint64_t ret_ref = (uint64_t)ret_var.inner;
16354 if (ret_var.is_owned) {
16360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16362 orig_conv.inner = (void*)(orig & (~1));
16363 orig_conv.is_owned = false;
16364 LDKPing ret_var = Ping_clone(&orig_conv);
16365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16367 uint64_t ret_ref = (uint64_t)ret_var.inner;
16368 if (ret_var.is_owned) {
16374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16375 LDKPong this_obj_conv;
16376 this_obj_conv.inner = (void*)(this_obj & (~1));
16377 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16378 Pong_free(this_obj_conv);
16381 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16382 LDKPong this_ptr_conv;
16383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16384 this_ptr_conv.is_owned = false;
16385 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16390 LDKPong this_ptr_conv;
16391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16392 this_ptr_conv.is_owned = false;
16393 Pong_set_byteslen(&this_ptr_conv, val);
16396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
16397 LDKPong ret_var = Pong_new(byteslen_arg);
16398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16400 uint64_t ret_ref = (uint64_t)ret_var.inner;
16401 if (ret_var.is_owned) {
16407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16409 orig_conv.inner = (void*)(orig & (~1));
16410 orig_conv.is_owned = false;
16411 LDKPong ret_var = Pong_clone(&orig_conv);
16412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16413 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16414 uint64_t ret_ref = (uint64_t)ret_var.inner;
16415 if (ret_var.is_owned) {
16421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16422 LDKOpenChannel this_obj_conv;
16423 this_obj_conv.inner = (void*)(this_obj & (~1));
16424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16425 OpenChannel_free(this_obj_conv);
16428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16429 LDKOpenChannel this_ptr_conv;
16430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16431 this_ptr_conv.is_owned = false;
16432 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16433 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
16437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16438 LDKOpenChannel this_ptr_conv;
16439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16440 this_ptr_conv.is_owned = false;
16441 LDKThirtyTwoBytes val_ref;
16442 CHECK((*env)->GetArrayLength(env, val) == 32);
16443 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16444 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16448 LDKOpenChannel this_ptr_conv;
16449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16450 this_ptr_conv.is_owned = false;
16451 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16452 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
16456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16457 LDKOpenChannel this_ptr_conv;
16458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16459 this_ptr_conv.is_owned = false;
16460 LDKThirtyTwoBytes val_ref;
16461 CHECK((*env)->GetArrayLength(env, val) == 32);
16462 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16463 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16467 LDKOpenChannel this_ptr_conv;
16468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16469 this_ptr_conv.is_owned = false;
16470 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16475 LDKOpenChannel this_ptr_conv;
16476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16477 this_ptr_conv.is_owned = false;
16478 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16482 LDKOpenChannel this_ptr_conv;
16483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16484 this_ptr_conv.is_owned = false;
16485 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16490 LDKOpenChannel this_ptr_conv;
16491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16492 this_ptr_conv.is_owned = false;
16493 OpenChannel_set_push_msat(&this_ptr_conv, val);
16496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16497 LDKOpenChannel this_ptr_conv;
16498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16499 this_ptr_conv.is_owned = false;
16500 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16505 LDKOpenChannel this_ptr_conv;
16506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16507 this_ptr_conv.is_owned = false;
16508 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16512 LDKOpenChannel this_ptr_conv;
16513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16514 this_ptr_conv.is_owned = false;
16515 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16520 LDKOpenChannel this_ptr_conv;
16521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16522 this_ptr_conv.is_owned = false;
16523 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16527 LDKOpenChannel this_ptr_conv;
16528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16529 this_ptr_conv.is_owned = false;
16530 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16535 LDKOpenChannel this_ptr_conv;
16536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16537 this_ptr_conv.is_owned = false;
16538 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16542 LDKOpenChannel this_ptr_conv;
16543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16544 this_ptr_conv.is_owned = false;
16545 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16550 LDKOpenChannel this_ptr_conv;
16551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16552 this_ptr_conv.is_owned = false;
16553 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16556 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
16557 LDKOpenChannel this_ptr_conv;
16558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16559 this_ptr_conv.is_owned = false;
16560 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16565 LDKOpenChannel this_ptr_conv;
16566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16567 this_ptr_conv.is_owned = false;
16568 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16571 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16572 LDKOpenChannel this_ptr_conv;
16573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16574 this_ptr_conv.is_owned = false;
16575 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16580 LDKOpenChannel this_ptr_conv;
16581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16582 this_ptr_conv.is_owned = false;
16583 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16586 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16587 LDKOpenChannel this_ptr_conv;
16588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16589 this_ptr_conv.is_owned = false;
16590 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16595 LDKOpenChannel this_ptr_conv;
16596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16597 this_ptr_conv.is_owned = false;
16598 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16602 LDKOpenChannel this_ptr_conv;
16603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16604 this_ptr_conv.is_owned = false;
16605 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16606 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16611 LDKOpenChannel this_ptr_conv;
16612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16613 this_ptr_conv.is_owned = false;
16614 LDKPublicKey val_ref;
16615 CHECK((*env)->GetArrayLength(env, val) == 33);
16616 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16617 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16621 LDKOpenChannel this_ptr_conv;
16622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16623 this_ptr_conv.is_owned = false;
16624 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16625 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16630 LDKOpenChannel this_ptr_conv;
16631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16632 this_ptr_conv.is_owned = false;
16633 LDKPublicKey val_ref;
16634 CHECK((*env)->GetArrayLength(env, val) == 33);
16635 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16636 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16640 LDKOpenChannel this_ptr_conv;
16641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16642 this_ptr_conv.is_owned = false;
16643 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16644 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
16648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16649 LDKOpenChannel this_ptr_conv;
16650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16651 this_ptr_conv.is_owned = false;
16652 LDKPublicKey val_ref;
16653 CHECK((*env)->GetArrayLength(env, val) == 33);
16654 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16655 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16659 LDKOpenChannel this_ptr_conv;
16660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16661 this_ptr_conv.is_owned = false;
16662 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16663 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16668 LDKOpenChannel this_ptr_conv;
16669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16670 this_ptr_conv.is_owned = false;
16671 LDKPublicKey val_ref;
16672 CHECK((*env)->GetArrayLength(env, val) == 33);
16673 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16674 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16677 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16678 LDKOpenChannel this_ptr_conv;
16679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16680 this_ptr_conv.is_owned = false;
16681 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16682 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16687 LDKOpenChannel this_ptr_conv;
16688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16689 this_ptr_conv.is_owned = false;
16690 LDKPublicKey val_ref;
16691 CHECK((*env)->GetArrayLength(env, val) == 33);
16692 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16693 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16697 LDKOpenChannel this_ptr_conv;
16698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16699 this_ptr_conv.is_owned = false;
16700 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16701 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16706 LDKOpenChannel this_ptr_conv;
16707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16708 this_ptr_conv.is_owned = false;
16709 LDKPublicKey val_ref;
16710 CHECK((*env)->GetArrayLength(env, val) == 33);
16711 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16712 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16715 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
16716 LDKOpenChannel this_ptr_conv;
16717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16718 this_ptr_conv.is_owned = false;
16719 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
16723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
16724 LDKOpenChannel this_ptr_conv;
16725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16726 this_ptr_conv.is_owned = false;
16727 OpenChannel_set_channel_flags(&this_ptr_conv, val);
16730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16731 LDKOpenChannel orig_conv;
16732 orig_conv.inner = (void*)(orig & (~1));
16733 orig_conv.is_owned = false;
16734 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
16735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16737 uint64_t ret_ref = (uint64_t)ret_var.inner;
16738 if (ret_var.is_owned) {
16744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16745 LDKAcceptChannel this_obj_conv;
16746 this_obj_conv.inner = (void*)(this_obj & (~1));
16747 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16748 AcceptChannel_free(this_obj_conv);
16751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16752 LDKAcceptChannel this_ptr_conv;
16753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16754 this_ptr_conv.is_owned = false;
16755 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
16760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16761 LDKAcceptChannel this_ptr_conv;
16762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16763 this_ptr_conv.is_owned = false;
16764 LDKThirtyTwoBytes val_ref;
16765 CHECK((*env)->GetArrayLength(env, val) == 32);
16766 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16767 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16771 LDKAcceptChannel this_ptr_conv;
16772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16773 this_ptr_conv.is_owned = false;
16774 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
16778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16779 LDKAcceptChannel this_ptr_conv;
16780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16781 this_ptr_conv.is_owned = false;
16782 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16786 LDKAcceptChannel this_ptr_conv;
16787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16788 this_ptr_conv.is_owned = false;
16789 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16794 LDKAcceptChannel this_ptr_conv;
16795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16796 this_ptr_conv.is_owned = false;
16797 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16801 LDKAcceptChannel this_ptr_conv;
16802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16803 this_ptr_conv.is_owned = false;
16804 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16809 LDKAcceptChannel this_ptr_conv;
16810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16811 this_ptr_conv.is_owned = false;
16812 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16816 LDKAcceptChannel this_ptr_conv;
16817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16818 this_ptr_conv.is_owned = false;
16819 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
16823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16824 LDKAcceptChannel this_ptr_conv;
16825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16826 this_ptr_conv.is_owned = false;
16827 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16830 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16831 LDKAcceptChannel this_ptr_conv;
16832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16833 this_ptr_conv.is_owned = false;
16834 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
16838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16839 LDKAcceptChannel this_ptr_conv;
16840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16841 this_ptr_conv.is_owned = false;
16842 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
16845 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16846 LDKAcceptChannel this_ptr_conv;
16847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16848 this_ptr_conv.is_owned = false;
16849 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
16853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16854 LDKAcceptChannel this_ptr_conv;
16855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16856 this_ptr_conv.is_owned = false;
16857 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
16860 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16861 LDKAcceptChannel this_ptr_conv;
16862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16863 this_ptr_conv.is_owned = false;
16864 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
16868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16869 LDKAcceptChannel this_ptr_conv;
16870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16871 this_ptr_conv.is_owned = false;
16872 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16876 LDKAcceptChannel this_ptr_conv;
16877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16878 this_ptr_conv.is_owned = false;
16879 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16880 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16885 LDKAcceptChannel this_ptr_conv;
16886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16887 this_ptr_conv.is_owned = false;
16888 LDKPublicKey val_ref;
16889 CHECK((*env)->GetArrayLength(env, val) == 33);
16890 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16891 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16895 LDKAcceptChannel this_ptr_conv;
16896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16897 this_ptr_conv.is_owned = false;
16898 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16899 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16904 LDKAcceptChannel this_ptr_conv;
16905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16906 this_ptr_conv.is_owned = false;
16907 LDKPublicKey val_ref;
16908 CHECK((*env)->GetArrayLength(env, val) == 33);
16909 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16910 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16914 LDKAcceptChannel this_ptr_conv;
16915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16916 this_ptr_conv.is_owned = false;
16917 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16918 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
16922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16923 LDKAcceptChannel this_ptr_conv;
16924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16925 this_ptr_conv.is_owned = false;
16926 LDKPublicKey val_ref;
16927 CHECK((*env)->GetArrayLength(env, val) == 33);
16928 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16929 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
16932 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16933 LDKAcceptChannel this_ptr_conv;
16934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16935 this_ptr_conv.is_owned = false;
16936 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16937 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16942 LDKAcceptChannel this_ptr_conv;
16943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16944 this_ptr_conv.is_owned = false;
16945 LDKPublicKey val_ref;
16946 CHECK((*env)->GetArrayLength(env, val) == 33);
16947 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16948 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16952 LDKAcceptChannel this_ptr_conv;
16953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16954 this_ptr_conv.is_owned = false;
16955 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16956 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16961 LDKAcceptChannel this_ptr_conv;
16962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16963 this_ptr_conv.is_owned = false;
16964 LDKPublicKey val_ref;
16965 CHECK((*env)->GetArrayLength(env, val) == 33);
16966 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16967 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16971 LDKAcceptChannel this_ptr_conv;
16972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16973 this_ptr_conv.is_owned = false;
16974 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16975 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16980 LDKAcceptChannel this_ptr_conv;
16981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16982 this_ptr_conv.is_owned = false;
16983 LDKPublicKey val_ref;
16984 CHECK((*env)->GetArrayLength(env, val) == 33);
16985 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16986 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16990 LDKAcceptChannel orig_conv;
16991 orig_conv.inner = (void*)(orig & (~1));
16992 orig_conv.is_owned = false;
16993 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
16994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16996 uint64_t ret_ref = (uint64_t)ret_var.inner;
16997 if (ret_var.is_owned) {
17003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17004 LDKFundingCreated this_obj_conv;
17005 this_obj_conv.inner = (void*)(this_obj & (~1));
17006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17007 FundingCreated_free(this_obj_conv);
17010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17011 LDKFundingCreated this_ptr_conv;
17012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17013 this_ptr_conv.is_owned = false;
17014 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17015 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
17019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17020 LDKFundingCreated this_ptr_conv;
17021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17022 this_ptr_conv.is_owned = false;
17023 LDKThirtyTwoBytes val_ref;
17024 CHECK((*env)->GetArrayLength(env, val) == 32);
17025 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17026 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17030 LDKFundingCreated this_ptr_conv;
17031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17032 this_ptr_conv.is_owned = false;
17033 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17034 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
17038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17039 LDKFundingCreated this_ptr_conv;
17040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17041 this_ptr_conv.is_owned = false;
17042 LDKThirtyTwoBytes val_ref;
17043 CHECK((*env)->GetArrayLength(env, val) == 32);
17044 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17045 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17048 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17049 LDKFundingCreated this_ptr_conv;
17050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17051 this_ptr_conv.is_owned = false;
17052 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17057 LDKFundingCreated this_ptr_conv;
17058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17059 this_ptr_conv.is_owned = false;
17060 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17064 LDKFundingCreated this_ptr_conv;
17065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17066 this_ptr_conv.is_owned = false;
17067 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17068 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
17072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17073 LDKFundingCreated this_ptr_conv;
17074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17075 this_ptr_conv.is_owned = false;
17076 LDKSignature val_ref;
17077 CHECK((*env)->GetArrayLength(env, val) == 64);
17078 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17079 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
17083 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17084 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
17085 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
17086 LDKThirtyTwoBytes funding_txid_arg_ref;
17087 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
17088 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
17089 LDKSignature signature_arg_ref;
17090 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17091 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17092 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17093 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17094 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17095 uint64_t ret_ref = (uint64_t)ret_var.inner;
17096 if (ret_var.is_owned) {
17102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17103 LDKFundingCreated orig_conv;
17104 orig_conv.inner = (void*)(orig & (~1));
17105 orig_conv.is_owned = false;
17106 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17109 uint64_t ret_ref = (uint64_t)ret_var.inner;
17110 if (ret_var.is_owned) {
17116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17117 LDKFundingSigned this_obj_conv;
17118 this_obj_conv.inner = (void*)(this_obj & (~1));
17119 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17120 FundingSigned_free(this_obj_conv);
17123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17124 LDKFundingSigned this_ptr_conv;
17125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17126 this_ptr_conv.is_owned = false;
17127 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17128 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
17132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17133 LDKFundingSigned this_ptr_conv;
17134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17135 this_ptr_conv.is_owned = false;
17136 LDKThirtyTwoBytes val_ref;
17137 CHECK((*env)->GetArrayLength(env, val) == 32);
17138 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17139 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17143 LDKFundingSigned this_ptr_conv;
17144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17145 this_ptr_conv.is_owned = false;
17146 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17147 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
17151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17152 LDKFundingSigned this_ptr_conv;
17153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17154 this_ptr_conv.is_owned = false;
17155 LDKSignature val_ref;
17156 CHECK((*env)->GetArrayLength(env, val) == 64);
17157 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17158 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
17162 LDKThirtyTwoBytes channel_id_arg_ref;
17163 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17164 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17165 LDKSignature signature_arg_ref;
17166 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17167 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17168 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17169 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17170 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17171 uint64_t ret_ref = (uint64_t)ret_var.inner;
17172 if (ret_var.is_owned) {
17178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17179 LDKFundingSigned orig_conv;
17180 orig_conv.inner = (void*)(orig & (~1));
17181 orig_conv.is_owned = false;
17182 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17185 uint64_t ret_ref = (uint64_t)ret_var.inner;
17186 if (ret_var.is_owned) {
17192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17193 LDKFundingLocked this_obj_conv;
17194 this_obj_conv.inner = (void*)(this_obj & (~1));
17195 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17196 FundingLocked_free(this_obj_conv);
17199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17200 LDKFundingLocked this_ptr_conv;
17201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17202 this_ptr_conv.is_owned = false;
17203 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17204 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
17208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17209 LDKFundingLocked this_ptr_conv;
17210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17211 this_ptr_conv.is_owned = false;
17212 LDKThirtyTwoBytes val_ref;
17213 CHECK((*env)->GetArrayLength(env, val) == 32);
17214 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17215 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17219 LDKFundingLocked this_ptr_conv;
17220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17221 this_ptr_conv.is_owned = false;
17222 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17228 LDKFundingLocked this_ptr_conv;
17229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17230 this_ptr_conv.is_owned = false;
17231 LDKPublicKey val_ref;
17232 CHECK((*env)->GetArrayLength(env, val) == 33);
17233 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17234 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
17238 LDKThirtyTwoBytes channel_id_arg_ref;
17239 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17240 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17241 LDKPublicKey next_per_commitment_point_arg_ref;
17242 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17243 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17244 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17247 uint64_t ret_ref = (uint64_t)ret_var.inner;
17248 if (ret_var.is_owned) {
17254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17255 LDKFundingLocked orig_conv;
17256 orig_conv.inner = (void*)(orig & (~1));
17257 orig_conv.is_owned = false;
17258 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17261 uint64_t ret_ref = (uint64_t)ret_var.inner;
17262 if (ret_var.is_owned) {
17268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17269 LDKShutdown this_obj_conv;
17270 this_obj_conv.inner = (void*)(this_obj & (~1));
17271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17272 Shutdown_free(this_obj_conv);
17275 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17276 LDKShutdown this_ptr_conv;
17277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17278 this_ptr_conv.is_owned = false;
17279 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17280 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
17284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17285 LDKShutdown this_ptr_conv;
17286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17287 this_ptr_conv.is_owned = false;
17288 LDKThirtyTwoBytes val_ref;
17289 CHECK((*env)->GetArrayLength(env, val) == 32);
17290 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17291 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17295 LDKShutdown this_ptr_conv;
17296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17297 this_ptr_conv.is_owned = false;
17298 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17299 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17300 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17305 LDKShutdown this_ptr_conv;
17306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17307 this_ptr_conv.is_owned = false;
17308 LDKCVec_u8Z val_ref;
17309 val_ref.datalen = (*env)->GetArrayLength(env, val);
17310 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17311 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17312 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17316 LDKThirtyTwoBytes channel_id_arg_ref;
17317 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17318 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17319 LDKCVec_u8Z scriptpubkey_arg_ref;
17320 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
17321 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17322 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
17323 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17326 uint64_t ret_ref = (uint64_t)ret_var.inner;
17327 if (ret_var.is_owned) {
17333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17334 LDKShutdown orig_conv;
17335 orig_conv.inner = (void*)(orig & (~1));
17336 orig_conv.is_owned = false;
17337 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17340 uint64_t ret_ref = (uint64_t)ret_var.inner;
17341 if (ret_var.is_owned) {
17347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17348 LDKClosingSigned this_obj_conv;
17349 this_obj_conv.inner = (void*)(this_obj & (~1));
17350 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17351 ClosingSigned_free(this_obj_conv);
17354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17355 LDKClosingSigned this_ptr_conv;
17356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17357 this_ptr_conv.is_owned = false;
17358 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17359 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
17363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17364 LDKClosingSigned this_ptr_conv;
17365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17366 this_ptr_conv.is_owned = false;
17367 LDKThirtyTwoBytes val_ref;
17368 CHECK((*env)->GetArrayLength(env, val) == 32);
17369 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17370 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17374 LDKClosingSigned this_ptr_conv;
17375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17376 this_ptr_conv.is_owned = false;
17377 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17382 LDKClosingSigned this_ptr_conv;
17383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17384 this_ptr_conv.is_owned = false;
17385 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17389 LDKClosingSigned this_ptr_conv;
17390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17391 this_ptr_conv.is_owned = false;
17392 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17393 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
17397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17398 LDKClosingSigned this_ptr_conv;
17399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17400 this_ptr_conv.is_owned = false;
17401 LDKSignature val_ref;
17402 CHECK((*env)->GetArrayLength(env, val) == 64);
17403 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17404 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
17408 LDKThirtyTwoBytes channel_id_arg_ref;
17409 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17410 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17411 LDKSignature signature_arg_ref;
17412 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17413 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17414 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
17415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17417 uint64_t ret_ref = (uint64_t)ret_var.inner;
17418 if (ret_var.is_owned) {
17424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17425 LDKClosingSigned orig_conv;
17426 orig_conv.inner = (void*)(orig & (~1));
17427 orig_conv.is_owned = false;
17428 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17431 uint64_t ret_ref = (uint64_t)ret_var.inner;
17432 if (ret_var.is_owned) {
17438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17439 LDKUpdateAddHTLC this_obj_conv;
17440 this_obj_conv.inner = (void*)(this_obj & (~1));
17441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17442 UpdateAddHTLC_free(this_obj_conv);
17445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17446 LDKUpdateAddHTLC this_ptr_conv;
17447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17448 this_ptr_conv.is_owned = false;
17449 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17450 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
17454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17455 LDKUpdateAddHTLC this_ptr_conv;
17456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17457 this_ptr_conv.is_owned = false;
17458 LDKThirtyTwoBytes val_ref;
17459 CHECK((*env)->GetArrayLength(env, val) == 32);
17460 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17461 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17465 LDKUpdateAddHTLC this_ptr_conv;
17466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17467 this_ptr_conv.is_owned = false;
17468 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17473 LDKUpdateAddHTLC this_ptr_conv;
17474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17475 this_ptr_conv.is_owned = false;
17476 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17480 LDKUpdateAddHTLC this_ptr_conv;
17481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17482 this_ptr_conv.is_owned = false;
17483 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17488 LDKUpdateAddHTLC this_ptr_conv;
17489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17490 this_ptr_conv.is_owned = false;
17491 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17495 LDKUpdateAddHTLC this_ptr_conv;
17496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17497 this_ptr_conv.is_owned = false;
17498 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17499 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
17503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17504 LDKUpdateAddHTLC 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((*env)->GetArrayLength(env, val) == 32);
17509 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17510 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17513 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17514 LDKUpdateAddHTLC this_ptr_conv;
17515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17516 this_ptr_conv.is_owned = false;
17517 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17522 LDKUpdateAddHTLC this_ptr_conv;
17523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17524 this_ptr_conv.is_owned = false;
17525 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17529 LDKUpdateAddHTLC orig_conv;
17530 orig_conv.inner = (void*)(orig & (~1));
17531 orig_conv.is_owned = false;
17532 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17533 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17534 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17535 uint64_t ret_ref = (uint64_t)ret_var.inner;
17536 if (ret_var.is_owned) {
17542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17543 LDKUpdateFulfillHTLC this_obj_conv;
17544 this_obj_conv.inner = (void*)(this_obj & (~1));
17545 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17546 UpdateFulfillHTLC_free(this_obj_conv);
17549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17550 LDKUpdateFulfillHTLC this_ptr_conv;
17551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17552 this_ptr_conv.is_owned = false;
17553 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17554 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
17558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17559 LDKUpdateFulfillHTLC this_ptr_conv;
17560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17561 this_ptr_conv.is_owned = false;
17562 LDKThirtyTwoBytes val_ref;
17563 CHECK((*env)->GetArrayLength(env, val) == 32);
17564 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17565 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17569 LDKUpdateFulfillHTLC this_ptr_conv;
17570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17571 this_ptr_conv.is_owned = false;
17572 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17577 LDKUpdateFulfillHTLC this_ptr_conv;
17578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17579 this_ptr_conv.is_owned = false;
17580 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
17584 LDKUpdateFulfillHTLC this_ptr_conv;
17585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17586 this_ptr_conv.is_owned = false;
17587 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17588 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
17592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17593 LDKUpdateFulfillHTLC this_ptr_conv;
17594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17595 this_ptr_conv.is_owned = false;
17596 LDKThirtyTwoBytes val_ref;
17597 CHECK((*env)->GetArrayLength(env, val) == 32);
17598 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17599 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
17603 LDKThirtyTwoBytes channel_id_arg_ref;
17604 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17605 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17606 LDKThirtyTwoBytes payment_preimage_arg_ref;
17607 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
17608 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
17609 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17612 uint64_t ret_ref = (uint64_t)ret_var.inner;
17613 if (ret_var.is_owned) {
17619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17620 LDKUpdateFulfillHTLC orig_conv;
17621 orig_conv.inner = (void*)(orig & (~1));
17622 orig_conv.is_owned = false;
17623 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17626 uint64_t ret_ref = (uint64_t)ret_var.inner;
17627 if (ret_var.is_owned) {
17633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17634 LDKUpdateFailHTLC this_obj_conv;
17635 this_obj_conv.inner = (void*)(this_obj & (~1));
17636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17637 UpdateFailHTLC_free(this_obj_conv);
17640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17641 LDKUpdateFailHTLC this_ptr_conv;
17642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17643 this_ptr_conv.is_owned = false;
17644 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17645 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
17649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17650 LDKUpdateFailHTLC this_ptr_conv;
17651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17652 this_ptr_conv.is_owned = false;
17653 LDKThirtyTwoBytes val_ref;
17654 CHECK((*env)->GetArrayLength(env, val) == 32);
17655 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17656 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17660 LDKUpdateFailHTLC this_ptr_conv;
17661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17662 this_ptr_conv.is_owned = false;
17663 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17668 LDKUpdateFailHTLC this_ptr_conv;
17669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17670 this_ptr_conv.is_owned = false;
17671 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17675 LDKUpdateFailHTLC orig_conv;
17676 orig_conv.inner = (void*)(orig & (~1));
17677 orig_conv.is_owned = false;
17678 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17681 uint64_t ret_ref = (uint64_t)ret_var.inner;
17682 if (ret_var.is_owned) {
17688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17689 LDKUpdateFailMalformedHTLC this_obj_conv;
17690 this_obj_conv.inner = (void*)(this_obj & (~1));
17691 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17692 UpdateFailMalformedHTLC_free(this_obj_conv);
17695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17696 LDKUpdateFailMalformedHTLC this_ptr_conv;
17697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17698 this_ptr_conv.is_owned = false;
17699 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17700 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
17704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17705 LDKUpdateFailMalformedHTLC this_ptr_conv;
17706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17707 this_ptr_conv.is_owned = false;
17708 LDKThirtyTwoBytes val_ref;
17709 CHECK((*env)->GetArrayLength(env, val) == 32);
17710 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17711 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
17714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17715 LDKUpdateFailMalformedHTLC this_ptr_conv;
17716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17717 this_ptr_conv.is_owned = false;
17718 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
17722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17723 LDKUpdateFailMalformedHTLC this_ptr_conv;
17724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17725 this_ptr_conv.is_owned = false;
17726 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
17729 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
17730 LDKUpdateFailMalformedHTLC this_ptr_conv;
17731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17732 this_ptr_conv.is_owned = false;
17733 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
17737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17738 LDKUpdateFailMalformedHTLC this_ptr_conv;
17739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17740 this_ptr_conv.is_owned = false;
17741 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
17744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17745 LDKUpdateFailMalformedHTLC orig_conv;
17746 orig_conv.inner = (void*)(orig & (~1));
17747 orig_conv.is_owned = false;
17748 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
17749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17751 uint64_t ret_ref = (uint64_t)ret_var.inner;
17752 if (ret_var.is_owned) {
17758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17759 LDKCommitmentSigned this_obj_conv;
17760 this_obj_conv.inner = (void*)(this_obj & (~1));
17761 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17762 CommitmentSigned_free(this_obj_conv);
17765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17766 LDKCommitmentSigned this_ptr_conv;
17767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17768 this_ptr_conv.is_owned = false;
17769 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17770 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
17774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17775 LDKCommitmentSigned this_ptr_conv;
17776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17777 this_ptr_conv.is_owned = false;
17778 LDKThirtyTwoBytes val_ref;
17779 CHECK((*env)->GetArrayLength(env, val) == 32);
17780 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17781 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
17784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17785 LDKCommitmentSigned this_ptr_conv;
17786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17787 this_ptr_conv.is_owned = false;
17788 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17789 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
17793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17794 LDKCommitmentSigned this_ptr_conv;
17795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17796 this_ptr_conv.is_owned = false;
17797 LDKSignature val_ref;
17798 CHECK((*env)->GetArrayLength(env, val) == 64);
17799 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17800 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
17803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
17804 LDKCommitmentSigned this_ptr_conv;
17805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17806 this_ptr_conv.is_owned = false;
17807 LDKCVec_SignatureZ val_constr;
17808 val_constr.datalen = (*env)->GetArrayLength(env, val);
17809 if (val_constr.datalen > 0)
17810 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17812 val_constr.data = NULL;
17813 for (size_t i = 0; i < val_constr.datalen; i++) {
17814 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
17815 LDKSignature val_conv_8_ref;
17816 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
17817 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
17818 val_constr.data[i] = val_conv_8_ref;
17820 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
17823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
17824 LDKThirtyTwoBytes channel_id_arg_ref;
17825 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17826 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17827 LDKSignature signature_arg_ref;
17828 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17829 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17830 LDKCVec_SignatureZ htlc_signatures_arg_constr;
17831 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
17832 if (htlc_signatures_arg_constr.datalen > 0)
17833 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17835 htlc_signatures_arg_constr.data = NULL;
17836 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
17837 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
17838 LDKSignature htlc_signatures_arg_conv_8_ref;
17839 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
17840 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
17841 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
17843 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
17844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17846 uint64_t ret_ref = (uint64_t)ret_var.inner;
17847 if (ret_var.is_owned) {
17853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17854 LDKCommitmentSigned orig_conv;
17855 orig_conv.inner = (void*)(orig & (~1));
17856 orig_conv.is_owned = false;
17857 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
17858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17860 uint64_t ret_ref = (uint64_t)ret_var.inner;
17861 if (ret_var.is_owned) {
17867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17868 LDKRevokeAndACK this_obj_conv;
17869 this_obj_conv.inner = (void*)(this_obj & (~1));
17870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17871 RevokeAndACK_free(this_obj_conv);
17874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17875 LDKRevokeAndACK this_ptr_conv;
17876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17877 this_ptr_conv.is_owned = false;
17878 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17879 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
17883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17884 LDKRevokeAndACK this_ptr_conv;
17885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17886 this_ptr_conv.is_owned = false;
17887 LDKThirtyTwoBytes val_ref;
17888 CHECK((*env)->GetArrayLength(env, val) == 32);
17889 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17890 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
17893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
17894 LDKRevokeAndACK this_ptr_conv;
17895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17896 this_ptr_conv.is_owned = false;
17897 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17898 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
17902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17903 LDKRevokeAndACK this_ptr_conv;
17904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17905 this_ptr_conv.is_owned = false;
17906 LDKThirtyTwoBytes val_ref;
17907 CHECK((*env)->GetArrayLength(env, val) == 32);
17908 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17909 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
17912 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17913 LDKRevokeAndACK this_ptr_conv;
17914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17915 this_ptr_conv.is_owned = false;
17916 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17917 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17922 LDKRevokeAndACK this_ptr_conv;
17923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17924 this_ptr_conv.is_owned = false;
17925 LDKPublicKey val_ref;
17926 CHECK((*env)->GetArrayLength(env, val) == 33);
17927 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17928 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
17932 LDKThirtyTwoBytes channel_id_arg_ref;
17933 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17934 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17935 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
17936 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
17937 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
17938 LDKPublicKey next_per_commitment_point_arg_ref;
17939 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17940 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17941 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
17942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17944 uint64_t ret_ref = (uint64_t)ret_var.inner;
17945 if (ret_var.is_owned) {
17951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17952 LDKRevokeAndACK orig_conv;
17953 orig_conv.inner = (void*)(orig & (~1));
17954 orig_conv.is_owned = false;
17955 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
17956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17958 uint64_t ret_ref = (uint64_t)ret_var.inner;
17959 if (ret_var.is_owned) {
17965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17966 LDKUpdateFee this_obj_conv;
17967 this_obj_conv.inner = (void*)(this_obj & (~1));
17968 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17969 UpdateFee_free(this_obj_conv);
17972 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17973 LDKUpdateFee this_ptr_conv;
17974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17975 this_ptr_conv.is_owned = false;
17976 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17977 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
17981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17982 LDKUpdateFee this_ptr_conv;
17983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17984 this_ptr_conv.is_owned = false;
17985 LDKThirtyTwoBytes val_ref;
17986 CHECK((*env)->GetArrayLength(env, val) == 32);
17987 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17988 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
17991 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
17992 LDKUpdateFee this_ptr_conv;
17993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17994 this_ptr_conv.is_owned = false;
17995 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
17999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18000 LDKUpdateFee this_ptr_conv;
18001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18002 this_ptr_conv.is_owned = false;
18003 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
18007 LDKThirtyTwoBytes channel_id_arg_ref;
18008 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18009 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18010 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18013 uint64_t ret_ref = (uint64_t)ret_var.inner;
18014 if (ret_var.is_owned) {
18020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18021 LDKUpdateFee orig_conv;
18022 orig_conv.inner = (void*)(orig & (~1));
18023 orig_conv.is_owned = false;
18024 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18027 uint64_t ret_ref = (uint64_t)ret_var.inner;
18028 if (ret_var.is_owned) {
18034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18035 LDKDataLossProtect this_obj_conv;
18036 this_obj_conv.inner = (void*)(this_obj & (~1));
18037 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18038 DataLossProtect_free(this_obj_conv);
18041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18042 LDKDataLossProtect this_ptr_conv;
18043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18044 this_ptr_conv.is_owned = false;
18045 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18046 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
18050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18051 LDKDataLossProtect this_ptr_conv;
18052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18053 this_ptr_conv.is_owned = false;
18054 LDKThirtyTwoBytes val_ref;
18055 CHECK((*env)->GetArrayLength(env, val) == 32);
18056 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18057 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18060 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18061 LDKDataLossProtect this_ptr_conv;
18062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18063 this_ptr_conv.is_owned = false;
18064 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18065 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
18069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18070 LDKDataLossProtect this_ptr_conv;
18071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18072 this_ptr_conv.is_owned = false;
18073 LDKPublicKey val_ref;
18074 CHECK((*env)->GetArrayLength(env, val) == 33);
18075 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18076 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv *env, jclass clz, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
18080 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18081 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
18082 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
18083 LDKPublicKey my_current_per_commitment_point_arg_ref;
18084 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
18085 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
18086 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18089 uint64_t ret_ref = (uint64_t)ret_var.inner;
18090 if (ret_var.is_owned) {
18096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18097 LDKDataLossProtect orig_conv;
18098 orig_conv.inner = (void*)(orig & (~1));
18099 orig_conv.is_owned = false;
18100 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18101 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18102 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18103 uint64_t ret_ref = (uint64_t)ret_var.inner;
18104 if (ret_var.is_owned) {
18110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18111 LDKChannelReestablish this_obj_conv;
18112 this_obj_conv.inner = (void*)(this_obj & (~1));
18113 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18114 ChannelReestablish_free(this_obj_conv);
18117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18118 LDKChannelReestablish this_ptr_conv;
18119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18120 this_ptr_conv.is_owned = false;
18121 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18122 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
18126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18127 LDKChannelReestablish this_ptr_conv;
18128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18129 this_ptr_conv.is_owned = false;
18130 LDKThirtyTwoBytes val_ref;
18131 CHECK((*env)->GetArrayLength(env, val) == 32);
18132 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18133 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18137 LDKChannelReestablish this_ptr_conv;
18138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18139 this_ptr_conv.is_owned = false;
18140 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18145 LDKChannelReestablish this_ptr_conv;
18146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18147 this_ptr_conv.is_owned = false;
18148 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18152 LDKChannelReestablish this_ptr_conv;
18153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18154 this_ptr_conv.is_owned = false;
18155 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18160 LDKChannelReestablish this_ptr_conv;
18161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18162 this_ptr_conv.is_owned = false;
18163 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18167 LDKChannelReestablish orig_conv;
18168 orig_conv.inner = (void*)(orig & (~1));
18169 orig_conv.is_owned = false;
18170 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18173 uint64_t ret_ref = (uint64_t)ret_var.inner;
18174 if (ret_var.is_owned) {
18180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18181 LDKAnnouncementSignatures this_obj_conv;
18182 this_obj_conv.inner = (void*)(this_obj & (~1));
18183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18184 AnnouncementSignatures_free(this_obj_conv);
18187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18188 LDKAnnouncementSignatures this_ptr_conv;
18189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18190 this_ptr_conv.is_owned = false;
18191 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18192 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
18196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18197 LDKAnnouncementSignatures this_ptr_conv;
18198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18199 this_ptr_conv.is_owned = false;
18200 LDKThirtyTwoBytes val_ref;
18201 CHECK((*env)->GetArrayLength(env, val) == 32);
18202 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18203 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18207 LDKAnnouncementSignatures this_ptr_conv;
18208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18209 this_ptr_conv.is_owned = false;
18210 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18215 LDKAnnouncementSignatures this_ptr_conv;
18216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18217 this_ptr_conv.is_owned = false;
18218 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18222 LDKAnnouncementSignatures this_ptr_conv;
18223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18224 this_ptr_conv.is_owned = false;
18225 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18226 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
18230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18231 LDKAnnouncementSignatures this_ptr_conv;
18232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18233 this_ptr_conv.is_owned = false;
18234 LDKSignature val_ref;
18235 CHECK((*env)->GetArrayLength(env, val) == 64);
18236 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18237 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18241 LDKAnnouncementSignatures this_ptr_conv;
18242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18243 this_ptr_conv.is_owned = false;
18244 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18245 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
18249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18250 LDKAnnouncementSignatures this_ptr_conv;
18251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18252 this_ptr_conv.is_owned = false;
18253 LDKSignature val_ref;
18254 CHECK((*env)->GetArrayLength(env, val) == 64);
18255 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18256 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
18260 LDKThirtyTwoBytes channel_id_arg_ref;
18261 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18262 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18263 LDKSignature node_signature_arg_ref;
18264 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
18265 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
18266 LDKSignature bitcoin_signature_arg_ref;
18267 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
18268 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
18269 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18272 uint64_t ret_ref = (uint64_t)ret_var.inner;
18273 if (ret_var.is_owned) {
18279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18280 LDKAnnouncementSignatures orig_conv;
18281 orig_conv.inner = (void*)(orig & (~1));
18282 orig_conv.is_owned = false;
18283 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18286 uint64_t ret_ref = (uint64_t)ret_var.inner;
18287 if (ret_var.is_owned) {
18293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18294 if ((this_ptr & 1) != 0) return;
18295 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18296 FREE((void*)this_ptr);
18297 NetAddress_free(this_ptr_conv);
18300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18301 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18302 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18303 *ret_copy = NetAddress_clone(orig_conv);
18304 uint64_t ret_ref = (uint64_t)ret_copy;
18308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
18309 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18310 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18311 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18312 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18313 CVec_u8Z_free(ret_var);
18317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18318 LDKu8slice ser_ref;
18319 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18320 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18321 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18322 *ret_conv = Result_read(ser_ref);
18323 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18324 return (uint64_t)ret_conv;
18327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18328 LDKu8slice ser_ref;
18329 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18330 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18331 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18332 *ret_conv = NetAddress_read(ser_ref);
18333 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18334 return (uint64_t)ret_conv;
18337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18338 LDKUnsignedNodeAnnouncement this_obj_conv;
18339 this_obj_conv.inner = (void*)(this_obj & (~1));
18340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18341 UnsignedNodeAnnouncement_free(this_obj_conv);
18344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18345 LDKUnsignedNodeAnnouncement this_ptr_conv;
18346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18347 this_ptr_conv.is_owned = false;
18348 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18351 uint64_t ret_ref = (uint64_t)ret_var.inner;
18352 if (ret_var.is_owned) {
18358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18359 LDKUnsignedNodeAnnouncement this_ptr_conv;
18360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18361 this_ptr_conv.is_owned = false;
18362 LDKNodeFeatures val_conv;
18363 val_conv.inner = (void*)(val & (~1));
18364 val_conv.is_owned = (val & 1) || (val == 0);
18365 val_conv = NodeFeatures_clone(&val_conv);
18366 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18369 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18370 LDKUnsignedNodeAnnouncement this_ptr_conv;
18371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18372 this_ptr_conv.is_owned = false;
18373 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18378 LDKUnsignedNodeAnnouncement this_ptr_conv;
18379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18380 this_ptr_conv.is_owned = false;
18381 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18385 LDKUnsignedNodeAnnouncement this_ptr_conv;
18386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18387 this_ptr_conv.is_owned = false;
18388 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18389 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
18393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18394 LDKUnsignedNodeAnnouncement this_ptr_conv;
18395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18396 this_ptr_conv.is_owned = false;
18397 LDKPublicKey val_ref;
18398 CHECK((*env)->GetArrayLength(env, val) == 33);
18399 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18400 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
18404 LDKUnsignedNodeAnnouncement this_ptr_conv;
18405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18406 this_ptr_conv.is_owned = false;
18407 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
18408 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
18412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18413 LDKUnsignedNodeAnnouncement this_ptr_conv;
18414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18415 this_ptr_conv.is_owned = false;
18416 LDKThreeBytes val_ref;
18417 CHECK((*env)->GetArrayLength(env, val) == 3);
18418 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
18419 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
18423 LDKUnsignedNodeAnnouncement this_ptr_conv;
18424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18425 this_ptr_conv.is_owned = false;
18426 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18427 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
18431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18432 LDKUnsignedNodeAnnouncement this_ptr_conv;
18433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18434 this_ptr_conv.is_owned = false;
18435 LDKThirtyTwoBytes val_ref;
18436 CHECK((*env)->GetArrayLength(env, val) == 32);
18437 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18438 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18442 LDKUnsignedNodeAnnouncement this_ptr_conv;
18443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18444 this_ptr_conv.is_owned = false;
18445 LDKCVec_NetAddressZ val_constr;
18446 val_constr.datalen = (*env)->GetArrayLength(env, val);
18447 if (val_constr.datalen > 0)
18448 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18450 val_constr.data = NULL;
18451 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18452 for (size_t m = 0; m < val_constr.datalen; m++) {
18453 int64_t val_conv_12 = val_vals[m];
18454 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18455 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18456 val_constr.data[m] = val_conv_12_conv;
18458 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18459 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18463 LDKUnsignedNodeAnnouncement orig_conv;
18464 orig_conv.inner = (void*)(orig & (~1));
18465 orig_conv.is_owned = false;
18466 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18469 uint64_t ret_ref = (uint64_t)ret_var.inner;
18470 if (ret_var.is_owned) {
18476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18477 LDKNodeAnnouncement this_obj_conv;
18478 this_obj_conv.inner = (void*)(this_obj & (~1));
18479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18480 NodeAnnouncement_free(this_obj_conv);
18483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18484 LDKNodeAnnouncement this_ptr_conv;
18485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18486 this_ptr_conv.is_owned = false;
18487 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18488 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
18492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18493 LDKNodeAnnouncement this_ptr_conv;
18494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18495 this_ptr_conv.is_owned = false;
18496 LDKSignature val_ref;
18497 CHECK((*env)->GetArrayLength(env, val) == 64);
18498 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18499 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18503 LDKNodeAnnouncement this_ptr_conv;
18504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18505 this_ptr_conv.is_owned = false;
18506 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18507 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18508 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18509 uint64_t ret_ref = (uint64_t)ret_var.inner;
18510 if (ret_var.is_owned) {
18516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18517 LDKNodeAnnouncement this_ptr_conv;
18518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18519 this_ptr_conv.is_owned = false;
18520 LDKUnsignedNodeAnnouncement val_conv;
18521 val_conv.inner = (void*)(val & (~1));
18522 val_conv.is_owned = (val & 1) || (val == 0);
18523 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18524 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
18528 LDKSignature signature_arg_ref;
18529 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18530 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18531 LDKUnsignedNodeAnnouncement contents_arg_conv;
18532 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18533 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18534 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18535 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18538 uint64_t ret_ref = (uint64_t)ret_var.inner;
18539 if (ret_var.is_owned) {
18545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18546 LDKNodeAnnouncement orig_conv;
18547 orig_conv.inner = (void*)(orig & (~1));
18548 orig_conv.is_owned = false;
18549 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18552 uint64_t ret_ref = (uint64_t)ret_var.inner;
18553 if (ret_var.is_owned) {
18559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18560 LDKUnsignedChannelAnnouncement this_obj_conv;
18561 this_obj_conv.inner = (void*)(this_obj & (~1));
18562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18563 UnsignedChannelAnnouncement_free(this_obj_conv);
18566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18567 LDKUnsignedChannelAnnouncement this_ptr_conv;
18568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18569 this_ptr_conv.is_owned = false;
18570 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18573 uint64_t ret_ref = (uint64_t)ret_var.inner;
18574 if (ret_var.is_owned) {
18580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18581 LDKUnsignedChannelAnnouncement this_ptr_conv;
18582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18583 this_ptr_conv.is_owned = false;
18584 LDKChannelFeatures val_conv;
18585 val_conv.inner = (void*)(val & (~1));
18586 val_conv.is_owned = (val & 1) || (val == 0);
18587 val_conv = ChannelFeatures_clone(&val_conv);
18588 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18591 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18592 LDKUnsignedChannelAnnouncement this_ptr_conv;
18593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18594 this_ptr_conv.is_owned = false;
18595 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18596 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
18600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18601 LDKUnsignedChannelAnnouncement this_ptr_conv;
18602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18603 this_ptr_conv.is_owned = false;
18604 LDKThirtyTwoBytes val_ref;
18605 CHECK((*env)->GetArrayLength(env, val) == 32);
18606 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18607 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18611 LDKUnsignedChannelAnnouncement this_ptr_conv;
18612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18613 this_ptr_conv.is_owned = false;
18614 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18619 LDKUnsignedChannelAnnouncement this_ptr_conv;
18620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18621 this_ptr_conv.is_owned = false;
18622 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18626 LDKUnsignedChannelAnnouncement this_ptr_conv;
18627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18628 this_ptr_conv.is_owned = false;
18629 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18630 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
18634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18635 LDKUnsignedChannelAnnouncement this_ptr_conv;
18636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18637 this_ptr_conv.is_owned = false;
18638 LDKPublicKey val_ref;
18639 CHECK((*env)->GetArrayLength(env, val) == 33);
18640 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18641 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18645 LDKUnsignedChannelAnnouncement this_ptr_conv;
18646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18647 this_ptr_conv.is_owned = false;
18648 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18649 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
18653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18654 LDKUnsignedChannelAnnouncement this_ptr_conv;
18655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18656 this_ptr_conv.is_owned = false;
18657 LDKPublicKey val_ref;
18658 CHECK((*env)->GetArrayLength(env, val) == 33);
18659 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18660 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18664 LDKUnsignedChannelAnnouncement this_ptr_conv;
18665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18666 this_ptr_conv.is_owned = false;
18667 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18668 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
18672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18673 LDKUnsignedChannelAnnouncement this_ptr_conv;
18674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18675 this_ptr_conv.is_owned = false;
18676 LDKPublicKey val_ref;
18677 CHECK((*env)->GetArrayLength(env, val) == 33);
18678 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18679 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18683 LDKUnsignedChannelAnnouncement this_ptr_conv;
18684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18685 this_ptr_conv.is_owned = false;
18686 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18687 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
18691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18692 LDKUnsignedChannelAnnouncement this_ptr_conv;
18693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18694 this_ptr_conv.is_owned = false;
18695 LDKPublicKey val_ref;
18696 CHECK((*env)->GetArrayLength(env, val) == 33);
18697 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18698 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
18701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18702 LDKUnsignedChannelAnnouncement orig_conv;
18703 orig_conv.inner = (void*)(orig & (~1));
18704 orig_conv.is_owned = false;
18705 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
18706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18708 uint64_t ret_ref = (uint64_t)ret_var.inner;
18709 if (ret_var.is_owned) {
18715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18716 LDKChannelAnnouncement this_obj_conv;
18717 this_obj_conv.inner = (void*)(this_obj & (~1));
18718 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18719 ChannelAnnouncement_free(this_obj_conv);
18722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18723 LDKChannelAnnouncement this_ptr_conv;
18724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18725 this_ptr_conv.is_owned = false;
18726 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18727 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
18731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18732 LDKChannelAnnouncement this_ptr_conv;
18733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18734 this_ptr_conv.is_owned = false;
18735 LDKSignature val_ref;
18736 CHECK((*env)->GetArrayLength(env, val) == 64);
18737 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18738 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
18741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18742 LDKChannelAnnouncement this_ptr_conv;
18743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18744 this_ptr_conv.is_owned = false;
18745 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18746 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
18750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18751 LDKChannelAnnouncement this_ptr_conv;
18752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18753 this_ptr_conv.is_owned = false;
18754 LDKSignature val_ref;
18755 CHECK((*env)->GetArrayLength(env, val) == 64);
18756 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18757 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
18760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18761 LDKChannelAnnouncement this_ptr_conv;
18762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18763 this_ptr_conv.is_owned = false;
18764 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18765 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
18769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18770 LDKChannelAnnouncement this_ptr_conv;
18771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18772 this_ptr_conv.is_owned = false;
18773 LDKSignature val_ref;
18774 CHECK((*env)->GetArrayLength(env, val) == 64);
18775 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18776 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
18779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18780 LDKChannelAnnouncement this_ptr_conv;
18781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18782 this_ptr_conv.is_owned = false;
18783 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18784 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
18788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18789 LDKChannelAnnouncement this_ptr_conv;
18790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18791 this_ptr_conv.is_owned = false;
18792 LDKSignature val_ref;
18793 CHECK((*env)->GetArrayLength(env, val) == 64);
18794 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18795 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
18798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18799 LDKChannelAnnouncement this_ptr_conv;
18800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18801 this_ptr_conv.is_owned = false;
18802 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
18803 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18804 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18805 uint64_t ret_ref = (uint64_t)ret_var.inner;
18806 if (ret_var.is_owned) {
18812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18813 LDKChannelAnnouncement this_ptr_conv;
18814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18815 this_ptr_conv.is_owned = false;
18816 LDKUnsignedChannelAnnouncement val_conv;
18817 val_conv.inner = (void*)(val & (~1));
18818 val_conv.is_owned = (val & 1) || (val == 0);
18819 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
18820 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
18823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, int64_t contents_arg) {
18824 LDKSignature node_signature_1_arg_ref;
18825 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
18826 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
18827 LDKSignature node_signature_2_arg_ref;
18828 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
18829 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
18830 LDKSignature bitcoin_signature_1_arg_ref;
18831 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
18832 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
18833 LDKSignature bitcoin_signature_2_arg_ref;
18834 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
18835 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
18836 LDKUnsignedChannelAnnouncement contents_arg_conv;
18837 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18838 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18839 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
18840 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);
18841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18843 uint64_t ret_ref = (uint64_t)ret_var.inner;
18844 if (ret_var.is_owned) {
18850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18851 LDKChannelAnnouncement orig_conv;
18852 orig_conv.inner = (void*)(orig & (~1));
18853 orig_conv.is_owned = false;
18854 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
18855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18857 uint64_t ret_ref = (uint64_t)ret_var.inner;
18858 if (ret_var.is_owned) {
18864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18865 LDKUnsignedChannelUpdate this_obj_conv;
18866 this_obj_conv.inner = (void*)(this_obj & (~1));
18867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18868 UnsignedChannelUpdate_free(this_obj_conv);
18871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18872 LDKUnsignedChannelUpdate this_ptr_conv;
18873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18874 this_ptr_conv.is_owned = false;
18875 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
18880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18881 LDKUnsignedChannelUpdate this_ptr_conv;
18882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18883 this_ptr_conv.is_owned = false;
18884 LDKThirtyTwoBytes val_ref;
18885 CHECK((*env)->GetArrayLength(env, val) == 32);
18886 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18887 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
18890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18891 LDKUnsignedChannelUpdate this_ptr_conv;
18892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18893 this_ptr_conv.is_owned = false;
18894 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
18898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18899 LDKUnsignedChannelUpdate this_ptr_conv;
18900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18901 this_ptr_conv.is_owned = false;
18902 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
18905 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18906 LDKUnsignedChannelUpdate this_ptr_conv;
18907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18908 this_ptr_conv.is_owned = false;
18909 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
18913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18914 LDKUnsignedChannelUpdate this_ptr_conv;
18915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18916 this_ptr_conv.is_owned = false;
18917 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
18920 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
18921 LDKUnsignedChannelUpdate this_ptr_conv;
18922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18923 this_ptr_conv.is_owned = false;
18924 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
18928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
18929 LDKUnsignedChannelUpdate this_ptr_conv;
18930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18931 this_ptr_conv.is_owned = false;
18932 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
18935 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18936 LDKUnsignedChannelUpdate this_ptr_conv;
18937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18938 this_ptr_conv.is_owned = false;
18939 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
18943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18944 LDKUnsignedChannelUpdate this_ptr_conv;
18945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18946 this_ptr_conv.is_owned = false;
18947 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
18950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18951 LDKUnsignedChannelUpdate this_ptr_conv;
18952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18953 this_ptr_conv.is_owned = false;
18954 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
18958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18959 LDKUnsignedChannelUpdate this_ptr_conv;
18960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18961 this_ptr_conv.is_owned = false;
18962 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
18965 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18966 LDKUnsignedChannelUpdate this_ptr_conv;
18967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18968 this_ptr_conv.is_owned = false;
18969 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
18973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18974 LDKUnsignedChannelUpdate this_ptr_conv;
18975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18976 this_ptr_conv.is_owned = false;
18977 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
18980 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18981 LDKUnsignedChannelUpdate this_ptr_conv;
18982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18983 this_ptr_conv.is_owned = false;
18984 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
18988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18989 LDKUnsignedChannelUpdate this_ptr_conv;
18990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18991 this_ptr_conv.is_owned = false;
18992 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
18995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18996 LDKUnsignedChannelUpdate orig_conv;
18997 orig_conv.inner = (void*)(orig & (~1));
18998 orig_conv.is_owned = false;
18999 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19002 uint64_t ret_ref = (uint64_t)ret_var.inner;
19003 if (ret_var.is_owned) {
19009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19010 LDKChannelUpdate this_obj_conv;
19011 this_obj_conv.inner = (void*)(this_obj & (~1));
19012 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19013 ChannelUpdate_free(this_obj_conv);
19016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19017 LDKChannelUpdate this_ptr_conv;
19018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19019 this_ptr_conv.is_owned = false;
19020 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19021 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
19025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19026 LDKChannelUpdate this_ptr_conv;
19027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19028 this_ptr_conv.is_owned = false;
19029 LDKSignature val_ref;
19030 CHECK((*env)->GetArrayLength(env, val) == 64);
19031 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19032 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19036 LDKChannelUpdate this_ptr_conv;
19037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19038 this_ptr_conv.is_owned = false;
19039 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19042 uint64_t ret_ref = (uint64_t)ret_var.inner;
19043 if (ret_var.is_owned) {
19049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19050 LDKChannelUpdate this_ptr_conv;
19051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19052 this_ptr_conv.is_owned = false;
19053 LDKUnsignedChannelUpdate val_conv;
19054 val_conv.inner = (void*)(val & (~1));
19055 val_conv.is_owned = (val & 1) || (val == 0);
19056 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19057 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19061 LDKSignature signature_arg_ref;
19062 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19063 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19064 LDKUnsignedChannelUpdate contents_arg_conv;
19065 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19066 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19067 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19068 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19071 uint64_t ret_ref = (uint64_t)ret_var.inner;
19072 if (ret_var.is_owned) {
19078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19079 LDKChannelUpdate orig_conv;
19080 orig_conv.inner = (void*)(orig & (~1));
19081 orig_conv.is_owned = false;
19082 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19085 uint64_t ret_ref = (uint64_t)ret_var.inner;
19086 if (ret_var.is_owned) {
19092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19093 LDKQueryChannelRange this_obj_conv;
19094 this_obj_conv.inner = (void*)(this_obj & (~1));
19095 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19096 QueryChannelRange_free(this_obj_conv);
19099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19100 LDKQueryChannelRange this_ptr_conv;
19101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19102 this_ptr_conv.is_owned = false;
19103 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19104 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
19108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19109 LDKQueryChannelRange this_ptr_conv;
19110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19111 this_ptr_conv.is_owned = false;
19112 LDKThirtyTwoBytes val_ref;
19113 CHECK((*env)->GetArrayLength(env, val) == 32);
19114 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19115 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19118 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19119 LDKQueryChannelRange this_ptr_conv;
19120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19121 this_ptr_conv.is_owned = false;
19122 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19127 LDKQueryChannelRange this_ptr_conv;
19128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19129 this_ptr_conv.is_owned = false;
19130 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19133 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19134 LDKQueryChannelRange this_ptr_conv;
19135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19136 this_ptr_conv.is_owned = false;
19137 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19142 LDKQueryChannelRange this_ptr_conv;
19143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19144 this_ptr_conv.is_owned = false;
19145 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
19149 LDKThirtyTwoBytes chain_hash_arg_ref;
19150 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19151 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19152 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19155 uint64_t ret_ref = (uint64_t)ret_var.inner;
19156 if (ret_var.is_owned) {
19162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19163 LDKQueryChannelRange orig_conv;
19164 orig_conv.inner = (void*)(orig & (~1));
19165 orig_conv.is_owned = false;
19166 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19169 uint64_t ret_ref = (uint64_t)ret_var.inner;
19170 if (ret_var.is_owned) {
19176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19177 LDKReplyChannelRange this_obj_conv;
19178 this_obj_conv.inner = (void*)(this_obj & (~1));
19179 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19180 ReplyChannelRange_free(this_obj_conv);
19183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19184 LDKReplyChannelRange this_ptr_conv;
19185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19186 this_ptr_conv.is_owned = false;
19187 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19188 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
19192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19193 LDKReplyChannelRange this_ptr_conv;
19194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19195 this_ptr_conv.is_owned = false;
19196 LDKThirtyTwoBytes val_ref;
19197 CHECK((*env)->GetArrayLength(env, val) == 32);
19198 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19199 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19202 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19203 LDKReplyChannelRange this_ptr_conv;
19204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19205 this_ptr_conv.is_owned = false;
19206 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19211 LDKReplyChannelRange this_ptr_conv;
19212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19213 this_ptr_conv.is_owned = false;
19214 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19217 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19218 LDKReplyChannelRange this_ptr_conv;
19219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19220 this_ptr_conv.is_owned = false;
19221 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19226 LDKReplyChannelRange this_ptr_conv;
19227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19228 this_ptr_conv.is_owned = false;
19229 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
19233 LDKReplyChannelRange this_ptr_conv;
19234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19235 this_ptr_conv.is_owned = false;
19236 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19241 LDKReplyChannelRange this_ptr_conv;
19242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19243 this_ptr_conv.is_owned = false;
19244 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19248 LDKReplyChannelRange this_ptr_conv;
19249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19250 this_ptr_conv.is_owned = false;
19251 LDKCVec_u64Z val_constr;
19252 val_constr.datalen = (*env)->GetArrayLength(env, val);
19253 if (val_constr.datalen > 0)
19254 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19256 val_constr.data = NULL;
19257 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19258 for (size_t g = 0; g < val_constr.datalen; g++) {
19259 int64_t val_conv_6 = val_vals[g];
19260 val_constr.data[g] = val_conv_6;
19262 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19263 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv *env, jclass clz, 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) {
19267 LDKThirtyTwoBytes chain_hash_arg_ref;
19268 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19269 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19270 LDKCVec_u64Z short_channel_ids_arg_constr;
19271 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19272 if (short_channel_ids_arg_constr.datalen > 0)
19273 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19275 short_channel_ids_arg_constr.data = NULL;
19276 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19277 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19278 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19279 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19281 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19282 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19285 uint64_t ret_ref = (uint64_t)ret_var.inner;
19286 if (ret_var.is_owned) {
19292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19293 LDKReplyChannelRange orig_conv;
19294 orig_conv.inner = (void*)(orig & (~1));
19295 orig_conv.is_owned = false;
19296 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19299 uint64_t ret_ref = (uint64_t)ret_var.inner;
19300 if (ret_var.is_owned) {
19306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19307 LDKQueryShortChannelIds this_obj_conv;
19308 this_obj_conv.inner = (void*)(this_obj & (~1));
19309 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19310 QueryShortChannelIds_free(this_obj_conv);
19313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19314 LDKQueryShortChannelIds this_ptr_conv;
19315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19316 this_ptr_conv.is_owned = false;
19317 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
19322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19323 LDKQueryShortChannelIds this_ptr_conv;
19324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19325 this_ptr_conv.is_owned = false;
19326 LDKThirtyTwoBytes val_ref;
19327 CHECK((*env)->GetArrayLength(env, val) == 32);
19328 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19329 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19333 LDKQueryShortChannelIds this_ptr_conv;
19334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19335 this_ptr_conv.is_owned = false;
19336 LDKCVec_u64Z val_constr;
19337 val_constr.datalen = (*env)->GetArrayLength(env, val);
19338 if (val_constr.datalen > 0)
19339 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19341 val_constr.data = NULL;
19342 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19343 for (size_t g = 0; g < val_constr.datalen; g++) {
19344 int64_t val_conv_6 = val_vals[g];
19345 val_constr.data[g] = val_conv_6;
19347 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19348 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
19352 LDKThirtyTwoBytes chain_hash_arg_ref;
19353 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19354 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19355 LDKCVec_u64Z short_channel_ids_arg_constr;
19356 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19357 if (short_channel_ids_arg_constr.datalen > 0)
19358 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19360 short_channel_ids_arg_constr.data = NULL;
19361 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19362 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19363 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19364 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19366 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19367 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19370 uint64_t ret_ref = (uint64_t)ret_var.inner;
19371 if (ret_var.is_owned) {
19377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19378 LDKQueryShortChannelIds orig_conv;
19379 orig_conv.inner = (void*)(orig & (~1));
19380 orig_conv.is_owned = false;
19381 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19384 uint64_t ret_ref = (uint64_t)ret_var.inner;
19385 if (ret_var.is_owned) {
19391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19392 LDKReplyShortChannelIdsEnd this_obj_conv;
19393 this_obj_conv.inner = (void*)(this_obj & (~1));
19394 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19395 ReplyShortChannelIdsEnd_free(this_obj_conv);
19398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19399 LDKReplyShortChannelIdsEnd this_ptr_conv;
19400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19401 this_ptr_conv.is_owned = false;
19402 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19403 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
19407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19408 LDKReplyShortChannelIdsEnd this_ptr_conv;
19409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19410 this_ptr_conv.is_owned = false;
19411 LDKThirtyTwoBytes val_ref;
19412 CHECK((*env)->GetArrayLength(env, val) == 32);
19413 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19414 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
19418 LDKReplyShortChannelIdsEnd this_ptr_conv;
19419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19420 this_ptr_conv.is_owned = false;
19421 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19426 LDKReplyShortChannelIdsEnd this_ptr_conv;
19427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19428 this_ptr_conv.is_owned = false;
19429 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
19433 LDKThirtyTwoBytes chain_hash_arg_ref;
19434 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19435 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19436 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19439 uint64_t ret_ref = (uint64_t)ret_var.inner;
19440 if (ret_var.is_owned) {
19446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19447 LDKReplyShortChannelIdsEnd orig_conv;
19448 orig_conv.inner = (void*)(orig & (~1));
19449 orig_conv.is_owned = false;
19450 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19451 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19452 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19453 uint64_t ret_ref = (uint64_t)ret_var.inner;
19454 if (ret_var.is_owned) {
19460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19461 LDKGossipTimestampFilter this_obj_conv;
19462 this_obj_conv.inner = (void*)(this_obj & (~1));
19463 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19464 GossipTimestampFilter_free(this_obj_conv);
19467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19468 LDKGossipTimestampFilter this_ptr_conv;
19469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19470 this_ptr_conv.is_owned = false;
19471 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19472 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
19476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19477 LDKGossipTimestampFilter this_ptr_conv;
19478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19479 this_ptr_conv.is_owned = false;
19480 LDKThirtyTwoBytes val_ref;
19481 CHECK((*env)->GetArrayLength(env, val) == 32);
19482 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19483 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19486 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19487 LDKGossipTimestampFilter this_ptr_conv;
19488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19489 this_ptr_conv.is_owned = false;
19490 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19495 LDKGossipTimestampFilter this_ptr_conv;
19496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19497 this_ptr_conv.is_owned = false;
19498 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19501 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19502 LDKGossipTimestampFilter this_ptr_conv;
19503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19504 this_ptr_conv.is_owned = false;
19505 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19510 LDKGossipTimestampFilter this_ptr_conv;
19511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19512 this_ptr_conv.is_owned = false;
19513 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
19517 LDKThirtyTwoBytes chain_hash_arg_ref;
19518 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19519 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19520 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19523 uint64_t ret_ref = (uint64_t)ret_var.inner;
19524 if (ret_var.is_owned) {
19530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19531 LDKGossipTimestampFilter orig_conv;
19532 orig_conv.inner = (void*)(orig & (~1));
19533 orig_conv.is_owned = false;
19534 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19537 uint64_t ret_ref = (uint64_t)ret_var.inner;
19538 if (ret_var.is_owned) {
19544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19545 if ((this_ptr & 1) != 0) return;
19546 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19547 FREE((void*)this_ptr);
19548 ErrorAction_free(this_ptr_conv);
19551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19552 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19553 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19554 *ret_copy = ErrorAction_clone(orig_conv);
19555 uint64_t ret_ref = (uint64_t)ret_copy;
19559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19560 LDKLightningError this_obj_conv;
19561 this_obj_conv.inner = (void*)(this_obj & (~1));
19562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19563 LightningError_free(this_obj_conv);
19566 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
19567 LDKLightningError this_ptr_conv;
19568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19569 this_ptr_conv.is_owned = false;
19570 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19571 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19576 LDKLightningError this_ptr_conv;
19577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19578 this_ptr_conv.is_owned = false;
19579 LDKStr val_conv = java_to_owned_str(env, val);
19580 LightningError_set_err(&this_ptr_conv, val_conv);
19583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
19584 LDKLightningError this_ptr_conv;
19585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19586 this_ptr_conv.is_owned = false;
19587 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19588 *ret_copy = LightningError_get_action(&this_ptr_conv);
19589 uint64_t ret_ref = (uint64_t)ret_copy;
19593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19594 LDKLightningError this_ptr_conv;
19595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19596 this_ptr_conv.is_owned = false;
19597 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19598 LightningError_set_action(&this_ptr_conv, val_conv);
19601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
19602 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
19603 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19604 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19607 uint64_t ret_ref = (uint64_t)ret_var.inner;
19608 if (ret_var.is_owned) {
19614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19615 LDKLightningError orig_conv;
19616 orig_conv.inner = (void*)(orig & (~1));
19617 orig_conv.is_owned = false;
19618 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19619 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19620 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19621 uint64_t ret_ref = (uint64_t)ret_var.inner;
19622 if (ret_var.is_owned) {
19628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19629 LDKCommitmentUpdate this_obj_conv;
19630 this_obj_conv.inner = (void*)(this_obj & (~1));
19631 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19632 CommitmentUpdate_free(this_obj_conv);
19635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19636 LDKCommitmentUpdate this_ptr_conv;
19637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19638 this_ptr_conv.is_owned = false;
19639 LDKCVec_UpdateAddHTLCZ val_constr;
19640 val_constr.datalen = (*env)->GetArrayLength(env, val);
19641 if (val_constr.datalen > 0)
19642 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19644 val_constr.data = NULL;
19645 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19646 for (size_t p = 0; p < val_constr.datalen; p++) {
19647 int64_t val_conv_15 = val_vals[p];
19648 LDKUpdateAddHTLC val_conv_15_conv;
19649 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19650 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19651 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19652 val_constr.data[p] = val_conv_15_conv;
19654 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19655 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19659 LDKCommitmentUpdate this_ptr_conv;
19660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19661 this_ptr_conv.is_owned = false;
19662 LDKCVec_UpdateFulfillHTLCZ val_constr;
19663 val_constr.datalen = (*env)->GetArrayLength(env, val);
19664 if (val_constr.datalen > 0)
19665 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19667 val_constr.data = NULL;
19668 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19669 for (size_t t = 0; t < val_constr.datalen; t++) {
19670 int64_t val_conv_19 = val_vals[t];
19671 LDKUpdateFulfillHTLC val_conv_19_conv;
19672 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19673 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19674 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19675 val_constr.data[t] = val_conv_19_conv;
19677 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19678 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19682 LDKCommitmentUpdate this_ptr_conv;
19683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19684 this_ptr_conv.is_owned = false;
19685 LDKCVec_UpdateFailHTLCZ val_constr;
19686 val_constr.datalen = (*env)->GetArrayLength(env, val);
19687 if (val_constr.datalen > 0)
19688 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19690 val_constr.data = NULL;
19691 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19692 for (size_t q = 0; q < val_constr.datalen; q++) {
19693 int64_t val_conv_16 = val_vals[q];
19694 LDKUpdateFailHTLC val_conv_16_conv;
19695 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19696 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
19697 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
19698 val_constr.data[q] = val_conv_16_conv;
19700 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19701 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
19704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19705 LDKCommitmentUpdate this_ptr_conv;
19706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19707 this_ptr_conv.is_owned = false;
19708 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
19709 val_constr.datalen = (*env)->GetArrayLength(env, val);
19710 if (val_constr.datalen > 0)
19711 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19713 val_constr.data = NULL;
19714 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19715 for (size_t z = 0; z < val_constr.datalen; z++) {
19716 int64_t val_conv_25 = val_vals[z];
19717 LDKUpdateFailMalformedHTLC val_conv_25_conv;
19718 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
19719 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
19720 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
19721 val_constr.data[z] = val_conv_25_conv;
19723 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19724 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
19727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
19728 LDKCommitmentUpdate this_ptr_conv;
19729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19730 this_ptr_conv.is_owned = false;
19731 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
19732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19734 uint64_t ret_ref = (uint64_t)ret_var.inner;
19735 if (ret_var.is_owned) {
19741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19742 LDKCommitmentUpdate this_ptr_conv;
19743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19744 this_ptr_conv.is_owned = false;
19745 LDKUpdateFee val_conv;
19746 val_conv.inner = (void*)(val & (~1));
19747 val_conv.is_owned = (val & 1) || (val == 0);
19748 val_conv = UpdateFee_clone(&val_conv);
19749 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
19752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
19753 LDKCommitmentUpdate this_ptr_conv;
19754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19755 this_ptr_conv.is_owned = false;
19756 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
19757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19759 uint64_t ret_ref = (uint64_t)ret_var.inner;
19760 if (ret_var.is_owned) {
19766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19767 LDKCommitmentUpdate this_ptr_conv;
19768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19769 this_ptr_conv.is_owned = false;
19770 LDKCommitmentSigned val_conv;
19771 val_conv.inner = (void*)(val & (~1));
19772 val_conv.is_owned = (val & 1) || (val == 0);
19773 val_conv = CommitmentSigned_clone(&val_conv);
19774 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
19777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv *env, jclass clz, int64_tArray update_add_htlcs_arg, int64_tArray update_fulfill_htlcs_arg, int64_tArray update_fail_htlcs_arg, int64_tArray update_fail_malformed_htlcs_arg, int64_t update_fee_arg, int64_t commitment_signed_arg) {
19778 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
19779 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
19780 if (update_add_htlcs_arg_constr.datalen > 0)
19781 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19783 update_add_htlcs_arg_constr.data = NULL;
19784 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
19785 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
19786 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
19787 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
19788 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
19789 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
19790 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
19791 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
19793 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
19794 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
19795 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
19796 if (update_fulfill_htlcs_arg_constr.datalen > 0)
19797 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19799 update_fulfill_htlcs_arg_constr.data = NULL;
19800 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
19801 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
19802 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
19803 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
19804 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
19805 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
19806 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
19807 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
19809 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
19810 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
19811 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
19812 if (update_fail_htlcs_arg_constr.datalen > 0)
19813 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19815 update_fail_htlcs_arg_constr.data = NULL;
19816 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
19817 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
19818 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
19819 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
19820 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
19821 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
19822 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
19823 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
19825 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
19826 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
19827 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
19828 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
19829 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19831 update_fail_malformed_htlcs_arg_constr.data = NULL;
19832 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
19833 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
19834 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
19835 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
19836 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
19837 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);
19838 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
19839 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
19841 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
19842 LDKUpdateFee update_fee_arg_conv;
19843 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
19844 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
19845 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
19846 LDKCommitmentSigned commitment_signed_arg_conv;
19847 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
19848 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
19849 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
19850 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);
19851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19853 uint64_t ret_ref = (uint64_t)ret_var.inner;
19854 if (ret_var.is_owned) {
19860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19861 LDKCommitmentUpdate orig_conv;
19862 orig_conv.inner = (void*)(orig & (~1));
19863 orig_conv.is_owned = false;
19864 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
19865 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19866 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19867 uint64_t ret_ref = (uint64_t)ret_var.inner;
19868 if (ret_var.is_owned) {
19874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19875 if ((this_ptr & 1) != 0) return;
19876 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
19877 FREE((void*)this_ptr);
19878 HTLCFailChannelUpdate_free(this_ptr_conv);
19881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19882 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
19883 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
19884 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
19885 uint64_t ret_ref = (uint64_t)ret_copy;
19889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19890 if ((this_ptr & 1) != 0) return;
19891 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
19892 FREE((void*)this_ptr);
19893 ChannelMessageHandler_free(this_ptr_conv);
19896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19897 if ((this_ptr & 1) != 0) return;
19898 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
19899 FREE((void*)this_ptr);
19900 RoutingMessageHandler_free(this_ptr_conv);
19903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
19904 LDKAcceptChannel obj_conv;
19905 obj_conv.inner = (void*)(obj & (~1));
19906 obj_conv.is_owned = false;
19907 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
19908 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19909 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19910 CVec_u8Z_free(ret_var);
19914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19915 LDKu8slice ser_ref;
19916 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19917 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19918 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19919 *ret_conv = AcceptChannel_read(ser_ref);
19920 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19921 return (uint64_t)ret_conv;
19924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19925 LDKAnnouncementSignatures obj_conv;
19926 obj_conv.inner = (void*)(obj & (~1));
19927 obj_conv.is_owned = false;
19928 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
19929 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19930 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19931 CVec_u8Z_free(ret_var);
19935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19936 LDKu8slice ser_ref;
19937 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19938 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19939 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19940 *ret_conv = AnnouncementSignatures_read(ser_ref);
19941 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19942 return (uint64_t)ret_conv;
19945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
19946 LDKChannelReestablish obj_conv;
19947 obj_conv.inner = (void*)(obj & (~1));
19948 obj_conv.is_owned = false;
19949 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
19950 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19951 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19952 CVec_u8Z_free(ret_var);
19956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19957 LDKu8slice ser_ref;
19958 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19959 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19960 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19961 *ret_conv = ChannelReestablish_read(ser_ref);
19962 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19963 return (uint64_t)ret_conv;
19966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19967 LDKClosingSigned obj_conv;
19968 obj_conv.inner = (void*)(obj & (~1));
19969 obj_conv.is_owned = false;
19970 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
19971 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19972 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19973 CVec_u8Z_free(ret_var);
19977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19978 LDKu8slice ser_ref;
19979 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19980 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19981 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19982 *ret_conv = ClosingSigned_read(ser_ref);
19983 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19984 return (uint64_t)ret_conv;
19987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19988 LDKCommitmentSigned obj_conv;
19989 obj_conv.inner = (void*)(obj & (~1));
19990 obj_conv.is_owned = false;
19991 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
19992 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19993 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19994 CVec_u8Z_free(ret_var);
19998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19999 LDKu8slice ser_ref;
20000 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20001 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20002 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20003 *ret_conv = CommitmentSigned_read(ser_ref);
20004 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20005 return (uint64_t)ret_conv;
20008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
20009 LDKFundingCreated obj_conv;
20010 obj_conv.inner = (void*)(obj & (~1));
20011 obj_conv.is_owned = false;
20012 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20013 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20014 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20015 CVec_u8Z_free(ret_var);
20019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20020 LDKu8slice ser_ref;
20021 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20022 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20023 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20024 *ret_conv = FundingCreated_read(ser_ref);
20025 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20026 return (uint64_t)ret_conv;
20029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20030 LDKFundingSigned obj_conv;
20031 obj_conv.inner = (void*)(obj & (~1));
20032 obj_conv.is_owned = false;
20033 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20034 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20035 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20036 CVec_u8Z_free(ret_var);
20040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20041 LDKu8slice ser_ref;
20042 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20043 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20044 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20045 *ret_conv = FundingSigned_read(ser_ref);
20046 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20047 return (uint64_t)ret_conv;
20050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
20051 LDKFundingLocked obj_conv;
20052 obj_conv.inner = (void*)(obj & (~1));
20053 obj_conv.is_owned = false;
20054 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20055 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20056 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20057 CVec_u8Z_free(ret_var);
20061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20062 LDKu8slice ser_ref;
20063 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20064 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20065 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20066 *ret_conv = FundingLocked_read(ser_ref);
20067 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20068 return (uint64_t)ret_conv;
20071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
20073 obj_conv.inner = (void*)(obj & (~1));
20074 obj_conv.is_owned = false;
20075 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20076 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20077 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20078 CVec_u8Z_free(ret_var);
20082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20083 LDKu8slice ser_ref;
20084 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20085 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20086 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20087 *ret_conv = Init_read(ser_ref);
20088 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20089 return (uint64_t)ret_conv;
20092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20093 LDKOpenChannel obj_conv;
20094 obj_conv.inner = (void*)(obj & (~1));
20095 obj_conv.is_owned = false;
20096 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20097 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20098 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20099 CVec_u8Z_free(ret_var);
20103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20104 LDKu8slice ser_ref;
20105 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20106 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20107 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20108 *ret_conv = OpenChannel_read(ser_ref);
20109 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20110 return (uint64_t)ret_conv;
20113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
20114 LDKRevokeAndACK obj_conv;
20115 obj_conv.inner = (void*)(obj & (~1));
20116 obj_conv.is_owned = false;
20117 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20118 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20119 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20120 CVec_u8Z_free(ret_var);
20124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20125 LDKu8slice ser_ref;
20126 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20127 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20128 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20129 *ret_conv = RevokeAndACK_read(ser_ref);
20130 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20131 return (uint64_t)ret_conv;
20134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
20135 LDKShutdown obj_conv;
20136 obj_conv.inner = (void*)(obj & (~1));
20137 obj_conv.is_owned = false;
20138 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20141 CVec_u8Z_free(ret_var);
20145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20146 LDKu8slice ser_ref;
20147 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20148 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20149 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20150 *ret_conv = Shutdown_read(ser_ref);
20151 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20152 return (uint64_t)ret_conv;
20155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20156 LDKUpdateFailHTLC obj_conv;
20157 obj_conv.inner = (void*)(obj & (~1));
20158 obj_conv.is_owned = false;
20159 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20160 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20161 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20162 CVec_u8Z_free(ret_var);
20166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20167 LDKu8slice ser_ref;
20168 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20169 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20170 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20171 *ret_conv = UpdateFailHTLC_read(ser_ref);
20172 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20173 return (uint64_t)ret_conv;
20176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20177 LDKUpdateFailMalformedHTLC obj_conv;
20178 obj_conv.inner = (void*)(obj & (~1));
20179 obj_conv.is_owned = false;
20180 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20181 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20182 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20183 CVec_u8Z_free(ret_var);
20187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20188 LDKu8slice ser_ref;
20189 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20190 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20191 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20192 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20193 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20194 return (uint64_t)ret_conv;
20197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
20198 LDKUpdateFee obj_conv;
20199 obj_conv.inner = (void*)(obj & (~1));
20200 obj_conv.is_owned = false;
20201 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20202 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20203 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20204 CVec_u8Z_free(ret_var);
20208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20209 LDKu8slice ser_ref;
20210 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20211 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20212 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20213 *ret_conv = UpdateFee_read(ser_ref);
20214 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20215 return (uint64_t)ret_conv;
20218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20219 LDKUpdateFulfillHTLC obj_conv;
20220 obj_conv.inner = (void*)(obj & (~1));
20221 obj_conv.is_owned = false;
20222 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20223 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20224 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20225 CVec_u8Z_free(ret_var);
20229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20230 LDKu8slice ser_ref;
20231 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20232 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20233 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20234 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20235 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20236 return (uint64_t)ret_conv;
20239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20240 LDKUpdateAddHTLC obj_conv;
20241 obj_conv.inner = (void*)(obj & (~1));
20242 obj_conv.is_owned = false;
20243 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20244 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20245 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20246 CVec_u8Z_free(ret_var);
20250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20251 LDKu8slice ser_ref;
20252 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20253 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20254 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20255 *ret_conv = UpdateAddHTLC_read(ser_ref);
20256 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20257 return (uint64_t)ret_conv;
20260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
20262 obj_conv.inner = (void*)(obj & (~1));
20263 obj_conv.is_owned = false;
20264 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20265 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20266 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20267 CVec_u8Z_free(ret_var);
20271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20272 LDKu8slice ser_ref;
20273 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20274 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20275 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20276 *ret_conv = Ping_read(ser_ref);
20277 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20278 return (uint64_t)ret_conv;
20281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
20283 obj_conv.inner = (void*)(obj & (~1));
20284 obj_conv.is_owned = false;
20285 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20286 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20287 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20288 CVec_u8Z_free(ret_var);
20292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20293 LDKu8slice ser_ref;
20294 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20295 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20296 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20297 *ret_conv = Pong_read(ser_ref);
20298 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20299 return (uint64_t)ret_conv;
20302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20303 LDKUnsignedChannelAnnouncement obj_conv;
20304 obj_conv.inner = (void*)(obj & (~1));
20305 obj_conv.is_owned = false;
20306 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20307 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20308 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20309 CVec_u8Z_free(ret_var);
20313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20314 LDKu8slice ser_ref;
20315 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20316 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20317 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20318 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20319 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20320 return (uint64_t)ret_conv;
20323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20324 LDKChannelAnnouncement obj_conv;
20325 obj_conv.inner = (void*)(obj & (~1));
20326 obj_conv.is_owned = false;
20327 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20328 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20329 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20330 CVec_u8Z_free(ret_var);
20334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20335 LDKu8slice ser_ref;
20336 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20337 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20338 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20339 *ret_conv = ChannelAnnouncement_read(ser_ref);
20340 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20341 return (uint64_t)ret_conv;
20344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20345 LDKUnsignedChannelUpdate obj_conv;
20346 obj_conv.inner = (void*)(obj & (~1));
20347 obj_conv.is_owned = false;
20348 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20349 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20350 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20351 CVec_u8Z_free(ret_var);
20355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20356 LDKu8slice ser_ref;
20357 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20358 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20359 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20360 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20361 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20362 return (uint64_t)ret_conv;
20365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20366 LDKChannelUpdate obj_conv;
20367 obj_conv.inner = (void*)(obj & (~1));
20368 obj_conv.is_owned = false;
20369 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20370 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20371 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20372 CVec_u8Z_free(ret_var);
20376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20377 LDKu8slice ser_ref;
20378 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20379 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20380 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20381 *ret_conv = ChannelUpdate_read(ser_ref);
20382 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20383 return (uint64_t)ret_conv;
20386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
20387 LDKErrorMessage obj_conv;
20388 obj_conv.inner = (void*)(obj & (~1));
20389 obj_conv.is_owned = false;
20390 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20391 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20392 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20393 CVec_u8Z_free(ret_var);
20397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20398 LDKu8slice ser_ref;
20399 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20400 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20401 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20402 *ret_conv = ErrorMessage_read(ser_ref);
20403 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20404 return (uint64_t)ret_conv;
20407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20408 LDKUnsignedNodeAnnouncement obj_conv;
20409 obj_conv.inner = (void*)(obj & (~1));
20410 obj_conv.is_owned = false;
20411 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20412 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20413 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20414 CVec_u8Z_free(ret_var);
20418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20419 LDKu8slice ser_ref;
20420 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20421 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20422 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20423 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20424 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20425 return (uint64_t)ret_conv;
20428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20429 LDKNodeAnnouncement obj_conv;
20430 obj_conv.inner = (void*)(obj & (~1));
20431 obj_conv.is_owned = false;
20432 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20433 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20434 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20435 CVec_u8Z_free(ret_var);
20439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20440 LDKu8slice ser_ref;
20441 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20442 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20443 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20444 *ret_conv = NodeAnnouncement_read(ser_ref);
20445 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20446 return (uint64_t)ret_conv;
20449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20450 LDKu8slice ser_ref;
20451 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20452 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20453 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20454 *ret_conv = QueryShortChannelIds_read(ser_ref);
20455 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20456 return (uint64_t)ret_conv;
20459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
20460 LDKQueryShortChannelIds obj_conv;
20461 obj_conv.inner = (void*)(obj & (~1));
20462 obj_conv.is_owned = false;
20463 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20464 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20465 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20466 CVec_u8Z_free(ret_var);
20470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20471 LDKu8slice ser_ref;
20472 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20473 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20474 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20475 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20476 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20477 return (uint64_t)ret_conv;
20480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
20481 LDKReplyShortChannelIdsEnd obj_conv;
20482 obj_conv.inner = (void*)(obj & (~1));
20483 obj_conv.is_owned = false;
20484 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20485 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20486 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20487 CVec_u8Z_free(ret_var);
20491 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
20492 LDKQueryChannelRange this_arg_conv;
20493 this_arg_conv.inner = (void*)(this_arg & (~1));
20494 this_arg_conv.is_owned = false;
20495 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20500 LDKu8slice ser_ref;
20501 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20502 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20503 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20504 *ret_conv = QueryChannelRange_read(ser_ref);
20505 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20506 return (uint64_t)ret_conv;
20509 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20510 LDKQueryChannelRange obj_conv;
20511 obj_conv.inner = (void*)(obj & (~1));
20512 obj_conv.is_owned = false;
20513 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20514 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20515 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20516 CVec_u8Z_free(ret_var);
20520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20521 LDKu8slice ser_ref;
20522 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20523 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20524 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20525 *ret_conv = ReplyChannelRange_read(ser_ref);
20526 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20527 return (uint64_t)ret_conv;
20530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20531 LDKReplyChannelRange obj_conv;
20532 obj_conv.inner = (void*)(obj & (~1));
20533 obj_conv.is_owned = false;
20534 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20535 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20536 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20537 CVec_u8Z_free(ret_var);
20541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20542 LDKu8slice ser_ref;
20543 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20544 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20545 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20546 *ret_conv = GossipTimestampFilter_read(ser_ref);
20547 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20548 return (uint64_t)ret_conv;
20551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
20552 LDKGossipTimestampFilter obj_conv;
20553 obj_conv.inner = (void*)(obj & (~1));
20554 obj_conv.is_owned = false;
20555 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20556 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20557 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20558 CVec_u8Z_free(ret_var);
20562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20563 LDKIgnoringMessageHandler this_obj_conv;
20564 this_obj_conv.inner = (void*)(this_obj & (~1));
20565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20566 IgnoringMessageHandler_free(this_obj_conv);
20569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
20570 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20571 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20572 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20573 uint64_t ret_ref = (uint64_t)ret_var.inner;
20574 if (ret_var.is_owned) {
20580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20581 LDKIgnoringMessageHandler this_arg_conv;
20582 this_arg_conv.inner = (void*)(this_arg & (~1));
20583 this_arg_conv.is_owned = false;
20584 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20585 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20586 return (uint64_t)ret;
20589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20590 LDKIgnoringMessageHandler this_arg_conv;
20591 this_arg_conv.inner = (void*)(this_arg & (~1));
20592 this_arg_conv.is_owned = false;
20593 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20594 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20595 return (uint64_t)ret;
20598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20599 LDKErroringMessageHandler this_obj_conv;
20600 this_obj_conv.inner = (void*)(this_obj & (~1));
20601 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20602 ErroringMessageHandler_free(this_obj_conv);
20605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
20606 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20607 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20608 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20609 uint64_t ret_ref = (uint64_t)ret_var.inner;
20610 if (ret_var.is_owned) {
20616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20617 LDKErroringMessageHandler this_arg_conv;
20618 this_arg_conv.inner = (void*)(this_arg & (~1));
20619 this_arg_conv.is_owned = false;
20620 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20621 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20622 return (uint64_t)ret;
20625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20626 LDKErroringMessageHandler this_arg_conv;
20627 this_arg_conv.inner = (void*)(this_arg & (~1));
20628 this_arg_conv.is_owned = false;
20629 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20630 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20631 return (uint64_t)ret;
20634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20635 LDKMessageHandler this_obj_conv;
20636 this_obj_conv.inner = (void*)(this_obj & (~1));
20637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20638 MessageHandler_free(this_obj_conv);
20641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20642 LDKMessageHandler this_ptr_conv;
20643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20644 this_ptr_conv.is_owned = false;
20645 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20650 LDKMessageHandler this_ptr_conv;
20651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20652 this_ptr_conv.is_owned = false;
20653 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20654 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
20655 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20656 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
20658 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20662 LDKMessageHandler this_ptr_conv;
20663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20664 this_ptr_conv.is_owned = false;
20665 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20670 LDKMessageHandler this_ptr_conv;
20671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20672 this_ptr_conv.is_owned = false;
20673 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20674 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20675 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20676 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
20678 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv *env, jclass clz, int64_t chan_handler_arg, int64_t route_handler_arg) {
20682 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20683 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
20684 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20685 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
20687 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20688 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20689 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20690 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
20692 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20695 uint64_t ret_ref = (uint64_t)ret_var.inner;
20696 if (ret_var.is_owned) {
20702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20703 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
20704 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
20705 *ret = SocketDescriptor_clone(orig_conv);
20706 return (uint64_t)ret;
20709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20710 if ((this_ptr & 1) != 0) return;
20711 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
20712 FREE((void*)this_ptr);
20713 SocketDescriptor_free(this_ptr_conv);
20716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20717 LDKPeerHandleError this_obj_conv;
20718 this_obj_conv.inner = (void*)(this_obj & (~1));
20719 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20720 PeerHandleError_free(this_obj_conv);
20723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
20724 LDKPeerHandleError this_ptr_conv;
20725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20726 this_ptr_conv.is_owned = false;
20727 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
20731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20732 LDKPeerHandleError this_ptr_conv;
20733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20734 this_ptr_conv.is_owned = false;
20735 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
20738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
20739 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
20740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20742 uint64_t ret_ref = (uint64_t)ret_var.inner;
20743 if (ret_var.is_owned) {
20749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20750 LDKPeerHandleError orig_conv;
20751 orig_conv.inner = (void*)(orig & (~1));
20752 orig_conv.is_owned = false;
20753 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
20754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20756 uint64_t ret_ref = (uint64_t)ret_var.inner;
20757 if (ret_var.is_owned) {
20763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20764 LDKPeerManager this_obj_conv;
20765 this_obj_conv.inner = (void*)(this_obj & (~1));
20766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20767 PeerManager_free(this_obj_conv);
20770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger) {
20771 LDKMessageHandler message_handler_conv;
20772 message_handler_conv.inner = (void*)(message_handler & (~1));
20773 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
20774 // Warning: we need a move here but no clone is available for LDKMessageHandler
20775 LDKSecretKey our_node_secret_ref;
20776 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
20777 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
20778 unsigned char ephemeral_random_data_arr[32];
20779 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
20780 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
20781 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
20782 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
20783 if (logger_conv.free == LDKLogger_JCalls_free) {
20784 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20785 LDKLogger_JCalls_clone(logger_conv.this_arg);
20787 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
20788 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20789 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20790 uint64_t ret_ref = (uint64_t)ret_var.inner;
20791 if (ret_var.is_owned) {
20797 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
20798 LDKPeerManager this_arg_conv;
20799 this_arg_conv.inner = (void*)(this_arg & (~1));
20800 this_arg_conv.is_owned = false;
20801 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
20802 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
20804 for (size_t i = 0; i < ret_var.datalen; i++) {
20805 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
20806 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
20807 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
20809 FREE(ret_var.data);
20813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor) {
20814 LDKPeerManager this_arg_conv;
20815 this_arg_conv.inner = (void*)(this_arg & (~1));
20816 this_arg_conv.is_owned = false;
20817 LDKPublicKey their_node_id_ref;
20818 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20819 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20820 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20821 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20822 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20823 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20825 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20826 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
20827 return (uint64_t)ret_conv;
20830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20831 LDKPeerManager this_arg_conv;
20832 this_arg_conv.inner = (void*)(this_arg & (~1));
20833 this_arg_conv.is_owned = false;
20834 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20835 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20836 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20837 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20839 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20840 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
20841 return (uint64_t)ret_conv;
20844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20845 LDKPeerManager this_arg_conv;
20846 this_arg_conv.inner = (void*)(this_arg & (~1));
20847 this_arg_conv.is_owned = false;
20848 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20849 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20850 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
20851 return (uint64_t)ret_conv;
20854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
20855 LDKPeerManager this_arg_conv;
20856 this_arg_conv.inner = (void*)(this_arg & (~1));
20857 this_arg_conv.is_owned = false;
20858 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
20859 LDKu8slice data_ref;
20860 data_ref.datalen = (*env)->GetArrayLength(env, data);
20861 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
20862 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20863 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
20864 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
20865 return (uint64_t)ret_conv;
20868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
20869 LDKPeerManager this_arg_conv;
20870 this_arg_conv.inner = (void*)(this_arg & (~1));
20871 this_arg_conv.is_owned = false;
20872 PeerManager_process_events(&this_arg_conv);
20875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20876 LDKPeerManager this_arg_conv;
20877 this_arg_conv.inner = (void*)(this_arg & (~1));
20878 this_arg_conv.is_owned = false;
20879 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20880 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
20883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
20884 LDKPeerManager this_arg_conv;
20885 this_arg_conv.inner = (void*)(this_arg & (~1));
20886 this_arg_conv.is_owned = false;
20887 LDKPublicKey node_id_ref;
20888 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20889 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20890 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
20893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
20894 LDKPeerManager this_arg_conv;
20895 this_arg_conv.inner = (void*)(this_arg & (~1));
20896 this_arg_conv.is_owned = false;
20897 PeerManager_timer_tick_occurred(&this_arg_conv);
20900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
20901 unsigned char commitment_seed_arr[32];
20902 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
20903 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
20904 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
20905 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20906 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
20910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
20911 LDKPublicKey per_commitment_point_ref;
20912 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20913 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20914 unsigned char base_secret_arr[32];
20915 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
20916 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
20917 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
20918 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20919 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
20920 return (uint64_t)ret_conv;
20923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
20924 LDKPublicKey per_commitment_point_ref;
20925 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20926 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20927 LDKPublicKey base_point_ref;
20928 CHECK((*env)->GetArrayLength(env, base_point) == 33);
20929 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
20930 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20931 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
20932 return (uint64_t)ret_conv;
20935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
20936 unsigned char per_commitment_secret_arr[32];
20937 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
20938 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
20939 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
20940 unsigned char countersignatory_revocation_base_secret_arr[32];
20941 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
20942 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
20943 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
20944 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20945 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
20946 return (uint64_t)ret_conv;
20949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
20950 LDKPublicKey per_commitment_point_ref;
20951 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20952 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20953 LDKPublicKey countersignatory_revocation_base_point_ref;
20954 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
20955 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
20956 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20957 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
20958 return (uint64_t)ret_conv;
20961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20962 LDKTxCreationKeys this_obj_conv;
20963 this_obj_conv.inner = (void*)(this_obj & (~1));
20964 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20965 TxCreationKeys_free(this_obj_conv);
20968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20969 LDKTxCreationKeys this_ptr_conv;
20970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20971 this_ptr_conv.is_owned = false;
20972 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20973 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
20977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20978 LDKTxCreationKeys this_ptr_conv;
20979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20980 this_ptr_conv.is_owned = false;
20981 LDKPublicKey val_ref;
20982 CHECK((*env)->GetArrayLength(env, val) == 33);
20983 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20984 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
20987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20988 LDKTxCreationKeys this_ptr_conv;
20989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20990 this_ptr_conv.is_owned = false;
20991 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20992 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
20996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20997 LDKTxCreationKeys this_ptr_conv;
20998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20999 this_ptr_conv.is_owned = false;
21000 LDKPublicKey val_ref;
21001 CHECK((*env)->GetArrayLength(env, val) == 33);
21002 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21003 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21007 LDKTxCreationKeys this_ptr_conv;
21008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21009 this_ptr_conv.is_owned = false;
21010 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21011 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
21015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21016 LDKTxCreationKeys this_ptr_conv;
21017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21018 this_ptr_conv.is_owned = false;
21019 LDKPublicKey val_ref;
21020 CHECK((*env)->GetArrayLength(env, val) == 33);
21021 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21022 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21026 LDKTxCreationKeys this_ptr_conv;
21027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21028 this_ptr_conv.is_owned = false;
21029 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21030 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
21034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21035 LDKTxCreationKeys this_ptr_conv;
21036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21037 this_ptr_conv.is_owned = false;
21038 LDKPublicKey val_ref;
21039 CHECK((*env)->GetArrayLength(env, val) == 33);
21040 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21041 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21045 LDKTxCreationKeys this_ptr_conv;
21046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21047 this_ptr_conv.is_owned = false;
21048 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
21053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21054 LDKTxCreationKeys this_ptr_conv;
21055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21056 this_ptr_conv.is_owned = false;
21057 LDKPublicKey val_ref;
21058 CHECK((*env)->GetArrayLength(env, val) == 33);
21059 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21060 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, 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) {
21064 LDKPublicKey per_commitment_point_arg_ref;
21065 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
21066 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
21067 LDKPublicKey revocation_key_arg_ref;
21068 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
21069 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
21070 LDKPublicKey broadcaster_htlc_key_arg_ref;
21071 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
21072 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
21073 LDKPublicKey countersignatory_htlc_key_arg_ref;
21074 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
21075 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
21076 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21077 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
21078 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
21079 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);
21080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21082 uint64_t ret_ref = (uint64_t)ret_var.inner;
21083 if (ret_var.is_owned) {
21089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21090 LDKTxCreationKeys orig_conv;
21091 orig_conv.inner = (void*)(orig & (~1));
21092 orig_conv.is_owned = false;
21093 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21096 uint64_t ret_ref = (uint64_t)ret_var.inner;
21097 if (ret_var.is_owned) {
21103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21104 LDKTxCreationKeys obj_conv;
21105 obj_conv.inner = (void*)(obj & (~1));
21106 obj_conv.is_owned = false;
21107 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21108 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21109 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21110 CVec_u8Z_free(ret_var);
21114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21115 LDKu8slice ser_ref;
21116 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21117 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21118 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21119 *ret_conv = TxCreationKeys_read(ser_ref);
21120 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21121 return (uint64_t)ret_conv;
21124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21125 LDKChannelPublicKeys this_obj_conv;
21126 this_obj_conv.inner = (void*)(this_obj & (~1));
21127 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21128 ChannelPublicKeys_free(this_obj_conv);
21131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21132 LDKChannelPublicKeys this_ptr_conv;
21133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21134 this_ptr_conv.is_owned = false;
21135 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21136 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
21140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21141 LDKChannelPublicKeys this_ptr_conv;
21142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21143 this_ptr_conv.is_owned = false;
21144 LDKPublicKey val_ref;
21145 CHECK((*env)->GetArrayLength(env, val) == 33);
21146 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21147 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21151 LDKChannelPublicKeys this_ptr_conv;
21152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21153 this_ptr_conv.is_owned = false;
21154 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21155 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21160 LDKChannelPublicKeys this_ptr_conv;
21161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21162 this_ptr_conv.is_owned = false;
21163 LDKPublicKey val_ref;
21164 CHECK((*env)->GetArrayLength(env, val) == 33);
21165 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21166 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21170 LDKChannelPublicKeys this_ptr_conv;
21171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21172 this_ptr_conv.is_owned = false;
21173 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21174 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
21178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21179 LDKChannelPublicKeys this_ptr_conv;
21180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21181 this_ptr_conv.is_owned = false;
21182 LDKPublicKey val_ref;
21183 CHECK((*env)->GetArrayLength(env, val) == 33);
21184 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21185 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21189 LDKChannelPublicKeys this_ptr_conv;
21190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21191 this_ptr_conv.is_owned = false;
21192 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21193 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21198 LDKChannelPublicKeys this_ptr_conv;
21199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21200 this_ptr_conv.is_owned = false;
21201 LDKPublicKey val_ref;
21202 CHECK((*env)->GetArrayLength(env, val) == 33);
21203 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21204 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21208 LDKChannelPublicKeys this_ptr_conv;
21209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21210 this_ptr_conv.is_owned = false;
21211 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21212 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21217 LDKChannelPublicKeys this_ptr_conv;
21218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21219 this_ptr_conv.is_owned = false;
21220 LDKPublicKey val_ref;
21221 CHECK((*env)->GetArrayLength(env, val) == 33);
21222 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21223 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, 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) {
21227 LDKPublicKey funding_pubkey_arg_ref;
21228 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
21229 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
21230 LDKPublicKey revocation_basepoint_arg_ref;
21231 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
21232 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
21233 LDKPublicKey payment_point_arg_ref;
21234 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
21235 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
21236 LDKPublicKey delayed_payment_basepoint_arg_ref;
21237 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
21238 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
21239 LDKPublicKey htlc_basepoint_arg_ref;
21240 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
21241 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
21242 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);
21243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21245 uint64_t ret_ref = (uint64_t)ret_var.inner;
21246 if (ret_var.is_owned) {
21252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21253 LDKChannelPublicKeys orig_conv;
21254 orig_conv.inner = (void*)(orig & (~1));
21255 orig_conv.is_owned = false;
21256 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21259 uint64_t ret_ref = (uint64_t)ret_var.inner;
21260 if (ret_var.is_owned) {
21266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21267 LDKChannelPublicKeys obj_conv;
21268 obj_conv.inner = (void*)(obj & (~1));
21269 obj_conv.is_owned = false;
21270 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21271 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21272 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21273 CVec_u8Z_free(ret_var);
21277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21278 LDKu8slice ser_ref;
21279 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21280 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21281 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21282 *ret_conv = ChannelPublicKeys_read(ser_ref);
21283 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21284 return (uint64_t)ret_conv;
21287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, 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) {
21288 LDKPublicKey per_commitment_point_ref;
21289 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21290 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21291 LDKPublicKey broadcaster_delayed_payment_base_ref;
21292 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
21293 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
21294 LDKPublicKey broadcaster_htlc_base_ref;
21295 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
21296 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
21297 LDKPublicKey countersignatory_revocation_base_ref;
21298 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
21299 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
21300 LDKPublicKey countersignatory_htlc_base_ref;
21301 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
21302 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
21303 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21304 *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);
21305 return (uint64_t)ret_conv;
21308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1from_1channel_1static_1keys(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
21309 LDKPublicKey per_commitment_point_ref;
21310 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21311 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21312 LDKChannelPublicKeys broadcaster_keys_conv;
21313 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21314 broadcaster_keys_conv.is_owned = false;
21315 LDKChannelPublicKeys countersignatory_keys_conv;
21316 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21317 countersignatory_keys_conv.is_owned = false;
21318 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21319 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21320 return (uint64_t)ret_conv;
21323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
21324 LDKPublicKey revocation_key_ref;
21325 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21326 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21327 LDKPublicKey broadcaster_delayed_payment_key_ref;
21328 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21329 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21330 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21331 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21332 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21333 CVec_u8Z_free(ret_var);
21337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21338 LDKHTLCOutputInCommitment this_obj_conv;
21339 this_obj_conv.inner = (void*)(this_obj & (~1));
21340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21341 HTLCOutputInCommitment_free(this_obj_conv);
21344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
21345 LDKHTLCOutputInCommitment this_ptr_conv;
21346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21347 this_ptr_conv.is_owned = false;
21348 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21353 LDKHTLCOutputInCommitment this_ptr_conv;
21354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21355 this_ptr_conv.is_owned = false;
21356 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21360 LDKHTLCOutputInCommitment this_ptr_conv;
21361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21362 this_ptr_conv.is_owned = false;
21363 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21368 LDKHTLCOutputInCommitment this_ptr_conv;
21369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21370 this_ptr_conv.is_owned = false;
21371 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21374 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
21375 LDKHTLCOutputInCommitment this_ptr_conv;
21376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21377 this_ptr_conv.is_owned = false;
21378 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21383 LDKHTLCOutputInCommitment this_ptr_conv;
21384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21385 this_ptr_conv.is_owned = false;
21386 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21390 LDKHTLCOutputInCommitment this_ptr_conv;
21391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21392 this_ptr_conv.is_owned = false;
21393 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21394 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
21398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21399 LDKHTLCOutputInCommitment this_ptr_conv;
21400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21401 this_ptr_conv.is_owned = false;
21402 LDKThirtyTwoBytes val_ref;
21403 CHECK((*env)->GetArrayLength(env, val) == 32);
21404 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21405 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
21409 LDKHTLCOutputInCommitment this_ptr_conv;
21410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21411 this_ptr_conv.is_owned = false;
21412 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21413 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21414 uint64_t ret_ref = (uint64_t)ret_copy;
21418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21419 LDKHTLCOutputInCommitment this_ptr_conv;
21420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21421 this_ptr_conv.is_owned = false;
21422 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21423 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new(JNIEnv *env, jclass clz, jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
21427 LDKThirtyTwoBytes payment_hash_arg_ref;
21428 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
21429 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
21430 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21431 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21434 uint64_t ret_ref = (uint64_t)ret_var.inner;
21435 if (ret_var.is_owned) {
21441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21442 LDKHTLCOutputInCommitment orig_conv;
21443 orig_conv.inner = (void*)(orig & (~1));
21444 orig_conv.is_owned = false;
21445 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21448 uint64_t ret_ref = (uint64_t)ret_var.inner;
21449 if (ret_var.is_owned) {
21455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
21456 LDKHTLCOutputInCommitment obj_conv;
21457 obj_conv.inner = (void*)(obj & (~1));
21458 obj_conv.is_owned = false;
21459 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21460 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21461 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21462 CVec_u8Z_free(ret_var);
21466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21467 LDKu8slice ser_ref;
21468 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21469 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21470 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21471 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21472 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21473 return (uint64_t)ret_conv;
21476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
21477 LDKHTLCOutputInCommitment htlc_conv;
21478 htlc_conv.inner = (void*)(htlc & (~1));
21479 htlc_conv.is_owned = false;
21480 LDKTxCreationKeys keys_conv;
21481 keys_conv.inner = (void*)(keys & (~1));
21482 keys_conv.is_owned = false;
21483 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21484 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21485 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21486 CVec_u8Z_free(ret_var);
21490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
21491 LDKPublicKey broadcaster_ref;
21492 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
21493 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
21494 LDKPublicKey countersignatory_ref;
21495 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
21496 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
21497 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21498 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21499 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21500 CVec_u8Z_free(ret_var);
21504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
21505 unsigned char commitment_txid_arr[32];
21506 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
21507 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
21508 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21509 LDKHTLCOutputInCommitment htlc_conv;
21510 htlc_conv.inner = (void*)(htlc & (~1));
21511 htlc_conv.is_owned = false;
21512 LDKPublicKey broadcaster_delayed_payment_key_ref;
21513 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21514 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21515 LDKPublicKey revocation_key_ref;
21516 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21517 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21518 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21519 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21520 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21521 Transaction_free(ret_var);
21525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21526 LDKChannelTransactionParameters this_obj_conv;
21527 this_obj_conv.inner = (void*)(this_obj & (~1));
21528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21529 ChannelTransactionParameters_free(this_obj_conv);
21532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21533 LDKChannelTransactionParameters this_ptr_conv;
21534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21535 this_ptr_conv.is_owned = false;
21536 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21539 uint64_t ret_ref = (uint64_t)ret_var.inner;
21540 if (ret_var.is_owned) {
21546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21547 LDKChannelTransactionParameters this_ptr_conv;
21548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21549 this_ptr_conv.is_owned = false;
21550 LDKChannelPublicKeys val_conv;
21551 val_conv.inner = (void*)(val & (~1));
21552 val_conv.is_owned = (val & 1) || (val == 0);
21553 val_conv = ChannelPublicKeys_clone(&val_conv);
21554 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21557 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21558 LDKChannelTransactionParameters this_ptr_conv;
21559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21560 this_ptr_conv.is_owned = false;
21561 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21566 LDKChannelTransactionParameters this_ptr_conv;
21567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21568 this_ptr_conv.is_owned = false;
21569 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
21573 LDKChannelTransactionParameters this_ptr_conv;
21574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21575 this_ptr_conv.is_owned = false;
21576 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21581 LDKChannelTransactionParameters this_ptr_conv;
21582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21583 this_ptr_conv.is_owned = false;
21584 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
21588 LDKChannelTransactionParameters this_ptr_conv;
21589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21590 this_ptr_conv.is_owned = false;
21591 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21592 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21593 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21594 uint64_t ret_ref = (uint64_t)ret_var.inner;
21595 if (ret_var.is_owned) {
21601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21602 LDKChannelTransactionParameters this_ptr_conv;
21603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21604 this_ptr_conv.is_owned = false;
21605 LDKCounterpartyChannelTransactionParameters val_conv;
21606 val_conv.inner = (void*)(val & (~1));
21607 val_conv.is_owned = (val & 1) || (val == 0);
21608 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21609 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21613 LDKChannelTransactionParameters this_ptr_conv;
21614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21615 this_ptr_conv.is_owned = false;
21616 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21619 uint64_t ret_ref = (uint64_t)ret_var.inner;
21620 if (ret_var.is_owned) {
21626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21627 LDKChannelTransactionParameters this_ptr_conv;
21628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21629 this_ptr_conv.is_owned = false;
21630 LDKOutPoint val_conv;
21631 val_conv.inner = (void*)(val & (~1));
21632 val_conv.is_owned = (val & 1) || (val == 0);
21633 val_conv = OutPoint_clone(&val_conv);
21634 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg) {
21638 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21639 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21640 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21641 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21642 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21643 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21644 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21645 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21646 LDKOutPoint funding_outpoint_arg_conv;
21647 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21648 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21649 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21650 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);
21651 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21652 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21653 uint64_t ret_ref = (uint64_t)ret_var.inner;
21654 if (ret_var.is_owned) {
21660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21661 LDKChannelTransactionParameters orig_conv;
21662 orig_conv.inner = (void*)(orig & (~1));
21663 orig_conv.is_owned = false;
21664 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21667 uint64_t ret_ref = (uint64_t)ret_var.inner;
21668 if (ret_var.is_owned) {
21674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21675 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21676 this_obj_conv.inner = (void*)(this_obj & (~1));
21677 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21678 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21682 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21684 this_ptr_conv.is_owned = false;
21685 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21686 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21687 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21688 uint64_t ret_ref = (uint64_t)ret_var.inner;
21689 if (ret_var.is_owned) {
21695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21696 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21698 this_ptr_conv.is_owned = false;
21699 LDKChannelPublicKeys val_conv;
21700 val_conv.inner = (void*)(val & (~1));
21701 val_conv.is_owned = (val & 1) || (val == 0);
21702 val_conv = ChannelPublicKeys_clone(&val_conv);
21703 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
21706 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21707 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21709 this_ptr_conv.is_owned = false;
21710 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
21714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21715 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21717 this_ptr_conv.is_owned = false;
21718 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
21721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
21722 LDKChannelPublicKeys pubkeys_arg_conv;
21723 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
21724 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
21725 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
21726 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
21727 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21728 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21729 uint64_t ret_ref = (uint64_t)ret_var.inner;
21730 if (ret_var.is_owned) {
21736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21737 LDKCounterpartyChannelTransactionParameters orig_conv;
21738 orig_conv.inner = (void*)(orig & (~1));
21739 orig_conv.is_owned = false;
21740 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
21741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21743 uint64_t ret_ref = (uint64_t)ret_var.inner;
21744 if (ret_var.is_owned) {
21750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
21751 LDKChannelTransactionParameters this_arg_conv;
21752 this_arg_conv.inner = (void*)(this_arg & (~1));
21753 this_arg_conv.is_owned = false;
21754 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
21758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21759 LDKChannelTransactionParameters this_arg_conv;
21760 this_arg_conv.inner = (void*)(this_arg & (~1));
21761 this_arg_conv.is_owned = false;
21762 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
21763 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21764 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21765 uint64_t ret_ref = (uint64_t)ret_var.inner;
21766 if (ret_var.is_owned) {
21772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21773 LDKChannelTransactionParameters this_arg_conv;
21774 this_arg_conv.inner = (void*)(this_arg & (~1));
21775 this_arg_conv.is_owned = false;
21776 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
21777 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21778 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21779 uint64_t ret_ref = (uint64_t)ret_var.inner;
21780 if (ret_var.is_owned) {
21786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21787 LDKCounterpartyChannelTransactionParameters obj_conv;
21788 obj_conv.inner = (void*)(obj & (~1));
21789 obj_conv.is_owned = false;
21790 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
21791 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21792 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21793 CVec_u8Z_free(ret_var);
21797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21798 LDKu8slice ser_ref;
21799 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21800 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21801 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
21802 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
21803 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21804 return (uint64_t)ret_conv;
21807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21808 LDKChannelTransactionParameters obj_conv;
21809 obj_conv.inner = (void*)(obj & (~1));
21810 obj_conv.is_owned = false;
21811 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
21812 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21813 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21814 CVec_u8Z_free(ret_var);
21818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21819 LDKu8slice ser_ref;
21820 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21821 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21822 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
21823 *ret_conv = ChannelTransactionParameters_read(ser_ref);
21824 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21825 return (uint64_t)ret_conv;
21828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21829 LDKDirectedChannelTransactionParameters this_obj_conv;
21830 this_obj_conv.inner = (void*)(this_obj & (~1));
21831 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21832 DirectedChannelTransactionParameters_free(this_obj_conv);
21835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21836 LDKDirectedChannelTransactionParameters this_arg_conv;
21837 this_arg_conv.inner = (void*)(this_arg & (~1));
21838 this_arg_conv.is_owned = false;
21839 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
21840 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21841 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21842 uint64_t ret_ref = (uint64_t)ret_var.inner;
21843 if (ret_var.is_owned) {
21849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21850 LDKDirectedChannelTransactionParameters this_arg_conv;
21851 this_arg_conv.inner = (void*)(this_arg & (~1));
21852 this_arg_conv.is_owned = false;
21853 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
21854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21856 uint64_t ret_ref = (uint64_t)ret_var.inner;
21857 if (ret_var.is_owned) {
21863 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
21864 LDKDirectedChannelTransactionParameters this_arg_conv;
21865 this_arg_conv.inner = (void*)(this_arg & (~1));
21866 this_arg_conv.is_owned = false;
21867 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
21871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
21872 LDKDirectedChannelTransactionParameters this_arg_conv;
21873 this_arg_conv.inner = (void*)(this_arg & (~1));
21874 this_arg_conv.is_owned = false;
21875 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
21879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
21880 LDKDirectedChannelTransactionParameters this_arg_conv;
21881 this_arg_conv.inner = (void*)(this_arg & (~1));
21882 this_arg_conv.is_owned = false;
21883 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
21884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21886 uint64_t ret_ref = (uint64_t)ret_var.inner;
21887 if (ret_var.is_owned) {
21893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21894 LDKHolderCommitmentTransaction this_obj_conv;
21895 this_obj_conv.inner = (void*)(this_obj & (~1));
21896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21897 HolderCommitmentTransaction_free(this_obj_conv);
21900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
21901 LDKHolderCommitmentTransaction this_ptr_conv;
21902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21903 this_ptr_conv.is_owned = false;
21904 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21905 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
21909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21910 LDKHolderCommitmentTransaction this_ptr_conv;
21911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21912 this_ptr_conv.is_owned = false;
21913 LDKSignature val_ref;
21914 CHECK((*env)->GetArrayLength(env, val) == 64);
21915 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21916 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
21919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
21920 LDKHolderCommitmentTransaction this_ptr_conv;
21921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21922 this_ptr_conv.is_owned = false;
21923 LDKCVec_SignatureZ val_constr;
21924 val_constr.datalen = (*env)->GetArrayLength(env, val);
21925 if (val_constr.datalen > 0)
21926 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21928 val_constr.data = NULL;
21929 for (size_t i = 0; i < val_constr.datalen; i++) {
21930 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
21931 LDKSignature val_conv_8_ref;
21932 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
21933 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
21934 val_constr.data[i] = val_conv_8_ref;
21936 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
21939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21940 LDKHolderCommitmentTransaction orig_conv;
21941 orig_conv.inner = (void*)(orig & (~1));
21942 orig_conv.is_owned = false;
21943 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
21944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21946 uint64_t ret_ref = (uint64_t)ret_var.inner;
21947 if (ret_var.is_owned) {
21953 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
21954 LDKHolderCommitmentTransaction obj_conv;
21955 obj_conv.inner = (void*)(obj & (~1));
21956 obj_conv.is_owned = false;
21957 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
21958 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21959 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21960 CVec_u8Z_free(ret_var);
21964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21965 LDKu8slice ser_ref;
21966 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21967 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21968 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
21969 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
21970 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21971 return (uint64_t)ret_conv;
21974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new(JNIEnv *env, jclass clz, int64_t commitment_tx, int8_tArray counterparty_sig, jobjectArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
21975 LDKCommitmentTransaction commitment_tx_conv;
21976 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
21977 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
21978 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
21979 LDKSignature counterparty_sig_ref;
21980 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
21981 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
21982 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
21983 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
21984 if (counterparty_htlc_sigs_constr.datalen > 0)
21985 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21987 counterparty_htlc_sigs_constr.data = NULL;
21988 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
21989 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
21990 LDKSignature counterparty_htlc_sigs_conv_8_ref;
21991 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
21992 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
21993 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
21995 LDKPublicKey holder_funding_key_ref;
21996 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
21997 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
21998 LDKPublicKey counterparty_funding_key_ref;
21999 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
22000 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
22001 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22004 uint64_t ret_ref = (uint64_t)ret_var.inner;
22005 if (ret_var.is_owned) {
22011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22012 LDKBuiltCommitmentTransaction this_obj_conv;
22013 this_obj_conv.inner = (void*)(this_obj & (~1));
22014 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22015 BuiltCommitmentTransaction_free(this_obj_conv);
22018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
22019 LDKBuiltCommitmentTransaction this_ptr_conv;
22020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22021 this_ptr_conv.is_owned = false;
22022 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22023 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22024 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22025 Transaction_free(ret_var);
22029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22030 LDKBuiltCommitmentTransaction this_ptr_conv;
22031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22032 this_ptr_conv.is_owned = false;
22033 LDKTransaction val_ref;
22034 val_ref.datalen = (*env)->GetArrayLength(env, val);
22035 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22036 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
22037 val_ref.data_is_owned = true;
22038 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22042 LDKBuiltCommitmentTransaction this_ptr_conv;
22043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22044 this_ptr_conv.is_owned = false;
22045 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22046 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
22050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22051 LDKBuiltCommitmentTransaction this_ptr_conv;
22052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22053 this_ptr_conv.is_owned = false;
22054 LDKThirtyTwoBytes val_ref;
22055 CHECK((*env)->GetArrayLength(env, val) == 32);
22056 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22057 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
22061 LDKTransaction transaction_arg_ref;
22062 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
22063 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22064 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
22065 transaction_arg_ref.data_is_owned = true;
22066 LDKThirtyTwoBytes txid_arg_ref;
22067 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
22068 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
22069 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22072 uint64_t ret_ref = (uint64_t)ret_var.inner;
22073 if (ret_var.is_owned) {
22079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22080 LDKBuiltCommitmentTransaction orig_conv;
22081 orig_conv.inner = (void*)(orig & (~1));
22082 orig_conv.is_owned = false;
22083 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22084 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22085 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22086 uint64_t ret_ref = (uint64_t)ret_var.inner;
22087 if (ret_var.is_owned) {
22093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22094 LDKBuiltCommitmentTransaction obj_conv;
22095 obj_conv.inner = (void*)(obj & (~1));
22096 obj_conv.is_owned = false;
22097 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22098 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22099 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22100 CVec_u8Z_free(ret_var);
22104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22105 LDKu8slice ser_ref;
22106 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22107 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22108 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22109 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22110 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22111 return (uint64_t)ret_conv;
22114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22115 LDKBuiltCommitmentTransaction this_arg_conv;
22116 this_arg_conv.inner = (void*)(this_arg & (~1));
22117 this_arg_conv.is_owned = false;
22118 LDKu8slice funding_redeemscript_ref;
22119 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22120 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22121 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22122 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
22123 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
22128 LDKBuiltCommitmentTransaction this_arg_conv;
22129 this_arg_conv.inner = (void*)(this_arg & (~1));
22130 this_arg_conv.is_owned = false;
22131 unsigned char funding_key_arr[32];
22132 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
22133 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
22134 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22135 LDKu8slice funding_redeemscript_ref;
22136 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22137 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22138 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22139 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
22140 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22145 LDKCommitmentTransaction this_obj_conv;
22146 this_obj_conv.inner = (void*)(this_obj & (~1));
22147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22148 CommitmentTransaction_free(this_obj_conv);
22151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22152 LDKCommitmentTransaction orig_conv;
22153 orig_conv.inner = (void*)(orig & (~1));
22154 orig_conv.is_owned = false;
22155 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22158 uint64_t ret_ref = (uint64_t)ret_var.inner;
22159 if (ret_var.is_owned) {
22165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22166 LDKCommitmentTransaction obj_conv;
22167 obj_conv.inner = (void*)(obj & (~1));
22168 obj_conv.is_owned = false;
22169 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22170 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22171 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22172 CVec_u8Z_free(ret_var);
22176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22177 LDKu8slice ser_ref;
22178 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22179 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22180 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22181 *ret_conv = CommitmentTransaction_read(ser_ref);
22182 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22183 return (uint64_t)ret_conv;
22186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
22187 LDKCommitmentTransaction this_arg_conv;
22188 this_arg_conv.inner = (void*)(this_arg & (~1));
22189 this_arg_conv.is_owned = false;
22190 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22195 LDKCommitmentTransaction this_arg_conv;
22196 this_arg_conv.inner = (void*)(this_arg & (~1));
22197 this_arg_conv.is_owned = false;
22198 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22203 LDKCommitmentTransaction this_arg_conv;
22204 this_arg_conv.inner = (void*)(this_arg & (~1));
22205 this_arg_conv.is_owned = false;
22206 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22210 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
22211 LDKCommitmentTransaction this_arg_conv;
22212 this_arg_conv.inner = (void*)(this_arg & (~1));
22213 this_arg_conv.is_owned = false;
22214 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
22219 LDKCommitmentTransaction this_arg_conv;
22220 this_arg_conv.inner = (void*)(this_arg & (~1));
22221 this_arg_conv.is_owned = false;
22222 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22225 uint64_t ret_ref = (uint64_t)ret_var.inner;
22226 if (ret_var.is_owned) {
22232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
22233 LDKCommitmentTransaction this_arg_conv;
22234 this_arg_conv.inner = (void*)(this_arg & (~1));
22235 this_arg_conv.is_owned = false;
22236 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22237 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22238 channel_parameters_conv.is_owned = false;
22239 LDKChannelPublicKeys broadcaster_keys_conv;
22240 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22241 broadcaster_keys_conv.is_owned = false;
22242 LDKChannelPublicKeys countersignatory_keys_conv;
22243 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22244 countersignatory_keys_conv.is_owned = false;
22245 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22246 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22247 return (uint64_t)ret_conv;
22250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22251 LDKTrustedCommitmentTransaction this_obj_conv;
22252 this_obj_conv.inner = (void*)(this_obj & (~1));
22253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22254 TrustedCommitmentTransaction_free(this_obj_conv);
22257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
22258 LDKTrustedCommitmentTransaction this_arg_conv;
22259 this_arg_conv.inner = (void*)(this_arg & (~1));
22260 this_arg_conv.is_owned = false;
22261 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22262 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
22266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
22267 LDKTrustedCommitmentTransaction this_arg_conv;
22268 this_arg_conv.inner = (void*)(this_arg & (~1));
22269 this_arg_conv.is_owned = false;
22270 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22273 uint64_t ret_ref = (uint64_t)ret_var.inner;
22274 if (ret_var.is_owned) {
22280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
22281 LDKTrustedCommitmentTransaction this_arg_conv;
22282 this_arg_conv.inner = (void*)(this_arg & (~1));
22283 this_arg_conv.is_owned = false;
22284 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22285 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22286 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22287 uint64_t ret_ref = (uint64_t)ret_var.inner;
22288 if (ret_var.is_owned) {
22294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters) {
22295 LDKTrustedCommitmentTransaction this_arg_conv;
22296 this_arg_conv.inner = (void*)(this_arg & (~1));
22297 this_arg_conv.is_owned = false;
22298 unsigned char htlc_base_key_arr[32];
22299 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
22300 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
22301 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22302 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22303 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22304 channel_parameters_conv.is_owned = false;
22305 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22306 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22307 return (uint64_t)ret_conv;
22310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1commitment_1transaction_1number_1obscure_1factor(JNIEnv *env, jclass clz, int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
22311 LDKPublicKey broadcaster_payment_basepoint_ref;
22312 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
22313 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
22314 LDKPublicKey countersignatory_payment_basepoint_ref;
22315 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
22316 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
22317 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22322 LDKInitFeatures a_conv;
22323 a_conv.inner = (void*)(a & (~1));
22324 a_conv.is_owned = false;
22325 LDKInitFeatures b_conv;
22326 b_conv.inner = (void*)(b & (~1));
22327 b_conv.is_owned = false;
22328 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22333 LDKNodeFeatures a_conv;
22334 a_conv.inner = (void*)(a & (~1));
22335 a_conv.is_owned = false;
22336 LDKNodeFeatures b_conv;
22337 b_conv.inner = (void*)(b & (~1));
22338 b_conv.is_owned = false;
22339 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22344 LDKChannelFeatures a_conv;
22345 a_conv.inner = (void*)(a & (~1));
22346 a_conv.is_owned = false;
22347 LDKChannelFeatures b_conv;
22348 b_conv.inner = (void*)(b & (~1));
22349 b_conv.is_owned = false;
22350 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22355 LDKInvoiceFeatures a_conv;
22356 a_conv.inner = (void*)(a & (~1));
22357 a_conv.is_owned = false;
22358 LDKInvoiceFeatures b_conv;
22359 b_conv.inner = (void*)(b & (~1));
22360 b_conv.is_owned = false;
22361 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22366 LDKInitFeatures orig_conv;
22367 orig_conv.inner = (void*)(orig & (~1));
22368 orig_conv.is_owned = false;
22369 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22370 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22371 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22372 uint64_t ret_ref = (uint64_t)ret_var.inner;
22373 if (ret_var.is_owned) {
22379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22380 LDKNodeFeatures orig_conv;
22381 orig_conv.inner = (void*)(orig & (~1));
22382 orig_conv.is_owned = false;
22383 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22386 uint64_t ret_ref = (uint64_t)ret_var.inner;
22387 if (ret_var.is_owned) {
22393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22394 LDKChannelFeatures orig_conv;
22395 orig_conv.inner = (void*)(orig & (~1));
22396 orig_conv.is_owned = false;
22397 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22400 uint64_t ret_ref = (uint64_t)ret_var.inner;
22401 if (ret_var.is_owned) {
22407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22408 LDKInvoiceFeatures orig_conv;
22409 orig_conv.inner = (void*)(orig & (~1));
22410 orig_conv.is_owned = false;
22411 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22413 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22414 uint64_t ret_ref = (uint64_t)ret_var.inner;
22415 if (ret_var.is_owned) {
22421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22422 LDKInitFeatures this_obj_conv;
22423 this_obj_conv.inner = (void*)(this_obj & (~1));
22424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22425 InitFeatures_free(this_obj_conv);
22428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22429 LDKNodeFeatures this_obj_conv;
22430 this_obj_conv.inner = (void*)(this_obj & (~1));
22431 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22432 NodeFeatures_free(this_obj_conv);
22435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22436 LDKChannelFeatures this_obj_conv;
22437 this_obj_conv.inner = (void*)(this_obj & (~1));
22438 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22439 ChannelFeatures_free(this_obj_conv);
22442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22443 LDKInvoiceFeatures this_obj_conv;
22444 this_obj_conv.inner = (void*)(this_obj & (~1));
22445 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22446 InvoiceFeatures_free(this_obj_conv);
22449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
22450 LDKInitFeatures ret_var = InitFeatures_empty();
22451 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22452 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22453 uint64_t ret_ref = (uint64_t)ret_var.inner;
22454 if (ret_var.is_owned) {
22460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
22461 LDKInitFeatures ret_var = InitFeatures_known();
22462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22464 uint64_t ret_ref = (uint64_t)ret_var.inner;
22465 if (ret_var.is_owned) {
22471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
22472 LDKNodeFeatures ret_var = NodeFeatures_empty();
22473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22475 uint64_t ret_ref = (uint64_t)ret_var.inner;
22476 if (ret_var.is_owned) {
22482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
22483 LDKNodeFeatures ret_var = NodeFeatures_known();
22484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22486 uint64_t ret_ref = (uint64_t)ret_var.inner;
22487 if (ret_var.is_owned) {
22493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
22494 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22497 uint64_t ret_ref = (uint64_t)ret_var.inner;
22498 if (ret_var.is_owned) {
22504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
22505 LDKChannelFeatures ret_var = ChannelFeatures_known();
22506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22508 uint64_t ret_ref = (uint64_t)ret_var.inner;
22509 if (ret_var.is_owned) {
22515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
22516 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22519 uint64_t ret_ref = (uint64_t)ret_var.inner;
22520 if (ret_var.is_owned) {
22526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
22527 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22528 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22529 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22530 uint64_t ret_ref = (uint64_t)ret_var.inner;
22531 if (ret_var.is_owned) {
22537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22538 LDKInitFeatures this_arg_conv;
22539 this_arg_conv.inner = (void*)(this_arg & (~1));
22540 this_arg_conv.is_owned = false;
22541 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22546 LDKNodeFeatures this_arg_conv;
22547 this_arg_conv.inner = (void*)(this_arg & (~1));
22548 this_arg_conv.is_owned = false;
22549 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22554 LDKInvoiceFeatures this_arg_conv;
22555 this_arg_conv.inner = (void*)(this_arg & (~1));
22556 this_arg_conv.is_owned = false;
22557 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22562 LDKInitFeatures obj_conv;
22563 obj_conv.inner = (void*)(obj & (~1));
22564 obj_conv.is_owned = false;
22565 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22566 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22567 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22568 CVec_u8Z_free(ret_var);
22572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22573 LDKNodeFeatures obj_conv;
22574 obj_conv.inner = (void*)(obj & (~1));
22575 obj_conv.is_owned = false;
22576 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22577 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22578 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22579 CVec_u8Z_free(ret_var);
22583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22584 LDKChannelFeatures obj_conv;
22585 obj_conv.inner = (void*)(obj & (~1));
22586 obj_conv.is_owned = false;
22587 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22588 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22589 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22590 CVec_u8Z_free(ret_var);
22594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22595 LDKInvoiceFeatures obj_conv;
22596 obj_conv.inner = (void*)(obj & (~1));
22597 obj_conv.is_owned = false;
22598 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22599 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22600 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22601 CVec_u8Z_free(ret_var);
22605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22606 LDKu8slice ser_ref;
22607 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22608 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22609 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22610 *ret_conv = InitFeatures_read(ser_ref);
22611 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22612 return (uint64_t)ret_conv;
22615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22616 LDKu8slice ser_ref;
22617 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22618 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22619 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22620 *ret_conv = NodeFeatures_read(ser_ref);
22621 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22622 return (uint64_t)ret_conv;
22625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22626 LDKu8slice ser_ref;
22627 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22628 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22629 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22630 *ret_conv = ChannelFeatures_read(ser_ref);
22631 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22632 return (uint64_t)ret_conv;
22635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22636 LDKu8slice ser_ref;
22637 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22638 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22639 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22640 *ret_conv = InvoiceFeatures_read(ser_ref);
22641 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22642 return (uint64_t)ret_conv;
22645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22646 LDKRouteHop this_obj_conv;
22647 this_obj_conv.inner = (void*)(this_obj & (~1));
22648 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22649 RouteHop_free(this_obj_conv);
22652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22653 LDKRouteHop this_ptr_conv;
22654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22655 this_ptr_conv.is_owned = false;
22656 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22657 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
22661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22662 LDKRouteHop this_ptr_conv;
22663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22664 this_ptr_conv.is_owned = false;
22665 LDKPublicKey val_ref;
22666 CHECK((*env)->GetArrayLength(env, val) == 33);
22667 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22668 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
22671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22672 LDKRouteHop this_ptr_conv;
22673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22674 this_ptr_conv.is_owned = false;
22675 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
22676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22678 uint64_t ret_ref = (uint64_t)ret_var.inner;
22679 if (ret_var.is_owned) {
22685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22686 LDKRouteHop this_ptr_conv;
22687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22688 this_ptr_conv.is_owned = false;
22689 LDKNodeFeatures val_conv;
22690 val_conv.inner = (void*)(val & (~1));
22691 val_conv.is_owned = (val & 1) || (val == 0);
22692 val_conv = NodeFeatures_clone(&val_conv);
22693 RouteHop_set_node_features(&this_ptr_conv, val_conv);
22696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22697 LDKRouteHop this_ptr_conv;
22698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22699 this_ptr_conv.is_owned = false;
22700 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
22704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22705 LDKRouteHop this_ptr_conv;
22706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22707 this_ptr_conv.is_owned = false;
22708 RouteHop_set_short_channel_id(&this_ptr_conv, val);
22711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22712 LDKRouteHop this_ptr_conv;
22713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22714 this_ptr_conv.is_owned = false;
22715 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
22716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22718 uint64_t ret_ref = (uint64_t)ret_var.inner;
22719 if (ret_var.is_owned) {
22725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22726 LDKRouteHop this_ptr_conv;
22727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22728 this_ptr_conv.is_owned = false;
22729 LDKChannelFeatures val_conv;
22730 val_conv.inner = (void*)(val & (~1));
22731 val_conv.is_owned = (val & 1) || (val == 0);
22732 val_conv = ChannelFeatures_clone(&val_conv);
22733 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
22736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22737 LDKRouteHop this_ptr_conv;
22738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22739 this_ptr_conv.is_owned = false;
22740 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
22744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22745 LDKRouteHop this_ptr_conv;
22746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22747 this_ptr_conv.is_owned = false;
22748 RouteHop_set_fee_msat(&this_ptr_conv, val);
22751 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22752 LDKRouteHop this_ptr_conv;
22753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22754 this_ptr_conv.is_owned = false;
22755 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
22759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22760 LDKRouteHop this_ptr_conv;
22761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22762 this_ptr_conv.is_owned = false;
22763 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
22766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
22767 LDKPublicKey pubkey_arg_ref;
22768 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
22769 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
22770 LDKNodeFeatures node_features_arg_conv;
22771 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
22772 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
22773 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
22774 LDKChannelFeatures channel_features_arg_conv;
22775 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
22776 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
22777 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
22778 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);
22779 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22780 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22781 uint64_t ret_ref = (uint64_t)ret_var.inner;
22782 if (ret_var.is_owned) {
22788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22789 LDKRouteHop orig_conv;
22790 orig_conv.inner = (void*)(orig & (~1));
22791 orig_conv.is_owned = false;
22792 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
22793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22795 uint64_t ret_ref = (uint64_t)ret_var.inner;
22796 if (ret_var.is_owned) {
22802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
22803 LDKRouteHop obj_conv;
22804 obj_conv.inner = (void*)(obj & (~1));
22805 obj_conv.is_owned = false;
22806 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
22807 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22808 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22809 CVec_u8Z_free(ret_var);
22813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22814 LDKu8slice ser_ref;
22815 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22816 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22817 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22818 *ret_conv = RouteHop_read(ser_ref);
22819 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22820 return (uint64_t)ret_conv;
22823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22824 LDKRoute this_obj_conv;
22825 this_obj_conv.inner = (void*)(this_obj & (~1));
22826 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22827 Route_free(this_obj_conv);
22830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22831 LDKRoute this_ptr_conv;
22832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22833 this_ptr_conv.is_owned = false;
22834 LDKCVec_CVec_RouteHopZZ val_constr;
22835 val_constr.datalen = (*env)->GetArrayLength(env, val);
22836 if (val_constr.datalen > 0)
22837 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22839 val_constr.data = NULL;
22840 for (size_t m = 0; m < val_constr.datalen; m++) {
22841 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
22842 LDKCVec_RouteHopZ val_conv_12_constr;
22843 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
22844 if (val_conv_12_constr.datalen > 0)
22845 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22847 val_conv_12_constr.data = NULL;
22848 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
22849 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
22850 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
22851 LDKRouteHop val_conv_12_conv_10_conv;
22852 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
22853 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
22854 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
22855 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
22857 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
22858 val_constr.data[m] = val_conv_12_constr;
22860 Route_set_paths(&this_ptr_conv, val_constr);
22863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
22864 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
22865 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
22866 if (paths_arg_constr.datalen > 0)
22867 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22869 paths_arg_constr.data = NULL;
22870 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
22871 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
22872 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
22873 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
22874 if (paths_arg_conv_12_constr.datalen > 0)
22875 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22877 paths_arg_conv_12_constr.data = NULL;
22878 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
22879 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
22880 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
22881 LDKRouteHop paths_arg_conv_12_conv_10_conv;
22882 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
22883 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
22884 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
22885 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
22887 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
22888 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
22890 LDKRoute ret_var = Route_new(paths_arg_constr);
22891 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22892 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22893 uint64_t ret_ref = (uint64_t)ret_var.inner;
22894 if (ret_var.is_owned) {
22900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22901 LDKRoute orig_conv;
22902 orig_conv.inner = (void*)(orig & (~1));
22903 orig_conv.is_owned = false;
22904 LDKRoute ret_var = Route_clone(&orig_conv);
22905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22907 uint64_t ret_ref = (uint64_t)ret_var.inner;
22908 if (ret_var.is_owned) {
22914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
22916 obj_conv.inner = (void*)(obj & (~1));
22917 obj_conv.is_owned = false;
22918 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
22919 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22920 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22921 CVec_u8Z_free(ret_var);
22925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22926 LDKu8slice ser_ref;
22927 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22928 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22929 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22930 *ret_conv = Route_read(ser_ref);
22931 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22932 return (uint64_t)ret_conv;
22935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22936 LDKRouteHint this_obj_conv;
22937 this_obj_conv.inner = (void*)(this_obj & (~1));
22938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22939 RouteHint_free(this_obj_conv);
22942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22943 LDKRouteHint a_conv;
22944 a_conv.inner = (void*)(a & (~1));
22945 a_conv.is_owned = false;
22946 LDKRouteHint b_conv;
22947 b_conv.inner = (void*)(b & (~1));
22948 b_conv.is_owned = false;
22949 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
22953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22954 LDKRouteHint orig_conv;
22955 orig_conv.inner = (void*)(orig & (~1));
22956 orig_conv.is_owned = false;
22957 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
22958 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22959 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22960 uint64_t ret_ref = (uint64_t)ret_var.inner;
22961 if (ret_var.is_owned) {
22967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22968 LDKRouteHintHop this_obj_conv;
22969 this_obj_conv.inner = (void*)(this_obj & (~1));
22970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22971 RouteHintHop_free(this_obj_conv);
22974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22975 LDKRouteHintHop this_ptr_conv;
22976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22977 this_ptr_conv.is_owned = false;
22978 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22979 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
22983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22984 LDKRouteHintHop this_ptr_conv;
22985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22986 this_ptr_conv.is_owned = false;
22987 LDKPublicKey val_ref;
22988 CHECK((*env)->GetArrayLength(env, val) == 33);
22989 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22990 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
22993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22994 LDKRouteHintHop this_ptr_conv;
22995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22996 this_ptr_conv.is_owned = false;
22997 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23002 LDKRouteHintHop this_ptr_conv;
23003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23004 this_ptr_conv.is_owned = false;
23005 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23009 LDKRouteHintHop this_ptr_conv;
23010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23011 this_ptr_conv.is_owned = false;
23012 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23015 uint64_t ret_ref = (uint64_t)ret_var.inner;
23016 if (ret_var.is_owned) {
23022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23023 LDKRouteHintHop this_ptr_conv;
23024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23025 this_ptr_conv.is_owned = false;
23026 LDKRoutingFees val_conv;
23027 val_conv.inner = (void*)(val & (~1));
23028 val_conv.is_owned = (val & 1) || (val == 0);
23029 val_conv = RoutingFees_clone(&val_conv);
23030 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23033 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23034 LDKRouteHintHop this_ptr_conv;
23035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23036 this_ptr_conv.is_owned = false;
23037 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23042 LDKRouteHintHop this_ptr_conv;
23043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23044 this_ptr_conv.is_owned = false;
23045 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23049 LDKRouteHintHop this_ptr_conv;
23050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23051 this_ptr_conv.is_owned = false;
23052 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23053 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23054 uint64_t ret_ref = (uint64_t)ret_copy;
23058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23059 LDKRouteHintHop this_ptr_conv;
23060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23061 this_ptr_conv.is_owned = false;
23062 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23063 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23067 LDKRouteHintHop this_ptr_conv;
23068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23069 this_ptr_conv.is_owned = false;
23070 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23071 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23072 uint64_t ret_ref = (uint64_t)ret_copy;
23076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23077 LDKRouteHintHop this_ptr_conv;
23078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23079 this_ptr_conv.is_owned = false;
23080 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23081 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) {
23085 LDKPublicKey src_node_id_arg_ref;
23086 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
23087 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
23088 LDKRoutingFees fees_arg_conv;
23089 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23090 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23091 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23092 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23093 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23094 LDKRouteHintHop ret_var = RouteHintHop_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);
23095 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23096 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23097 uint64_t ret_ref = (uint64_t)ret_var.inner;
23098 if (ret_var.is_owned) {
23104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23105 LDKRouteHintHop a_conv;
23106 a_conv.inner = (void*)(a & (~1));
23107 a_conv.is_owned = false;
23108 LDKRouteHintHop b_conv;
23109 b_conv.inner = (void*)(b & (~1));
23110 b_conv.is_owned = false;
23111 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23116 LDKRouteHintHop orig_conv;
23117 orig_conv.inner = (void*)(orig & (~1));
23118 orig_conv.is_owned = false;
23119 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23120 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23121 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23122 uint64_t ret_ref = (uint64_t)ret_var.inner;
23123 if (ret_var.is_owned) {
23129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
23130 LDKPublicKey our_node_id_ref;
23131 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23132 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23133 LDKNetworkGraph network_conv;
23134 network_conv.inner = (void*)(network & (~1));
23135 network_conv.is_owned = false;
23136 LDKPublicKey payee_ref;
23137 CHECK((*env)->GetArrayLength(env, payee) == 33);
23138 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
23139 LDKInvoiceFeatures payee_features_conv;
23140 payee_features_conv.inner = (void*)(payee_features & (~1));
23141 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23142 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23143 LDKCVec_ChannelDetailsZ first_hops_constr;
23144 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
23145 if (first_hops_constr.datalen > 0)
23146 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23148 first_hops_constr.data = NULL;
23149 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
23150 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23151 int64_t first_hops_conv_16 = first_hops_vals[q];
23152 LDKChannelDetails first_hops_conv_16_conv;
23153 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23154 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23155 first_hops_constr.data[q] = first_hops_conv_16_conv;
23157 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
23158 LDKCVec_RouteHintZ last_hops_constr;
23159 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
23160 if (last_hops_constr.datalen > 0)
23161 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23163 last_hops_constr.data = NULL;
23164 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
23165 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23166 int64_t last_hops_conv_11 = last_hops_vals[l];
23167 LDKRouteHint last_hops_conv_11_conv;
23168 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23169 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23170 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23171 last_hops_constr.data[l] = last_hops_conv_11_conv;
23173 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
23174 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23175 if (logger_conv.free == LDKLogger_JCalls_free) {
23176 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23177 LDKLogger_JCalls_clone(logger_conv.this_arg);
23179 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23180 *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);
23181 FREE(first_hops_constr.data);
23182 return (uint64_t)ret_conv;
23185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23186 LDKNetworkGraph this_obj_conv;
23187 this_obj_conv.inner = (void*)(this_obj & (~1));
23188 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23189 NetworkGraph_free(this_obj_conv);
23192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23193 LDKNetworkGraph orig_conv;
23194 orig_conv.inner = (void*)(orig & (~1));
23195 orig_conv.is_owned = false;
23196 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
23197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23199 uint64_t ret_ref = (uint64_t)ret_var.inner;
23200 if (ret_var.is_owned) {
23206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23207 LDKLockedNetworkGraph this_obj_conv;
23208 this_obj_conv.inner = (void*)(this_obj & (~1));
23209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23210 LockedNetworkGraph_free(this_obj_conv);
23213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23214 LDKNetGraphMsgHandler this_obj_conv;
23215 this_obj_conv.inner = (void*)(this_obj & (~1));
23216 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23217 NetGraphMsgHandler_free(this_obj_conv);
23220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
23221 LDKThirtyTwoBytes genesis_hash_ref;
23222 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
23223 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
23224 LDKAccess *chain_access_conv_ptr = NULL;
23225 if (chain_access != 0) {
23226 LDKAccess chain_access_conv;
23227 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23228 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23229 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23230 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23232 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23233 *chain_access_conv_ptr = chain_access_conv;
23235 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23236 if (logger_conv.free == LDKLogger_JCalls_free) {
23237 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23238 LDKLogger_JCalls_clone(logger_conv.this_arg);
23240 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
23241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23243 uint64_t ret_ref = (uint64_t)ret_var.inner;
23244 if (ret_var.is_owned) {
23250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
23251 LDKAccess *chain_access_conv_ptr = NULL;
23252 if (chain_access != 0) {
23253 LDKAccess chain_access_conv;
23254 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23255 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23256 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23257 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23259 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23260 *chain_access_conv_ptr = chain_access_conv;
23262 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23263 if (logger_conv.free == LDKLogger_JCalls_free) {
23264 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23265 LDKLogger_JCalls_clone(logger_conv.this_arg);
23267 LDKNetworkGraph network_graph_conv;
23268 network_graph_conv.inner = (void*)(network_graph & (~1));
23269 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23270 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
23271 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
23272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23274 uint64_t ret_ref = (uint64_t)ret_var.inner;
23275 if (ret_var.is_owned) {
23281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
23282 LDKNetGraphMsgHandler this_arg_conv;
23283 this_arg_conv.inner = (void*)(this_arg & (~1));
23284 this_arg_conv.is_owned = false;
23285 LDKAccess *chain_access_conv_ptr = NULL;
23286 if (chain_access != 0) {
23287 LDKAccess chain_access_conv;
23288 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23289 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23291 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23293 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23294 *chain_access_conv_ptr = chain_access_conv;
23296 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
23299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23300 LDKNetGraphMsgHandler this_arg_conv;
23301 this_arg_conv.inner = (void*)(this_arg & (~1));
23302 this_arg_conv.is_owned = false;
23303 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
23304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23306 uint64_t ret_ref = (uint64_t)ret_var.inner;
23307 if (ret_var.is_owned) {
23313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23314 LDKLockedNetworkGraph this_arg_conv;
23315 this_arg_conv.inner = (void*)(this_arg & (~1));
23316 this_arg_conv.is_owned = false;
23317 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
23318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23320 uint64_t ret_ref = (uint64_t)ret_var.inner;
23321 if (ret_var.is_owned) {
23327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23328 LDKNetGraphMsgHandler this_arg_conv;
23329 this_arg_conv.inner = (void*)(this_arg & (~1));
23330 this_arg_conv.is_owned = false;
23331 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23332 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23333 return (uint64_t)ret;
23336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23337 LDKNetGraphMsgHandler this_arg_conv;
23338 this_arg_conv.inner = (void*)(this_arg & (~1));
23339 this_arg_conv.is_owned = false;
23340 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23341 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23342 return (uint64_t)ret;
23345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23346 LDKDirectionalChannelInfo this_obj_conv;
23347 this_obj_conv.inner = (void*)(this_obj & (~1));
23348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23349 DirectionalChannelInfo_free(this_obj_conv);
23352 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23353 LDKDirectionalChannelInfo this_ptr_conv;
23354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23355 this_ptr_conv.is_owned = false;
23356 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23361 LDKDirectionalChannelInfo this_ptr_conv;
23362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23363 this_ptr_conv.is_owned = false;
23364 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
23367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
23368 LDKDirectionalChannelInfo this_ptr_conv;
23369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23370 this_ptr_conv.is_owned = false;
23371 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
23375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23376 LDKDirectionalChannelInfo this_ptr_conv;
23377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23378 this_ptr_conv.is_owned = false;
23379 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
23382 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23383 LDKDirectionalChannelInfo this_ptr_conv;
23384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23385 this_ptr_conv.is_owned = false;
23386 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
23390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23391 LDKDirectionalChannelInfo this_ptr_conv;
23392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23393 this_ptr_conv.is_owned = false;
23394 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23398 LDKDirectionalChannelInfo this_ptr_conv;
23399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23400 this_ptr_conv.is_owned = false;
23401 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
23405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23406 LDKDirectionalChannelInfo this_ptr_conv;
23407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23408 this_ptr_conv.is_owned = false;
23409 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
23412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23413 LDKDirectionalChannelInfo this_ptr_conv;
23414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23415 this_ptr_conv.is_owned = false;
23416 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23417 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
23418 uint64_t ret_ref = (uint64_t)ret_copy;
23422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23423 LDKDirectionalChannelInfo this_ptr_conv;
23424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23425 this_ptr_conv.is_owned = false;
23426 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23427 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23431 LDKDirectionalChannelInfo this_ptr_conv;
23432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23433 this_ptr_conv.is_owned = false;
23434 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
23435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23437 uint64_t ret_ref = (uint64_t)ret_var.inner;
23438 if (ret_var.is_owned) {
23444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23445 LDKDirectionalChannelInfo this_ptr_conv;
23446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23447 this_ptr_conv.is_owned = false;
23448 LDKRoutingFees val_conv;
23449 val_conv.inner = (void*)(val & (~1));
23450 val_conv.is_owned = (val & 1) || (val == 0);
23451 val_conv = RoutingFees_clone(&val_conv);
23452 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
23455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23456 LDKDirectionalChannelInfo this_ptr_conv;
23457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23458 this_ptr_conv.is_owned = false;
23459 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
23460 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23461 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23462 uint64_t ret_ref = (uint64_t)ret_var.inner;
23463 if (ret_var.is_owned) {
23469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23470 LDKDirectionalChannelInfo this_ptr_conv;
23471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23472 this_ptr_conv.is_owned = false;
23473 LDKChannelUpdate val_conv;
23474 val_conv.inner = (void*)(val & (~1));
23475 val_conv.is_owned = (val & 1) || (val == 0);
23476 val_conv = ChannelUpdate_clone(&val_conv);
23477 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
23480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
23481 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23482 LDKRoutingFees fees_arg_conv;
23483 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23484 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23485 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23486 LDKChannelUpdate last_update_message_arg_conv;
23487 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
23488 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
23489 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
23490 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);
23491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23493 uint64_t ret_ref = (uint64_t)ret_var.inner;
23494 if (ret_var.is_owned) {
23500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23501 LDKDirectionalChannelInfo orig_conv;
23502 orig_conv.inner = (void*)(orig & (~1));
23503 orig_conv.is_owned = false;
23504 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
23505 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23506 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23507 uint64_t ret_ref = (uint64_t)ret_var.inner;
23508 if (ret_var.is_owned) {
23514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23515 LDKDirectionalChannelInfo obj_conv;
23516 obj_conv.inner = (void*)(obj & (~1));
23517 obj_conv.is_owned = false;
23518 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
23519 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23520 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23521 CVec_u8Z_free(ret_var);
23525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23526 LDKu8slice ser_ref;
23527 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23528 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23529 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
23530 *ret_conv = DirectionalChannelInfo_read(ser_ref);
23531 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23532 return (uint64_t)ret_conv;
23535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23536 LDKChannelInfo this_obj_conv;
23537 this_obj_conv.inner = (void*)(this_obj & (~1));
23538 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23539 ChannelInfo_free(this_obj_conv);
23542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23543 LDKChannelInfo this_ptr_conv;
23544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23545 this_ptr_conv.is_owned = false;
23546 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
23547 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23548 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23549 uint64_t ret_ref = (uint64_t)ret_var.inner;
23550 if (ret_var.is_owned) {
23556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23557 LDKChannelInfo this_ptr_conv;
23558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23559 this_ptr_conv.is_owned = false;
23560 LDKChannelFeatures val_conv;
23561 val_conv.inner = (void*)(val & (~1));
23562 val_conv.is_owned = (val & 1) || (val == 0);
23563 val_conv = ChannelFeatures_clone(&val_conv);
23564 ChannelInfo_set_features(&this_ptr_conv, val_conv);
23567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23568 LDKChannelInfo this_ptr_conv;
23569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23570 this_ptr_conv.is_owned = false;
23571 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23572 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
23576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23577 LDKChannelInfo this_ptr_conv;
23578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23579 this_ptr_conv.is_owned = false;
23580 LDKPublicKey val_ref;
23581 CHECK((*env)->GetArrayLength(env, val) == 33);
23582 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23583 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
23586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23587 LDKChannelInfo this_ptr_conv;
23588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23589 this_ptr_conv.is_owned = false;
23590 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
23591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23593 uint64_t ret_ref = (uint64_t)ret_var.inner;
23594 if (ret_var.is_owned) {
23600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23601 LDKChannelInfo this_ptr_conv;
23602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23603 this_ptr_conv.is_owned = false;
23604 LDKDirectionalChannelInfo val_conv;
23605 val_conv.inner = (void*)(val & (~1));
23606 val_conv.is_owned = (val & 1) || (val == 0);
23607 val_conv = DirectionalChannelInfo_clone(&val_conv);
23608 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
23611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23612 LDKChannelInfo this_ptr_conv;
23613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23614 this_ptr_conv.is_owned = false;
23615 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23616 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
23620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23621 LDKChannelInfo this_ptr_conv;
23622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23623 this_ptr_conv.is_owned = false;
23624 LDKPublicKey val_ref;
23625 CHECK((*env)->GetArrayLength(env, val) == 33);
23626 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23627 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
23630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23631 LDKChannelInfo this_ptr_conv;
23632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23633 this_ptr_conv.is_owned = false;
23634 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
23635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23637 uint64_t ret_ref = (uint64_t)ret_var.inner;
23638 if (ret_var.is_owned) {
23644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23645 LDKChannelInfo this_ptr_conv;
23646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23647 this_ptr_conv.is_owned = false;
23648 LDKDirectionalChannelInfo val_conv;
23649 val_conv.inner = (void*)(val & (~1));
23650 val_conv.is_owned = (val & 1) || (val == 0);
23651 val_conv = DirectionalChannelInfo_clone(&val_conv);
23652 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
23655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
23656 LDKChannelInfo this_ptr_conv;
23657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23658 this_ptr_conv.is_owned = false;
23659 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23660 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
23661 uint64_t ret_ref = (uint64_t)ret_copy;
23665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23666 LDKChannelInfo this_ptr_conv;
23667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23668 this_ptr_conv.is_owned = false;
23669 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23670 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
23673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23674 LDKChannelInfo this_ptr_conv;
23675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23676 this_ptr_conv.is_owned = false;
23677 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
23678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23680 uint64_t ret_ref = (uint64_t)ret_var.inner;
23681 if (ret_var.is_owned) {
23687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23688 LDKChannelInfo this_ptr_conv;
23689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23690 this_ptr_conv.is_owned = false;
23691 LDKChannelAnnouncement val_conv;
23692 val_conv.inner = (void*)(val & (~1));
23693 val_conv.is_owned = (val & 1) || (val == 0);
23694 val_conv = ChannelAnnouncement_clone(&val_conv);
23695 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
23698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray node_one_arg, int64_t one_to_two_arg, int8_tArray node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) {
23699 LDKChannelFeatures features_arg_conv;
23700 features_arg_conv.inner = (void*)(features_arg & (~1));
23701 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23702 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
23703 LDKPublicKey node_one_arg_ref;
23704 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
23705 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
23706 LDKDirectionalChannelInfo one_to_two_arg_conv;
23707 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
23708 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
23709 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
23710 LDKPublicKey node_two_arg_ref;
23711 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
23712 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
23713 LDKDirectionalChannelInfo two_to_one_arg_conv;
23714 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
23715 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
23716 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
23717 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
23718 LDKChannelAnnouncement announcement_message_arg_conv;
23719 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
23720 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
23721 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
23722 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);
23723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23725 uint64_t ret_ref = (uint64_t)ret_var.inner;
23726 if (ret_var.is_owned) {
23732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23733 LDKChannelInfo orig_conv;
23734 orig_conv.inner = (void*)(orig & (~1));
23735 orig_conv.is_owned = false;
23736 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
23737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23739 uint64_t ret_ref = (uint64_t)ret_var.inner;
23740 if (ret_var.is_owned) {
23746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23747 LDKChannelInfo obj_conv;
23748 obj_conv.inner = (void*)(obj & (~1));
23749 obj_conv.is_owned = false;
23750 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
23751 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23752 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23753 CVec_u8Z_free(ret_var);
23757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23758 LDKu8slice ser_ref;
23759 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23760 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23761 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23762 *ret_conv = ChannelInfo_read(ser_ref);
23763 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23764 return (uint64_t)ret_conv;
23767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23768 LDKRoutingFees this_obj_conv;
23769 this_obj_conv.inner = (void*)(this_obj & (~1));
23770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23771 RoutingFees_free(this_obj_conv);
23774 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23775 LDKRoutingFees this_ptr_conv;
23776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23777 this_ptr_conv.is_owned = false;
23778 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
23782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23783 LDKRoutingFees this_ptr_conv;
23784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23785 this_ptr_conv.is_owned = false;
23786 RoutingFees_set_base_msat(&this_ptr_conv, val);
23789 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
23790 LDKRoutingFees this_ptr_conv;
23791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23792 this_ptr_conv.is_owned = false;
23793 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
23797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23798 LDKRoutingFees this_ptr_conv;
23799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23800 this_ptr_conv.is_owned = false;
23801 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
23804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv *env, jclass clz, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
23805 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
23806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23808 uint64_t ret_ref = (uint64_t)ret_var.inner;
23809 if (ret_var.is_owned) {
23815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23816 LDKRoutingFees a_conv;
23817 a_conv.inner = (void*)(a & (~1));
23818 a_conv.is_owned = false;
23819 LDKRoutingFees b_conv;
23820 b_conv.inner = (void*)(b & (~1));
23821 b_conv.is_owned = false;
23822 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
23826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23827 LDKRoutingFees orig_conv;
23828 orig_conv.inner = (void*)(orig & (~1));
23829 orig_conv.is_owned = false;
23830 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
23831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23833 uint64_t ret_ref = (uint64_t)ret_var.inner;
23834 if (ret_var.is_owned) {
23840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
23841 LDKRoutingFees obj_conv;
23842 obj_conv.inner = (void*)(obj & (~1));
23843 obj_conv.is_owned = false;
23844 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
23845 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23846 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23847 CVec_u8Z_free(ret_var);
23851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23852 LDKu8slice ser_ref;
23853 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23854 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23855 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23856 *ret_conv = RoutingFees_read(ser_ref);
23857 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23858 return (uint64_t)ret_conv;
23861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23862 LDKNodeAnnouncementInfo this_obj_conv;
23863 this_obj_conv.inner = (void*)(this_obj & (~1));
23864 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23865 NodeAnnouncementInfo_free(this_obj_conv);
23868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23869 LDKNodeAnnouncementInfo this_ptr_conv;
23870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23871 this_ptr_conv.is_owned = false;
23872 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
23873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23875 uint64_t ret_ref = (uint64_t)ret_var.inner;
23876 if (ret_var.is_owned) {
23882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23883 LDKNodeAnnouncementInfo this_ptr_conv;
23884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23885 this_ptr_conv.is_owned = false;
23886 LDKNodeFeatures val_conv;
23887 val_conv.inner = (void*)(val & (~1));
23888 val_conv.is_owned = (val & 1) || (val == 0);
23889 val_conv = NodeFeatures_clone(&val_conv);
23890 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
23893 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23894 LDKNodeAnnouncementInfo this_ptr_conv;
23895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23896 this_ptr_conv.is_owned = false;
23897 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
23901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23902 LDKNodeAnnouncementInfo this_ptr_conv;
23903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23904 this_ptr_conv.is_owned = false;
23905 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
23908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
23909 LDKNodeAnnouncementInfo this_ptr_conv;
23910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23911 this_ptr_conv.is_owned = false;
23912 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
23913 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
23917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23918 LDKNodeAnnouncementInfo this_ptr_conv;
23919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23920 this_ptr_conv.is_owned = false;
23921 LDKThreeBytes val_ref;
23922 CHECK((*env)->GetArrayLength(env, val) == 3);
23923 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
23924 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
23927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
23928 LDKNodeAnnouncementInfo this_ptr_conv;
23929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23930 this_ptr_conv.is_owned = false;
23931 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23932 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
23936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23937 LDKNodeAnnouncementInfo this_ptr_conv;
23938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23939 this_ptr_conv.is_owned = false;
23940 LDKThirtyTwoBytes val_ref;
23941 CHECK((*env)->GetArrayLength(env, val) == 32);
23942 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23943 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
23946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23947 LDKNodeAnnouncementInfo this_ptr_conv;
23948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23949 this_ptr_conv.is_owned = false;
23950 LDKCVec_NetAddressZ val_constr;
23951 val_constr.datalen = (*env)->GetArrayLength(env, val);
23952 if (val_constr.datalen > 0)
23953 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23955 val_constr.data = NULL;
23956 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23957 for (size_t m = 0; m < val_constr.datalen; m++) {
23958 int64_t val_conv_12 = val_vals[m];
23959 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
23960 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
23961 val_constr.data[m] = val_conv_12_conv;
23963 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23964 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
23967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23968 LDKNodeAnnouncementInfo this_ptr_conv;
23969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23970 this_ptr_conv.is_owned = false;
23971 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
23972 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23973 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23974 uint64_t ret_ref = (uint64_t)ret_var.inner;
23975 if (ret_var.is_owned) {
23981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23982 LDKNodeAnnouncementInfo this_ptr_conv;
23983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23984 this_ptr_conv.is_owned = false;
23985 LDKNodeAnnouncement val_conv;
23986 val_conv.inner = (void*)(val & (~1));
23987 val_conv.is_owned = (val & 1) || (val == 0);
23988 val_conv = NodeAnnouncement_clone(&val_conv);
23989 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
23992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
23993 LDKNodeFeatures features_arg_conv;
23994 features_arg_conv.inner = (void*)(features_arg & (~1));
23995 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23996 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
23997 LDKThreeBytes rgb_arg_ref;
23998 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
23999 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
24000 LDKThirtyTwoBytes alias_arg_ref;
24001 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
24002 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
24003 LDKCVec_NetAddressZ addresses_arg_constr;
24004 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
24005 if (addresses_arg_constr.datalen > 0)
24006 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24008 addresses_arg_constr.data = NULL;
24009 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
24010 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24011 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
24012 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24013 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24015 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
24016 LDKNodeAnnouncement announcement_message_arg_conv;
24017 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24018 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24019 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24020 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24023 uint64_t ret_ref = (uint64_t)ret_var.inner;
24024 if (ret_var.is_owned) {
24030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24031 LDKNodeAnnouncementInfo orig_conv;
24032 orig_conv.inner = (void*)(orig & (~1));
24033 orig_conv.is_owned = false;
24034 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24035 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24036 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24037 uint64_t ret_ref = (uint64_t)ret_var.inner;
24038 if (ret_var.is_owned) {
24044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24045 LDKNodeAnnouncementInfo obj_conv;
24046 obj_conv.inner = (void*)(obj & (~1));
24047 obj_conv.is_owned = false;
24048 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24049 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24050 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24051 CVec_u8Z_free(ret_var);
24055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24056 LDKu8slice ser_ref;
24057 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24058 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24059 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24060 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24061 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24062 return (uint64_t)ret_conv;
24065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24066 LDKNodeInfo this_obj_conv;
24067 this_obj_conv.inner = (void*)(this_obj & (~1));
24068 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24069 NodeInfo_free(this_obj_conv);
24072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24073 LDKNodeInfo this_ptr_conv;
24074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24075 this_ptr_conv.is_owned = false;
24076 LDKCVec_u64Z val_constr;
24077 val_constr.datalen = (*env)->GetArrayLength(env, val);
24078 if (val_constr.datalen > 0)
24079 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24081 val_constr.data = NULL;
24082 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24083 for (size_t g = 0; g < val_constr.datalen; g++) {
24084 int64_t val_conv_6 = val_vals[g];
24085 val_constr.data[g] = val_conv_6;
24087 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24088 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24092 LDKNodeInfo this_ptr_conv;
24093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24094 this_ptr_conv.is_owned = false;
24095 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24098 uint64_t ret_ref = (uint64_t)ret_var.inner;
24099 if (ret_var.is_owned) {
24105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24106 LDKNodeInfo this_ptr_conv;
24107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24108 this_ptr_conv.is_owned = false;
24109 LDKRoutingFees val_conv;
24110 val_conv.inner = (void*)(val & (~1));
24111 val_conv.is_owned = (val & 1) || (val == 0);
24112 val_conv = RoutingFees_clone(&val_conv);
24113 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24117 LDKNodeInfo this_ptr_conv;
24118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24119 this_ptr_conv.is_owned = false;
24120 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24121 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24122 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24123 uint64_t ret_ref = (uint64_t)ret_var.inner;
24124 if (ret_var.is_owned) {
24130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24131 LDKNodeInfo this_ptr_conv;
24132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24133 this_ptr_conv.is_owned = false;
24134 LDKNodeAnnouncementInfo val_conv;
24135 val_conv.inner = (void*)(val & (~1));
24136 val_conv.is_owned = (val & 1) || (val == 0);
24137 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24138 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t lowest_inbound_channel_fees_arg, int64_t announcement_info_arg) {
24142 LDKCVec_u64Z channels_arg_constr;
24143 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
24144 if (channels_arg_constr.datalen > 0)
24145 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24147 channels_arg_constr.data = NULL;
24148 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
24149 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
24150 int64_t channels_arg_conv_6 = channels_arg_vals[g];
24151 channels_arg_constr.data[g] = channels_arg_conv_6;
24153 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
24154 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24155 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24156 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24157 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24158 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24159 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24160 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24161 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24162 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24163 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24164 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24165 uint64_t ret_ref = (uint64_t)ret_var.inner;
24166 if (ret_var.is_owned) {
24172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24173 LDKNodeInfo orig_conv;
24174 orig_conv.inner = (void*)(orig & (~1));
24175 orig_conv.is_owned = false;
24176 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24179 uint64_t ret_ref = (uint64_t)ret_var.inner;
24180 if (ret_var.is_owned) {
24186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24187 LDKNodeInfo obj_conv;
24188 obj_conv.inner = (void*)(obj & (~1));
24189 obj_conv.is_owned = false;
24190 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24191 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24192 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24193 CVec_u8Z_free(ret_var);
24197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24198 LDKu8slice ser_ref;
24199 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24200 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24201 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24202 *ret_conv = NodeInfo_read(ser_ref);
24203 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24204 return (uint64_t)ret_conv;
24207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
24208 LDKNetworkGraph obj_conv;
24209 obj_conv.inner = (void*)(obj & (~1));
24210 obj_conv.is_owned = false;
24211 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24212 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24213 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24214 CVec_u8Z_free(ret_var);
24218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24219 LDKu8slice ser_ref;
24220 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24221 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24222 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24223 *ret_conv = NetworkGraph_read(ser_ref);
24224 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24225 return (uint64_t)ret_conv;
24228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
24229 LDKThirtyTwoBytes genesis_hash_ref;
24230 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
24231 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
24232 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24235 uint64_t ret_ref = (uint64_t)ret_var.inner;
24236 if (ret_var.is_owned) {
24242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24243 LDKNetworkGraph this_arg_conv;
24244 this_arg_conv.inner = (void*)(this_arg & (~1));
24245 this_arg_conv.is_owned = false;
24246 LDKNodeAnnouncement msg_conv;
24247 msg_conv.inner = (void*)(msg & (~1));
24248 msg_conv.is_owned = false;
24249 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24250 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24251 return (uint64_t)ret_conv;
24254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24255 LDKNetworkGraph this_arg_conv;
24256 this_arg_conv.inner = (void*)(this_arg & (~1));
24257 this_arg_conv.is_owned = false;
24258 LDKUnsignedNodeAnnouncement msg_conv;
24259 msg_conv.inner = (void*)(msg & (~1));
24260 msg_conv.is_owned = false;
24261 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24262 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24263 return (uint64_t)ret_conv;
24266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
24267 LDKNetworkGraph this_arg_conv;
24268 this_arg_conv.inner = (void*)(this_arg & (~1));
24269 this_arg_conv.is_owned = false;
24270 LDKChannelAnnouncement msg_conv;
24271 msg_conv.inner = (void*)(msg & (~1));
24272 msg_conv.is_owned = false;
24273 LDKAccess *chain_access_conv_ptr = NULL;
24274 if (chain_access != 0) {
24275 LDKAccess chain_access_conv;
24276 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24277 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24278 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24279 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24281 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24282 *chain_access_conv_ptr = chain_access_conv;
24284 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24285 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24286 return (uint64_t)ret_conv;
24289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
24290 LDKNetworkGraph this_arg_conv;
24291 this_arg_conv.inner = (void*)(this_arg & (~1));
24292 this_arg_conv.is_owned = false;
24293 LDKUnsignedChannelAnnouncement msg_conv;
24294 msg_conv.inner = (void*)(msg & (~1));
24295 msg_conv.is_owned = false;
24296 LDKAccess *chain_access_conv_ptr = NULL;
24297 if (chain_access != 0) {
24298 LDKAccess chain_access_conv;
24299 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24300 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24301 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24302 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24304 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24305 *chain_access_conv_ptr = chain_access_conv;
24307 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24308 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24309 return (uint64_t)ret_conv;
24312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
24313 LDKNetworkGraph this_arg_conv;
24314 this_arg_conv.inner = (void*)(this_arg & (~1));
24315 this_arg_conv.is_owned = false;
24316 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24320 LDKNetworkGraph this_arg_conv;
24321 this_arg_conv.inner = (void*)(this_arg & (~1));
24322 this_arg_conv.is_owned = false;
24323 LDKChannelUpdate msg_conv;
24324 msg_conv.inner = (void*)(msg & (~1));
24325 msg_conv.is_owned = false;
24326 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24327 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24328 return (uint64_t)ret_conv;
24331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24332 LDKNetworkGraph this_arg_conv;
24333 this_arg_conv.inner = (void*)(this_arg & (~1));
24334 this_arg_conv.is_owned = false;
24335 LDKUnsignedChannelUpdate msg_conv;
24336 msg_conv.inner = (void*)(msg & (~1));
24337 msg_conv.is_owned = false;
24338 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24339 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24340 return (uint64_t)ret_conv;
24343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24344 LDKFilesystemPersister this_obj_conv;
24345 this_obj_conv.inner = (void*)(this_obj & (~1));
24346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24347 FilesystemPersister_free(this_obj_conv);
24350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
24351 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
24352 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
24353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24355 uint64_t ret_ref = (uint64_t)ret_var.inner;
24356 if (ret_var.is_owned) {
24362 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
24363 LDKFilesystemPersister this_arg_conv;
24364 this_arg_conv.inner = (void*)(this_arg & (~1));
24365 this_arg_conv.is_owned = false;
24366 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
24367 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
24372 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
24373 LDKChannelManager manager_conv;
24374 manager_conv.inner = (void*)(manager & (~1));
24375 manager_conv.is_owned = false;
24376 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24377 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
24378 return (uint64_t)ret_conv;
24381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
24382 LDKFilesystemPersister this_arg_conv;
24383 this_arg_conv.inner = (void*)(this_arg & (~1));
24384 this_arg_conv.is_owned = false;
24385 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24386 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
24387 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24388 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
24390 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
24391 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
24392 return (uint64_t)ret_conv;
24395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
24396 LDKFilesystemPersister this_arg_conv;
24397 this_arg_conv.inner = (void*)(this_arg & (~1));
24398 this_arg_conv.is_owned = false;
24399 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
24400 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
24401 return (uint64_t)ret;
24404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24405 LDKBackgroundProcessor this_obj_conv;
24406 this_obj_conv.inner = (void*)(this_obj & (~1));
24407 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24408 BackgroundProcessor_free(this_obj_conv);
24411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24412 if ((this_ptr & 1) != 0) return;
24413 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
24414 FREE((void*)this_ptr);
24415 ChannelManagerPersister_free(this_ptr_conv);
24418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t peer_manager, int64_t logger) {
24419 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
24420 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
24421 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24422 LDKChannelManagerPersister_JCalls_clone(persister_conv.this_arg);
24424 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
24425 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
24426 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24427 LDKEventHandler_JCalls_clone(event_handler_conv.this_arg);
24429 LDKChainMonitor chain_monitor_conv;
24430 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
24431 chain_monitor_conv.is_owned = false;
24432 LDKChannelManager channel_manager_conv;
24433 channel_manager_conv.inner = (void*)(channel_manager & (~1));
24434 channel_manager_conv.is_owned = false;
24435 LDKPeerManager peer_manager_conv;
24436 peer_manager_conv.inner = (void*)(peer_manager & (~1));
24437 peer_manager_conv.is_owned = false;
24438 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24439 if (logger_conv.free == LDKLogger_JCalls_free) {
24440 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24441 LDKLogger_JCalls_clone(logger_conv.this_arg);
24443 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
24444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24446 uint64_t ret_ref = (uint64_t)ret_var.inner;
24447 if (ret_var.is_owned) {
24453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
24454 LDKBackgroundProcessor this_arg_conv;
24455 this_arg_conv.inner = (void*)(this_arg & (~1));
24456 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24457 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
24458 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24459 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
24460 return (uint64_t)ret_conv;
24463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
24467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24468 LDKInvoice this_obj_conv;
24469 this_obj_conv.inner = (void*)(this_obj & (~1));
24470 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24471 Invoice_free(this_obj_conv);
24474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24476 a_conv.inner = (void*)(a & (~1));
24477 a_conv.is_owned = false;
24479 b_conv.inner = (void*)(b & (~1));
24480 b_conv.is_owned = false;
24481 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
24485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24486 LDKInvoice orig_conv;
24487 orig_conv.inner = (void*)(orig & (~1));
24488 orig_conv.is_owned = false;
24489 LDKInvoice ret_var = Invoice_clone(&orig_conv);
24490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24492 uint64_t ret_ref = (uint64_t)ret_var.inner;
24493 if (ret_var.is_owned) {
24499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24500 LDKSignedRawInvoice this_obj_conv;
24501 this_obj_conv.inner = (void*)(this_obj & (~1));
24502 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24503 SignedRawInvoice_free(this_obj_conv);
24506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24507 LDKSignedRawInvoice a_conv;
24508 a_conv.inner = (void*)(a & (~1));
24509 a_conv.is_owned = false;
24510 LDKSignedRawInvoice b_conv;
24511 b_conv.inner = (void*)(b & (~1));
24512 b_conv.is_owned = false;
24513 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
24517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24518 LDKSignedRawInvoice orig_conv;
24519 orig_conv.inner = (void*)(orig & (~1));
24520 orig_conv.is_owned = false;
24521 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
24522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24524 uint64_t ret_ref = (uint64_t)ret_var.inner;
24525 if (ret_var.is_owned) {
24531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24532 LDKRawInvoice this_obj_conv;
24533 this_obj_conv.inner = (void*)(this_obj & (~1));
24534 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24535 RawInvoice_free(this_obj_conv);
24538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
24539 LDKRawInvoice this_ptr_conv;
24540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24541 this_ptr_conv.is_owned = false;
24542 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
24543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24545 uint64_t ret_ref = (uint64_t)ret_var.inner;
24546 if (ret_var.is_owned) {
24552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24553 LDKRawInvoice this_ptr_conv;
24554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24555 this_ptr_conv.is_owned = false;
24556 LDKRawDataPart val_conv;
24557 val_conv.inner = (void*)(val & (~1));
24558 val_conv.is_owned = (val & 1) || (val == 0);
24559 val_conv = RawDataPart_clone(&val_conv);
24560 RawInvoice_set_data(&this_ptr_conv, val_conv);
24563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24564 LDKRawInvoice a_conv;
24565 a_conv.inner = (void*)(a & (~1));
24566 a_conv.is_owned = false;
24567 LDKRawInvoice b_conv;
24568 b_conv.inner = (void*)(b & (~1));
24569 b_conv.is_owned = false;
24570 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
24574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24575 LDKRawInvoice orig_conv;
24576 orig_conv.inner = (void*)(orig & (~1));
24577 orig_conv.is_owned = false;
24578 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
24579 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24580 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24581 uint64_t ret_ref = (uint64_t)ret_var.inner;
24582 if (ret_var.is_owned) {
24588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24589 LDKRawDataPart this_obj_conv;
24590 this_obj_conv.inner = (void*)(this_obj & (~1));
24591 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24592 RawDataPart_free(this_obj_conv);
24595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24596 LDKRawDataPart this_ptr_conv;
24597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24598 this_ptr_conv.is_owned = false;
24599 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
24600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24602 uint64_t ret_ref = (uint64_t)ret_var.inner;
24603 if (ret_var.is_owned) {
24609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24610 LDKRawDataPart this_ptr_conv;
24611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24612 this_ptr_conv.is_owned = false;
24613 LDKPositiveTimestamp val_conv;
24614 val_conv.inner = (void*)(val & (~1));
24615 val_conv.is_owned = (val & 1) || (val == 0);
24616 val_conv = PositiveTimestamp_clone(&val_conv);
24617 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
24620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24621 LDKRawDataPart a_conv;
24622 a_conv.inner = (void*)(a & (~1));
24623 a_conv.is_owned = false;
24624 LDKRawDataPart b_conv;
24625 b_conv.inner = (void*)(b & (~1));
24626 b_conv.is_owned = false;
24627 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
24631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24632 LDKRawDataPart orig_conv;
24633 orig_conv.inner = (void*)(orig & (~1));
24634 orig_conv.is_owned = false;
24635 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
24636 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24637 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24638 uint64_t ret_ref = (uint64_t)ret_var.inner;
24639 if (ret_var.is_owned) {
24645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24646 LDKPositiveTimestamp this_obj_conv;
24647 this_obj_conv.inner = (void*)(this_obj & (~1));
24648 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24649 PositiveTimestamp_free(this_obj_conv);
24652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24653 LDKPositiveTimestamp a_conv;
24654 a_conv.inner = (void*)(a & (~1));
24655 a_conv.is_owned = false;
24656 LDKPositiveTimestamp b_conv;
24657 b_conv.inner = (void*)(b & (~1));
24658 b_conv.is_owned = false;
24659 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
24663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24664 LDKPositiveTimestamp orig_conv;
24665 orig_conv.inner = (void*)(orig & (~1));
24666 orig_conv.is_owned = false;
24667 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
24668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24670 uint64_t ret_ref = (uint64_t)ret_var.inner;
24671 if (ret_var.is_owned) {
24677 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24678 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
24679 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
24683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24684 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
24685 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
24686 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
24690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
24691 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
24692 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
24696 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24697 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
24698 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
24702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24703 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
24704 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
24705 jboolean ret_val = Currency_eq(a_conv, b_conv);
24709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24710 LDKSha256 this_obj_conv;
24711 this_obj_conv.inner = (void*)(this_obj & (~1));
24712 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24713 Sha256_free(this_obj_conv);
24716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24718 a_conv.inner = (void*)(a & (~1));
24719 a_conv.is_owned = false;
24721 b_conv.inner = (void*)(b & (~1));
24722 b_conv.is_owned = false;
24723 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
24727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24728 LDKSha256 orig_conv;
24729 orig_conv.inner = (void*)(orig & (~1));
24730 orig_conv.is_owned = false;
24731 LDKSha256 ret_var = Sha256_clone(&orig_conv);
24732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24734 uint64_t ret_ref = (uint64_t)ret_var.inner;
24735 if (ret_var.is_owned) {
24741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24742 LDKDescription this_obj_conv;
24743 this_obj_conv.inner = (void*)(this_obj & (~1));
24744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24745 Description_free(this_obj_conv);
24748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24749 LDKDescription a_conv;
24750 a_conv.inner = (void*)(a & (~1));
24751 a_conv.is_owned = false;
24752 LDKDescription b_conv;
24753 b_conv.inner = (void*)(b & (~1));
24754 b_conv.is_owned = false;
24755 jboolean ret_val = Description_eq(&a_conv, &b_conv);
24759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24760 LDKDescription orig_conv;
24761 orig_conv.inner = (void*)(orig & (~1));
24762 orig_conv.is_owned = false;
24763 LDKDescription ret_var = Description_clone(&orig_conv);
24764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24766 uint64_t ret_ref = (uint64_t)ret_var.inner;
24767 if (ret_var.is_owned) {
24773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24774 LDKPayeePubKey this_obj_conv;
24775 this_obj_conv.inner = (void*)(this_obj & (~1));
24776 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24777 PayeePubKey_free(this_obj_conv);
24780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24781 LDKPayeePubKey a_conv;
24782 a_conv.inner = (void*)(a & (~1));
24783 a_conv.is_owned = false;
24784 LDKPayeePubKey b_conv;
24785 b_conv.inner = (void*)(b & (~1));
24786 b_conv.is_owned = false;
24787 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
24791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24792 LDKPayeePubKey orig_conv;
24793 orig_conv.inner = (void*)(orig & (~1));
24794 orig_conv.is_owned = false;
24795 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
24796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24798 uint64_t ret_ref = (uint64_t)ret_var.inner;
24799 if (ret_var.is_owned) {
24805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24806 LDKExpiryTime this_obj_conv;
24807 this_obj_conv.inner = (void*)(this_obj & (~1));
24808 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24809 ExpiryTime_free(this_obj_conv);
24812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24813 LDKExpiryTime a_conv;
24814 a_conv.inner = (void*)(a & (~1));
24815 a_conv.is_owned = false;
24816 LDKExpiryTime b_conv;
24817 b_conv.inner = (void*)(b & (~1));
24818 b_conv.is_owned = false;
24819 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
24823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24824 LDKExpiryTime orig_conv;
24825 orig_conv.inner = (void*)(orig & (~1));
24826 orig_conv.is_owned = false;
24827 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
24828 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24829 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24830 uint64_t ret_ref = (uint64_t)ret_var.inner;
24831 if (ret_var.is_owned) {
24837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24838 LDKMinFinalCltvExpiry this_obj_conv;
24839 this_obj_conv.inner = (void*)(this_obj & (~1));
24840 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24841 MinFinalCltvExpiry_free(this_obj_conv);
24844 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24845 LDKMinFinalCltvExpiry a_conv;
24846 a_conv.inner = (void*)(a & (~1));
24847 a_conv.is_owned = false;
24848 LDKMinFinalCltvExpiry b_conv;
24849 b_conv.inner = (void*)(b & (~1));
24850 b_conv.is_owned = false;
24851 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
24855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24856 LDKMinFinalCltvExpiry orig_conv;
24857 orig_conv.inner = (void*)(orig & (~1));
24858 orig_conv.is_owned = false;
24859 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
24860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24862 uint64_t ret_ref = (uint64_t)ret_var.inner;
24863 if (ret_var.is_owned) {
24869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24870 if ((this_ptr & 1) != 0) return;
24871 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
24872 FREE((void*)this_ptr);
24873 Fallback_free(this_ptr_conv);
24876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24877 LDKFallback* orig_conv = (LDKFallback*)orig;
24878 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24879 *ret_copy = Fallback_clone(orig_conv);
24880 uint64_t ret_ref = (uint64_t)ret_copy;
24884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24885 LDKFallback* a_conv = (LDKFallback*)a;
24886 LDKFallback* b_conv = (LDKFallback*)b;
24887 jboolean ret_val = Fallback_eq(a_conv, b_conv);
24891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24892 LDKInvoiceSignature this_obj_conv;
24893 this_obj_conv.inner = (void*)(this_obj & (~1));
24894 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24895 InvoiceSignature_free(this_obj_conv);
24898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24899 LDKInvoiceSignature a_conv;
24900 a_conv.inner = (void*)(a & (~1));
24901 a_conv.is_owned = false;
24902 LDKInvoiceSignature b_conv;
24903 b_conv.inner = (void*)(b & (~1));
24904 b_conv.is_owned = false;
24905 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
24909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24910 LDKInvoiceSignature orig_conv;
24911 orig_conv.inner = (void*)(orig & (~1));
24912 orig_conv.is_owned = false;
24913 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
24914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24916 uint64_t ret_ref = (uint64_t)ret_var.inner;
24917 if (ret_var.is_owned) {
24923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24924 LDKPrivateRoute this_obj_conv;
24925 this_obj_conv.inner = (void*)(this_obj & (~1));
24926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24927 PrivateRoute_free(this_obj_conv);
24930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24931 LDKPrivateRoute a_conv;
24932 a_conv.inner = (void*)(a & (~1));
24933 a_conv.is_owned = false;
24934 LDKPrivateRoute b_conv;
24935 b_conv.inner = (void*)(b & (~1));
24936 b_conv.is_owned = false;
24937 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
24941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24942 LDKPrivateRoute orig_conv;
24943 orig_conv.inner = (void*)(orig & (~1));
24944 orig_conv.is_owned = false;
24945 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
24946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24948 uint64_t ret_ref = (uint64_t)ret_var.inner;
24949 if (ret_var.is_owned) {
24955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
24956 LDKSignedRawInvoice this_arg_conv;
24957 this_arg_conv.inner = (void*)(this_arg & (~1));
24958 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24959 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
24960 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
24961 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
24962 return (uint64_t)ret_ref;
24965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
24966 LDKSignedRawInvoice this_arg_conv;
24967 this_arg_conv.inner = (void*)(this_arg & (~1));
24968 this_arg_conv.is_owned = false;
24969 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
24970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24972 uint64_t ret_ref = (uint64_t)ret_var.inner;
24973 if (ret_var.is_owned) {
24979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24980 LDKSignedRawInvoice this_arg_conv;
24981 this_arg_conv.inner = (void*)(this_arg & (~1));
24982 this_arg_conv.is_owned = false;
24983 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24984 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
24988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
24989 LDKSignedRawInvoice this_arg_conv;
24990 this_arg_conv.inner = (void*)(this_arg & (~1));
24991 this_arg_conv.is_owned = false;
24992 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
24993 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24994 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24995 uint64_t ret_ref = (uint64_t)ret_var.inner;
24996 if (ret_var.is_owned) {
25002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25003 LDKSignedRawInvoice this_arg_conv;
25004 this_arg_conv.inner = (void*)(this_arg & (~1));
25005 this_arg_conv.is_owned = false;
25006 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25007 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25008 return (uint64_t)ret_conv;
25011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25012 LDKSignedRawInvoice this_arg_conv;
25013 this_arg_conv.inner = (void*)(this_arg & (~1));
25014 this_arg_conv.is_owned = false;
25015 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25020 LDKRawInvoice this_arg_conv;
25021 this_arg_conv.inner = (void*)(this_arg & (~1));
25022 this_arg_conv.is_owned = false;
25023 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25024 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
25028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25029 LDKRawInvoice this_arg_conv;
25030 this_arg_conv.inner = (void*)(this_arg & (~1));
25031 this_arg_conv.is_owned = false;
25032 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25035 uint64_t ret_ref = (uint64_t)ret_var.inner;
25036 if (ret_var.is_owned) {
25042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
25043 LDKRawInvoice this_arg_conv;
25044 this_arg_conv.inner = (void*)(this_arg & (~1));
25045 this_arg_conv.is_owned = false;
25046 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25047 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25048 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25049 uint64_t ret_ref = (uint64_t)ret_var.inner;
25050 if (ret_var.is_owned) {
25056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25057 LDKRawInvoice this_arg_conv;
25058 this_arg_conv.inner = (void*)(this_arg & (~1));
25059 this_arg_conv.is_owned = false;
25060 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25063 uint64_t ret_ref = (uint64_t)ret_var.inner;
25064 if (ret_var.is_owned) {
25070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25071 LDKRawInvoice this_arg_conv;
25072 this_arg_conv.inner = (void*)(this_arg & (~1));
25073 this_arg_conv.is_owned = false;
25074 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25077 uint64_t ret_ref = (uint64_t)ret_var.inner;
25078 if (ret_var.is_owned) {
25084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25085 LDKRawInvoice this_arg_conv;
25086 this_arg_conv.inner = (void*)(this_arg & (~1));
25087 this_arg_conv.is_owned = false;
25088 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25091 uint64_t ret_ref = (uint64_t)ret_var.inner;
25092 if (ret_var.is_owned) {
25098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25099 LDKRawInvoice this_arg_conv;
25100 this_arg_conv.inner = (void*)(this_arg & (~1));
25101 this_arg_conv.is_owned = false;
25102 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25105 uint64_t ret_ref = (uint64_t)ret_var.inner;
25106 if (ret_var.is_owned) {
25112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25113 LDKRawInvoice this_arg_conv;
25114 this_arg_conv.inner = (void*)(this_arg & (~1));
25115 this_arg_conv.is_owned = false;
25116 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25117 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
25121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25122 LDKRawInvoice this_arg_conv;
25123 this_arg_conv.inner = (void*)(this_arg & (~1));
25124 this_arg_conv.is_owned = false;
25125 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25126 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25127 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25128 uint64_t ret_ref = (uint64_t)ret_var.inner;
25129 if (ret_var.is_owned) {
25135 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25136 LDKRawInvoice this_arg_conv;
25137 this_arg_conv.inner = (void*)(this_arg & (~1));
25138 this_arg_conv.is_owned = false;
25139 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
25140 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25141 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25142 for (size_t o = 0; o < ret_var.datalen; o++) {
25143 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25144 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25145 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25146 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25147 if (ret_conv_14_var.is_owned) {
25148 ret_conv_14_ref |= 1;
25150 ret_arr_ptr[o] = ret_conv_14_ref;
25152 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25153 FREE(ret_var.data);
25157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25158 LDKRawInvoice this_arg_conv;
25159 this_arg_conv.inner = (void*)(this_arg & (~1));
25160 this_arg_conv.is_owned = false;
25161 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25162 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25163 uint64_t ret_ref = (uint64_t)ret_copy;
25167 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25168 LDKRawInvoice this_arg_conv;
25169 this_arg_conv.inner = (void*)(this_arg & (~1));
25170 this_arg_conv.is_owned = false;
25171 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
25175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
25176 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25177 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25178 return (uint64_t)ret_conv;
25181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
25182 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25183 *ret_conv = PositiveTimestamp_from_system_time(time);
25184 return (uint64_t)ret_conv;
25187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25188 LDKPositiveTimestamp this_arg_conv;
25189 this_arg_conv.inner = (void*)(this_arg & (~1));
25190 this_arg_conv.is_owned = false;
25191 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25196 LDKPositiveTimestamp this_arg_conv;
25197 this_arg_conv.inner = (void*)(this_arg & (~1));
25198 this_arg_conv.is_owned = false;
25199 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
25204 LDKInvoice this_arg_conv;
25205 this_arg_conv.inner = (void*)(this_arg & (~1));
25206 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25207 this_arg_conv = Invoice_clone(&this_arg_conv);
25208 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25211 uint64_t ret_ref = (uint64_t)ret_var.inner;
25212 if (ret_var.is_owned) {
25218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25219 LDKInvoice this_arg_conv;
25220 this_arg_conv.inner = (void*)(this_arg & (~1));
25221 this_arg_conv.is_owned = false;
25222 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
25223 *ret_conv = Invoice_check_signature(&this_arg_conv);
25224 return (uint64_t)ret_conv;
25227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
25228 LDKSignedRawInvoice signed_invoice_conv;
25229 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
25230 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
25231 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
25232 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
25233 *ret_conv = Invoice_from_signed(signed_invoice_conv);
25234 return (uint64_t)ret_conv;
25237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25238 LDKInvoice this_arg_conv;
25239 this_arg_conv.inner = (void*)(this_arg & (~1));
25240 this_arg_conv.is_owned = false;
25241 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
25245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25246 LDKInvoice this_arg_conv;
25247 this_arg_conv.inner = (void*)(this_arg & (~1));
25248 this_arg_conv.is_owned = false;
25249 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25250 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
25254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25255 LDKInvoice this_arg_conv;
25256 this_arg_conv.inner = (void*)(this_arg & (~1));
25257 this_arg_conv.is_owned = false;
25258 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25259 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
25263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25264 LDKInvoice this_arg_conv;
25265 this_arg_conv.inner = (void*)(this_arg & (~1));
25266 this_arg_conv.is_owned = false;
25267 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25268 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
25272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25273 LDKInvoice this_arg_conv;
25274 this_arg_conv.inner = (void*)(this_arg & (~1));
25275 this_arg_conv.is_owned = false;
25276 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
25277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25279 uint64_t ret_ref = (uint64_t)ret_var.inner;
25280 if (ret_var.is_owned) {
25286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25287 LDKInvoice this_arg_conv;
25288 this_arg_conv.inner = (void*)(this_arg & (~1));
25289 this_arg_conv.is_owned = false;
25290 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25291 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
25295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25296 LDKInvoice this_arg_conv;
25297 this_arg_conv.inner = (void*)(this_arg & (~1));
25298 this_arg_conv.is_owned = false;
25299 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
25303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25304 LDKInvoice this_arg_conv;
25305 this_arg_conv.inner = (void*)(this_arg & (~1));
25306 this_arg_conv.is_owned = false;
25307 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
25311 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25312 LDKInvoice this_arg_conv;
25313 this_arg_conv.inner = (void*)(this_arg & (~1));
25314 this_arg_conv.is_owned = false;
25315 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
25316 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25317 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25318 for (size_t o = 0; o < ret_var.datalen; o++) {
25319 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25320 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25321 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25322 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25323 if (ret_conv_14_var.is_owned) {
25324 ret_conv_14_ref |= 1;
25326 ret_arr_ptr[o] = ret_conv_14_ref;
25328 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25329 FREE(ret_var.data);
25333 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
25334 LDKInvoice this_arg_conv;
25335 this_arg_conv.inner = (void*)(this_arg & (~1));
25336 this_arg_conv.is_owned = false;
25337 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
25338 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25339 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25340 for (size_t l = 0; l < ret_var.datalen; l++) {
25341 LDKRouteHint ret_conv_11_var = ret_var.data[l];
25342 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25343 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25344 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
25345 if (ret_conv_11_var.is_owned) {
25346 ret_conv_11_ref |= 1;
25348 ret_arr_ptr[l] = ret_conv_11_ref;
25350 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25351 FREE(ret_var.data);
25355 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25356 LDKInvoice this_arg_conv;
25357 this_arg_conv.inner = (void*)(this_arg & (~1));
25358 this_arg_conv.is_owned = false;
25359 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
25363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25364 LDKInvoice this_arg_conv;
25365 this_arg_conv.inner = (void*)(this_arg & (~1));
25366 this_arg_conv.is_owned = false;
25367 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25368 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
25369 uint64_t ret_ref = (uint64_t)ret_copy;
25373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
25374 LDKStr description_conv = java_to_owned_str(env, description);
25375 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
25376 *ret_conv = Description_new(description_conv);
25377 return (uint64_t)ret_conv;
25380 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25381 LDKDescription this_arg_conv;
25382 this_arg_conv.inner = (void*)(this_arg & (~1));
25383 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25384 this_arg_conv = Description_clone(&this_arg_conv);
25385 LDKStr ret_str = Description_into_inner(this_arg_conv);
25386 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
25391 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25392 *ret_conv = ExpiryTime_from_seconds(seconds);
25393 return (uint64_t)ret_conv;
25396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
25397 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25398 *ret_conv = ExpiryTime_from_duration(duration);
25399 return (uint64_t)ret_conv;
25402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
25403 LDKExpiryTime this_arg_conv;
25404 this_arg_conv.inner = (void*)(this_arg & (~1));
25405 this_arg_conv.is_owned = false;
25406 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
25410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
25411 LDKExpiryTime this_arg_conv;
25412 this_arg_conv.inner = (void*)(this_arg & (~1));
25413 this_arg_conv.is_owned = false;
25414 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
25418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
25419 LDKRouteHint hops_conv;
25420 hops_conv.inner = (void*)(hops & (~1));
25421 hops_conv.is_owned = (hops & 1) || (hops == 0);
25422 hops_conv = RouteHint_clone(&hops_conv);
25423 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
25424 *ret_conv = PrivateRoute_new(hops_conv);
25425 return (uint64_t)ret_conv;
25428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25429 LDKPrivateRoute this_arg_conv;
25430 this_arg_conv.inner = (void*)(this_arg & (~1));
25431 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25432 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
25433 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
25434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25436 uint64_t ret_ref = (uint64_t)ret_var.inner;
25437 if (ret_var.is_owned) {
25443 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25444 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
25445 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
25449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25450 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
25451 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
25452 jboolean ret_val = CreationError_eq(a_conv, b_conv);
25456 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25457 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
25458 LDKStr ret_str = CreationError_to_str(o_conv);
25459 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25463 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25464 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
25465 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
25469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25470 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
25471 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
25472 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
25476 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25477 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
25478 LDKStr ret_str = SemanticError_to_str(o_conv);
25479 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25484 if ((this_ptr & 1) != 0) return;
25485 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
25486 FREE((void*)this_ptr);
25487 SignOrCreationError_free(this_ptr_conv);
25490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25491 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
25492 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
25493 *ret_copy = SignOrCreationError_clone(orig_conv);
25494 uint64_t ret_ref = (uint64_t)ret_copy;
25498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25499 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
25500 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
25501 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
25505 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25506 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
25507 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
25508 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) {
25513 LDKChannelManager channelmanager_conv;
25514 channelmanager_conv.inner = (void*)(channelmanager & (~1));
25515 channelmanager_conv.is_owned = false;
25516 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25517 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25518 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25519 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
25521 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
25522 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
25523 LDKStr description_conv = java_to_owned_str(env, description);
25524 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25525 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
25526 return (uint64_t)ret_conv;
25529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25530 LDKStr s_conv = java_to_owned_str(env, s);
25531 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
25532 *ret_conv = SiPrefix_from_str(s_conv);
25533 return (uint64_t)ret_conv;
25536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25537 LDKStr s_conv = java_to_owned_str(env, s);
25538 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
25539 *ret_conv = Invoice_from_str(s_conv);
25540 return (uint64_t)ret_conv;
25543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25544 LDKStr s_conv = java_to_owned_str(env, s);
25545 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
25546 *ret_conv = SignedRawInvoice_from_str(s_conv);
25547 return (uint64_t)ret_conv;
25550 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25552 o_conv.inner = (void*)(o & (~1));
25553 o_conv.is_owned = false;
25554 LDKStr ret_str = Invoice_to_str(&o_conv);
25555 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25559 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25560 LDKSignedRawInvoice o_conv;
25561 o_conv.inner = (void*)(o & (~1));
25562 o_conv.is_owned = false;
25563 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
25564 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25568 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25569 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25570 LDKStr ret_str = Currency_to_str(o_conv);
25571 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25575 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25576 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
25577 LDKStr ret_str = SiPrefix_to_str(o_conv);
25578 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);