2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
4 #include "org_ldk_impl_bindings.h"
10 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
11 #define MALLOC(a, _) malloc(a)
12 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
13 #define DO_ASSERT(a) (void)(a)
16 static jmethodID ordinal_meth = NULL;
17 static jmethodID slicedef_meth = NULL;
18 static jclass slicedef_cls = NULL;
19 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
20 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
21 CHECK(ordinal_meth != NULL);
22 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
23 CHECK(slicedef_meth != NULL);
24 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
25 CHECK(slicedef_cls != NULL);
28 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
31 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
34 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
37 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
38 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
39 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
42 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
43 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
44 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
45 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
48 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
49 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
50 vec->datalen = (*env)->GetArrayLength(env, bytes);
51 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
52 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
55 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
56 LDKTransaction *txdata = (LDKTransaction*)ptr;
58 slice.data = txdata->data;
59 slice.datalen = txdata->datalen;
60 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
62 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
63 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
64 txdata->datalen = (*env)->GetArrayLength(env, bytes);
65 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
66 txdata->data_is_owned = false;
67 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
68 return (uint64_t)txdata;
70 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
71 LDKTransaction *tx = (LDKTransaction*)ptr;
72 tx->data_is_owned = true;
73 Transaction_free(*tx);
76 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
77 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
78 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
79 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
82 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
83 return (uint64_t)vec->datalen;
85 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
86 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
87 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
88 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
91 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
97 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
98 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
99 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
100 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
102 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
103 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
104 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
106 typedef jlongArray int64_tArray;
107 typedef jbyteArray int8_tArray;
109 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
110 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
111 char* conv_buf = MALLOC(len + 1, "str conv buf");
112 memcpy(conv_buf, chars, len);
114 jstring ret = (*env)->NewStringUTF(env, conv_buf);
118 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
119 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
120 char* newchars = MALLOC(str_len + 1, "String chars");
121 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
122 memcpy(newchars, jchars, str_len);
123 newchars[str_len] = 0;
124 (*env)->ReleaseStringUTFChars(env, str, jchars);
128 .chars_is_owned = true
133 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
134 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
136 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
137 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
140 static jclass arr_of_B_clz = NULL;
141 static jclass arr_of_J_clz = NULL;
142 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
143 arr_of_B_clz = (*env)->FindClass(env, "[B");
144 CHECK(arr_of_B_clz != NULL);
145 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
146 arr_of_J_clz = (*env)->FindClass(env, "[J");
147 CHECK(arr_of_J_clz != NULL);
148 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
150 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
151 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
152 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
153 case 0: return LDKAccessError_UnknownChain;
154 case 1: return LDKAccessError_UnknownTx;
158 static jclass AccessError_class = NULL;
159 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
160 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
161 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
162 AccessError_class = (*env)->NewGlobalRef(env, clz);
163 CHECK(AccessError_class != NULL);
164 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
165 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
166 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
167 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
169 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
171 case LDKAccessError_UnknownChain:
172 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
173 case LDKAccessError_UnknownTx:
174 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
179 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
180 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
181 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
182 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
186 static jclass ChannelMonitorUpdateErr_class = NULL;
187 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
188 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
189 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
190 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
191 CHECK(ChannelMonitorUpdateErr_class != NULL);
192 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
193 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
194 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
195 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
197 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
199 case LDKChannelMonitorUpdateErr_TemporaryFailure:
200 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
201 case LDKChannelMonitorUpdateErr_PermanentFailure:
202 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
207 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
208 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
209 case 0: return LDKConfirmationTarget_Background;
210 case 1: return LDKConfirmationTarget_Normal;
211 case 2: return LDKConfirmationTarget_HighPriority;
215 static jclass ConfirmationTarget_class = NULL;
216 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
217 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
218 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
219 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
220 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
221 CHECK(ConfirmationTarget_class != NULL);
222 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
223 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
224 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
225 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
226 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
227 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
229 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
231 case LDKConfirmationTarget_Background:
232 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
233 case LDKConfirmationTarget_Normal:
234 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
235 case LDKConfirmationTarget_HighPriority:
236 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
241 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
242 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
243 case 0: return LDKCreationError_DescriptionTooLong;
244 case 1: return LDKCreationError_RouteTooLong;
245 case 2: return LDKCreationError_TimestampOutOfBounds;
246 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
250 static jclass CreationError_class = NULL;
251 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
252 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
253 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
254 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
255 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
256 CreationError_class = (*env)->NewGlobalRef(env, clz);
257 CHECK(CreationError_class != NULL);
258 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
259 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
260 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
261 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
262 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
263 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
264 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
265 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
267 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
269 case LDKCreationError_DescriptionTooLong:
270 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
271 case LDKCreationError_RouteTooLong:
272 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
273 case LDKCreationError_TimestampOutOfBounds:
274 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
275 case LDKCreationError_ExpiryTimeOutOfBounds:
276 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
281 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
282 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
283 case 0: return LDKCurrency_Bitcoin;
284 case 1: return LDKCurrency_BitcoinTestnet;
285 case 2: return LDKCurrency_Regtest;
286 case 3: return LDKCurrency_Simnet;
287 case 4: return LDKCurrency_Signet;
291 static jclass Currency_class = NULL;
292 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
293 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
294 static jfieldID Currency_LDKCurrency_Regtest = NULL;
295 static jfieldID Currency_LDKCurrency_Simnet = NULL;
296 static jfieldID Currency_LDKCurrency_Signet = NULL;
297 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
298 Currency_class = (*env)->NewGlobalRef(env, clz);
299 CHECK(Currency_class != NULL);
300 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
301 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
302 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
303 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
304 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
305 CHECK(Currency_LDKCurrency_Regtest != NULL);
306 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
307 CHECK(Currency_LDKCurrency_Simnet != NULL);
308 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
309 CHECK(Currency_LDKCurrency_Signet != NULL);
311 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
313 case LDKCurrency_Bitcoin:
314 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
315 case LDKCurrency_BitcoinTestnet:
316 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
317 case LDKCurrency_Regtest:
318 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
319 case LDKCurrency_Simnet:
320 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
321 case LDKCurrency_Signet:
322 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
327 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
328 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
329 case 0: return LDKIOError_NotFound;
330 case 1: return LDKIOError_PermissionDenied;
331 case 2: return LDKIOError_ConnectionRefused;
332 case 3: return LDKIOError_ConnectionReset;
333 case 4: return LDKIOError_ConnectionAborted;
334 case 5: return LDKIOError_NotConnected;
335 case 6: return LDKIOError_AddrInUse;
336 case 7: return LDKIOError_AddrNotAvailable;
337 case 8: return LDKIOError_BrokenPipe;
338 case 9: return LDKIOError_AlreadyExists;
339 case 10: return LDKIOError_WouldBlock;
340 case 11: return LDKIOError_InvalidInput;
341 case 12: return LDKIOError_InvalidData;
342 case 13: return LDKIOError_TimedOut;
343 case 14: return LDKIOError_WriteZero;
344 case 15: return LDKIOError_Interrupted;
345 case 16: return LDKIOError_Other;
346 case 17: return LDKIOError_UnexpectedEof;
350 static jclass IOError_class = NULL;
351 static jfieldID IOError_LDKIOError_NotFound = NULL;
352 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
353 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
354 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
355 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
356 static jfieldID IOError_LDKIOError_NotConnected = NULL;
357 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
358 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
359 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
360 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
361 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
362 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
363 static jfieldID IOError_LDKIOError_InvalidData = NULL;
364 static jfieldID IOError_LDKIOError_TimedOut = NULL;
365 static jfieldID IOError_LDKIOError_WriteZero = NULL;
366 static jfieldID IOError_LDKIOError_Interrupted = NULL;
367 static jfieldID IOError_LDKIOError_Other = NULL;
368 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
369 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
370 IOError_class = (*env)->NewGlobalRef(env, clz);
371 CHECK(IOError_class != NULL);
372 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
373 CHECK(IOError_LDKIOError_NotFound != NULL);
374 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
375 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
376 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
377 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
378 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
379 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
380 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
381 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
382 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
383 CHECK(IOError_LDKIOError_NotConnected != NULL);
384 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
385 CHECK(IOError_LDKIOError_AddrInUse != NULL);
386 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
387 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
388 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
389 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
390 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
391 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
392 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
393 CHECK(IOError_LDKIOError_WouldBlock != NULL);
394 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
395 CHECK(IOError_LDKIOError_InvalidInput != NULL);
396 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
397 CHECK(IOError_LDKIOError_InvalidData != NULL);
398 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
399 CHECK(IOError_LDKIOError_TimedOut != NULL);
400 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
401 CHECK(IOError_LDKIOError_WriteZero != NULL);
402 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
403 CHECK(IOError_LDKIOError_Interrupted != NULL);
404 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
405 CHECK(IOError_LDKIOError_Other != NULL);
406 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
407 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
409 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
411 case LDKIOError_NotFound:
412 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
413 case LDKIOError_PermissionDenied:
414 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
415 case LDKIOError_ConnectionRefused:
416 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
417 case LDKIOError_ConnectionReset:
418 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
419 case LDKIOError_ConnectionAborted:
420 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
421 case LDKIOError_NotConnected:
422 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
423 case LDKIOError_AddrInUse:
424 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
425 case LDKIOError_AddrNotAvailable:
426 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
427 case LDKIOError_BrokenPipe:
428 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
429 case LDKIOError_AlreadyExists:
430 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
431 case LDKIOError_WouldBlock:
432 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
433 case LDKIOError_InvalidInput:
434 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
435 case LDKIOError_InvalidData:
436 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
437 case LDKIOError_TimedOut:
438 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
439 case LDKIOError_WriteZero:
440 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
441 case LDKIOError_Interrupted:
442 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
443 case LDKIOError_Other:
444 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
445 case LDKIOError_UnexpectedEof:
446 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
451 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
452 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
453 case 0: return LDKLevel_Trace;
454 case 1: return LDKLevel_Debug;
455 case 2: return LDKLevel_Info;
456 case 3: return LDKLevel_Warn;
457 case 4: return LDKLevel_Error;
461 static jclass Level_class = NULL;
462 static jfieldID Level_LDKLevel_Trace = NULL;
463 static jfieldID Level_LDKLevel_Debug = NULL;
464 static jfieldID Level_LDKLevel_Info = NULL;
465 static jfieldID Level_LDKLevel_Warn = NULL;
466 static jfieldID Level_LDKLevel_Error = NULL;
467 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
468 Level_class = (*env)->NewGlobalRef(env, clz);
469 CHECK(Level_class != NULL);
470 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
471 CHECK(Level_LDKLevel_Trace != NULL);
472 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
473 CHECK(Level_LDKLevel_Debug != NULL);
474 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
475 CHECK(Level_LDKLevel_Info != NULL);
476 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Warn != NULL);
478 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Error != NULL);
481 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
484 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
486 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
488 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
490 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
497 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
498 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
499 case 0: return LDKNetwork_Bitcoin;
500 case 1: return LDKNetwork_Testnet;
501 case 2: return LDKNetwork_Regtest;
502 case 3: return LDKNetwork_Signet;
506 static jclass Network_class = NULL;
507 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
508 static jfieldID Network_LDKNetwork_Testnet = NULL;
509 static jfieldID Network_LDKNetwork_Regtest = NULL;
510 static jfieldID Network_LDKNetwork_Signet = NULL;
511 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
512 Network_class = (*env)->NewGlobalRef(env, clz);
513 CHECK(Network_class != NULL);
514 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
515 CHECK(Network_LDKNetwork_Bitcoin != NULL);
516 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
517 CHECK(Network_LDKNetwork_Testnet != NULL);
518 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
519 CHECK(Network_LDKNetwork_Regtest != NULL);
520 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
521 CHECK(Network_LDKNetwork_Signet != NULL);
523 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
525 case LDKNetwork_Bitcoin:
526 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
527 case LDKNetwork_Testnet:
528 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
529 case LDKNetwork_Regtest:
530 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
531 case LDKNetwork_Signet:
532 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
537 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
538 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
539 case 0: return LDKSecp256k1Error_IncorrectSignature;
540 case 1: return LDKSecp256k1Error_InvalidMessage;
541 case 2: return LDKSecp256k1Error_InvalidPublicKey;
542 case 3: return LDKSecp256k1Error_InvalidSignature;
543 case 4: return LDKSecp256k1Error_InvalidSecretKey;
544 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
545 case 6: return LDKSecp256k1Error_InvalidTweak;
546 case 7: return LDKSecp256k1Error_TweakCheckFailed;
547 case 8: return LDKSecp256k1Error_NotEnoughMemory;
551 static jclass Secp256k1Error_class = NULL;
552 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
553 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
554 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
555 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
556 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
561 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
562 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
563 CHECK(Secp256k1Error_class != NULL);
564 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
565 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
566 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
567 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
568 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
569 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
570 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
571 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
572 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
573 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
574 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
578 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
580 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
583 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
585 case LDKSecp256k1Error_IncorrectSignature:
586 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
587 case LDKSecp256k1Error_InvalidMessage:
588 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
589 case LDKSecp256k1Error_InvalidPublicKey:
590 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
591 case LDKSecp256k1Error_InvalidSignature:
592 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
593 case LDKSecp256k1Error_InvalidSecretKey:
594 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
595 case LDKSecp256k1Error_InvalidRecoveryId:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
597 case LDKSecp256k1Error_InvalidTweak:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
599 case LDKSecp256k1Error_TweakCheckFailed:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
601 case LDKSecp256k1Error_NotEnoughMemory:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
607 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
608 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
609 case 0: return LDKSemanticError_NoPaymentHash;
610 case 1: return LDKSemanticError_MultiplePaymentHashes;
611 case 2: return LDKSemanticError_NoDescription;
612 case 3: return LDKSemanticError_MultipleDescriptions;
613 case 4: return LDKSemanticError_NoPaymentSecret;
614 case 5: return LDKSemanticError_MultiplePaymentSecrets;
615 case 6: return LDKSemanticError_InvalidFeatures;
616 case 7: return LDKSemanticError_InvalidRecoveryId;
617 case 8: return LDKSemanticError_InvalidSignature;
618 case 9: return LDKSemanticError_ImpreciseAmount;
622 static jclass SemanticError_class = NULL;
623 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
624 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
625 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
626 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
627 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
628 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
629 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
630 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
631 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
632 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
633 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
634 SemanticError_class = (*env)->NewGlobalRef(env, clz);
635 CHECK(SemanticError_class != NULL);
636 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
637 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
638 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
639 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
640 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
642 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
644 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
646 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
648 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
650 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
652 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
653 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
654 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
655 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
657 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
659 case LDKSemanticError_NoPaymentHash:
660 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
661 case LDKSemanticError_MultiplePaymentHashes:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
663 case LDKSemanticError_NoDescription:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
665 case LDKSemanticError_MultipleDescriptions:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
667 case LDKSemanticError_NoPaymentSecret:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
669 case LDKSemanticError_MultiplePaymentSecrets:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
671 case LDKSemanticError_InvalidFeatures:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
673 case LDKSemanticError_InvalidRecoveryId:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
675 case LDKSemanticError_InvalidSignature:
676 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
677 case LDKSemanticError_ImpreciseAmount:
678 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
683 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
684 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
685 case 0: return LDKSiPrefix_Milli;
686 case 1: return LDKSiPrefix_Micro;
687 case 2: return LDKSiPrefix_Nano;
688 case 3: return LDKSiPrefix_Pico;
692 static jclass SiPrefix_class = NULL;
693 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
694 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
695 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
696 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
697 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
698 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
699 CHECK(SiPrefix_class != NULL);
700 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
701 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
702 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
703 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
704 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
705 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
706 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
707 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
709 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
711 case LDKSiPrefix_Milli:
712 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
713 case LDKSiPrefix_Micro:
714 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
715 case LDKSiPrefix_Nano:
716 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
717 case LDKSiPrefix_Pico:
718 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
724 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
725 ret->datalen = (*env)->GetArrayLength(env, elems);
726 if (ret->datalen == 0) {
729 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
730 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
731 for (size_t i = 0; i < ret->datalen; i++) {
732 ret->data[i] = java_elems[i];
734 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
736 return (uint64_t)ret;
738 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
739 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
740 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
743 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
744 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
745 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
748 CVec_u8Z_free(ret_var);
752 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
753 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
754 int64_t ret_val = TxOut_get_value(thing_conv);
758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
759 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
762 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
763 CHECK(val->result_ok);
764 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
765 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
768 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
769 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
770 CHECK(!val->result_ok);
771 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
775 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
778 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
779 CHECK(val->result_ok);
780 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
781 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
784 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
785 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
786 CHECK(!val->result_ok);
787 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
791 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
794 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
795 CHECK(val->result_ok);
796 LDKTxCreationKeys res_var = (*val->contents.result);
797 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
798 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
799 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
803 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
804 CHECK(!val->result_ok);
805 LDKDecodeError err_var = (*val->contents.err);
806 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
807 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
808 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
812 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
815 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
816 CHECK(val->result_ok);
817 LDKChannelPublicKeys res_var = (*val->contents.result);
818 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
819 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
820 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
824 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
825 CHECK(!val->result_ok);
826 LDKDecodeError err_var = (*val->contents.err);
827 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
828 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
829 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
833 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
836 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
837 CHECK(val->result_ok);
838 LDKTxCreationKeys res_var = (*val->contents.result);
839 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
840 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
841 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
844 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
845 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
846 CHECK(!val->result_ok);
847 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
850 static jclass LDKCOption_u32Z_Some_class = NULL;
851 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
852 static jclass LDKCOption_u32Z_None_class = NULL;
853 static jmethodID LDKCOption_u32Z_None_meth = NULL;
854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
855 LDKCOption_u32Z_Some_class =
856 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
857 CHECK(LDKCOption_u32Z_Some_class != NULL);
858 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
859 CHECK(LDKCOption_u32Z_Some_meth != NULL);
860 LDKCOption_u32Z_None_class =
861 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
862 CHECK(LDKCOption_u32Z_None_class != NULL);
863 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
864 CHECK(LDKCOption_u32Z_None_meth != NULL);
866 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
867 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
869 case LDKCOption_u32Z_Some: {
870 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
872 case LDKCOption_u32Z_None: {
873 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
879 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
882 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
883 CHECK(val->result_ok);
884 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
885 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
886 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
887 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
891 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
892 CHECK(!val->result_ok);
893 LDKDecodeError err_var = (*val->contents.err);
894 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
895 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
896 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
900 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
903 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
904 CHECK(val->result_ok);
905 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
906 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
907 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
908 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
912 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
913 CHECK(!val->result_ok);
914 LDKDecodeError err_var = (*val->contents.err);
915 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
916 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
917 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
921 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
924 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
925 CHECK(val->result_ok);
926 LDKChannelTransactionParameters res_var = (*val->contents.result);
927 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
928 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
929 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
933 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
934 CHECK(!val->result_ok);
935 LDKDecodeError err_var = (*val->contents.err);
936 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
942 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
945 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
946 CHECK(val->result_ok);
947 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
948 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
954 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
955 CHECK(!val->result_ok);
956 LDKDecodeError err_var = (*val->contents.err);
957 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
958 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
959 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
963 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
966 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
967 CHECK(val->result_ok);
968 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
969 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
970 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
971 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
975 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
976 CHECK(!val->result_ok);
977 LDKDecodeError err_var = (*val->contents.err);
978 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
979 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
980 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
984 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
987 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
988 CHECK(val->result_ok);
989 LDKTrustedClosingTransaction res_var = (*val->contents.result);
990 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
991 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
992 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
996 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
997 CHECK(!val->result_ok);
998 return *val->contents.err;
1000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1001 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1004 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1005 CHECK(val->result_ok);
1006 LDKCommitmentTransaction res_var = (*val->contents.result);
1007 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1008 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1009 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1013 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1014 CHECK(!val->result_ok);
1015 LDKDecodeError err_var = (*val->contents.err);
1016 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1017 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1018 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1022 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
1024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1025 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1026 CHECK(val->result_ok);
1027 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1028 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1029 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1030 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1034 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1035 CHECK(!val->result_ok);
1036 return *val->contents.err;
1038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1039 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1041 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1042 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1043 CHECK(val->result_ok);
1044 LDKCVec_SignatureZ res_var = (*val->contents.result);
1045 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1047 for (size_t i = 0; i < res_var.datalen; i++) {
1048 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1049 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1050 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1055 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1056 CHECK(!val->result_ok);
1057 return *val->contents.err;
1059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1060 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1063 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1064 CHECK(val->result_ok);
1065 LDKShutdownScript res_var = (*val->contents.result);
1066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1072 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1073 CHECK(!val->result_ok);
1074 LDKDecodeError err_var = (*val->contents.err);
1075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1081 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1084 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1085 CHECK(val->result_ok);
1086 LDKShutdownScript res_var = (*val->contents.result);
1087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1089 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1093 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1094 CHECK(!val->result_ok);
1095 LDKInvalidShutdownScript err_var = (*val->contents.err);
1096 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1097 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1098 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1102 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1105 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1106 CHECK(val->result_ok);
1107 return *val->contents.result;
1109 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1110 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1111 CHECK(!val->result_ok);
1112 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1116 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1119 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1120 CHECK(val->result_ok);
1121 LDKRouteHop res_var = (*val->contents.result);
1122 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1123 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1124 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1128 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1129 CHECK(!val->result_ok);
1130 LDKDecodeError err_var = (*val->contents.err);
1131 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1132 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1133 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1137 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1138 ret->datalen = (*env)->GetArrayLength(env, elems);
1139 if (ret->datalen == 0) {
1142 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1143 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1144 for (size_t i = 0; i < ret->datalen; i++) {
1145 int64_t arr_elem = java_elems[i];
1146 LDKRouteHop arr_elem_conv;
1147 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1148 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1149 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1150 ret->data[i] = arr_elem_conv;
1152 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1154 return (uint64_t)ret;
1156 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1157 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1158 for (size_t i = 0; i < ret.datalen; i++) {
1159 ret.data[i] = RouteHop_clone(&orig->data[i]);
1163 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1164 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1165 for (size_t i = 0; i < ret.datalen; i++) {
1166 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1171 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1174 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1175 CHECK(val->result_ok);
1176 LDKRoute res_var = (*val->contents.result);
1177 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1178 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1179 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1183 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1184 CHECK(!val->result_ok);
1185 LDKDecodeError err_var = (*val->contents.err);
1186 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1187 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1188 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1191 static jclass LDKCOption_u64Z_Some_class = NULL;
1192 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1193 static jclass LDKCOption_u64Z_None_class = NULL;
1194 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1196 LDKCOption_u64Z_Some_class =
1197 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1198 CHECK(LDKCOption_u64Z_Some_class != NULL);
1199 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1200 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1201 LDKCOption_u64Z_None_class =
1202 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1203 CHECK(LDKCOption_u64Z_None_class != NULL);
1204 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1205 CHECK(LDKCOption_u64Z_None_meth != NULL);
1207 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1208 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1210 case LDKCOption_u64Z_Some: {
1211 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1213 case LDKCOption_u64Z_None: {
1214 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1220 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1221 ret->datalen = (*env)->GetArrayLength(env, elems);
1222 if (ret->datalen == 0) {
1225 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1226 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1227 for (size_t i = 0; i < ret->datalen; i++) {
1228 int64_t arr_elem = java_elems[i];
1229 LDKChannelDetails arr_elem_conv;
1230 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1231 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1232 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1233 ret->data[i] = arr_elem_conv;
1235 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1237 return (uint64_t)ret;
1239 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1240 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1241 for (size_t i = 0; i < ret.datalen; i++) {
1242 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1247 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1248 ret->datalen = (*env)->GetArrayLength(env, elems);
1249 if (ret->datalen == 0) {
1252 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1253 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1254 for (size_t i = 0; i < ret->datalen; i++) {
1255 int64_t arr_elem = java_elems[i];
1256 LDKRouteHint arr_elem_conv;
1257 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1258 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1259 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1260 ret->data[i] = arr_elem_conv;
1262 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1264 return (uint64_t)ret;
1266 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1267 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1268 for (size_t i = 0; i < ret.datalen; i++) {
1269 ret.data[i] = RouteHint_clone(&orig->data[i]);
1273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1274 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1277 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1278 CHECK(val->result_ok);
1279 LDKRoute res_var = (*val->contents.result);
1280 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1281 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1282 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1286 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1287 CHECK(!val->result_ok);
1288 LDKLightningError err_var = (*val->contents.err);
1289 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1290 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1291 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1295 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1298 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1299 CHECK(val->result_ok);
1300 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1301 return (uint64_t)res_ref;
1303 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1304 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1305 CHECK(!val->result_ok);
1306 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1310 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1312 LDKTransaction b_ref;
1313 b_ref.datalen = (*env)->GetArrayLength(env, b);
1314 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1315 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1316 b_ref.data_is_owned = false;
1318 return (uint64_t)ret;
1320 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
1324 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1325 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(tuple_conv);
1329 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR tuple){
1332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
1333 LDKC2Tuple_usizeTransactionZ* tuple_conv = (LDKC2Tuple_usizeTransactionZ*)(tuple & ~1);
1334 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(tuple_conv);
1335 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1336 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1337 Transaction_free(ret_var);
1341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1342 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1343 ret->datalen = (*env)->GetArrayLength(env, elems);
1344 if (ret->datalen == 0) {
1347 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1348 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1349 for (size_t i = 0; i < ret->datalen; i++) {
1350 int64_t arr_elem = java_elems[i];
1351 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1352 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1353 ret->data[i] = arr_elem_conv;
1355 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1357 return (uint64_t)ret;
1359 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1360 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1361 for (size_t i = 0; i < ret.datalen; i++) {
1362 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1366 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1367 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1368 for (size_t i = 0; i < ret.datalen; i++) {
1369 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1374 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1377 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1378 CHECK(val->result_ok);
1379 return *val->contents.result;
1381 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1382 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1383 CHECK(!val->result_ok);
1384 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1387 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1388 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1389 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1390 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1392 LDKMonitorEvent_HTLCEvent_class =
1393 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1394 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1395 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1396 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1397 LDKMonitorEvent_CommitmentTxConfirmed_class =
1398 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
1399 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1400 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1401 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1403 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1404 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1406 case LDKMonitorEvent_HTLCEvent: {
1407 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1408 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1409 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1410 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1411 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1413 case LDKMonitorEvent_CommitmentTxConfirmed: {
1414 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1415 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1416 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1417 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1418 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1424 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1425 ret->datalen = (*env)->GetArrayLength(env, elems);
1426 if (ret->datalen == 0) {
1429 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1430 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1431 for (size_t i = 0; i < ret->datalen; i++) {
1432 int64_t arr_elem = java_elems[i];
1433 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1434 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1435 ret->data[i] = arr_elem_conv;
1437 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1439 return (uint64_t)ret;
1441 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1442 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1443 for (size_t i = 0; i < ret.datalen; i++) {
1444 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1448 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1449 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1450 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1451 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1453 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1454 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1455 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1456 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1457 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1458 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1459 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1460 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1461 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1462 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1464 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1465 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1467 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1468 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1469 *some_conv = obj->some;
1470 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1471 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((uint64_t)some_conv));
1473 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1474 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1479 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
1480 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
1481 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
1482 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
1483 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
1484 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
1485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
1486 LDKNetworkUpdate_ChannelUpdateMessage_class =
1487 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
1488 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
1489 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1490 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
1491 LDKNetworkUpdate_ChannelClosed_class =
1492 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
1493 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
1494 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1495 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
1496 LDKNetworkUpdate_NodeFailure_class =
1497 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
1498 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
1499 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
1500 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
1502 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1503 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1505 case LDKNetworkUpdate_ChannelUpdateMessage: {
1506 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1507 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1508 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1509 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1510 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
1512 case LDKNetworkUpdate_ChannelClosed: {
1513 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1515 case LDKNetworkUpdate_NodeFailure: {
1516 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1517 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1518 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1523 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
1524 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
1525 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
1526 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
1527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
1528 LDKCOption_NetworkUpdateZ_Some_class =
1529 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
1530 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
1531 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
1532 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
1533 LDKCOption_NetworkUpdateZ_None_class =
1534 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
1535 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
1536 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
1537 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
1539 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1540 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1542 case LDKCOption_NetworkUpdateZ_Some: {
1543 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1544 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
1546 case LDKCOption_NetworkUpdateZ_None: {
1547 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
1552 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1553 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1554 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1555 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1556 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1557 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1559 LDKSpendableOutputDescriptor_StaticOutput_class =
1560 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1561 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1562 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1563 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1564 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1565 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1566 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1567 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1568 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1569 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1570 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1571 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1572 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1573 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1575 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1576 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1578 case LDKSpendableOutputDescriptor_StaticOutput: {
1579 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1580 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1581 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1582 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1583 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1584 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1586 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1587 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1588 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1589 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1590 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1591 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1593 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1594 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1595 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1596 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1597 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1598 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1604 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1605 ret->datalen = (*env)->GetArrayLength(env, elems);
1606 if (ret->datalen == 0) {
1609 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1610 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1611 for (size_t i = 0; i < ret->datalen; i++) {
1612 int64_t arr_elem = java_elems[i];
1613 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1614 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1615 ret->data[i] = arr_elem_conv;
1617 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1619 return (uint64_t)ret;
1621 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1622 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1623 for (size_t i = 0; i < ret.datalen; i++) {
1624 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1628 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1629 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1630 static jclass LDKErrorAction_IgnoreError_class = NULL;
1631 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1632 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1633 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1634 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1635 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1637 LDKErrorAction_DisconnectPeer_class =
1638 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1639 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1640 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1641 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1642 LDKErrorAction_IgnoreError_class =
1643 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1644 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1645 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1646 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1647 LDKErrorAction_IgnoreAndLog_class =
1648 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1649 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1650 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1651 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1652 LDKErrorAction_SendErrorMessage_class =
1653 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1654 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1655 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1656 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1658 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1659 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1661 case LDKErrorAction_DisconnectPeer: {
1662 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1663 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1664 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1665 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1666 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1668 case LDKErrorAction_IgnoreError: {
1669 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1671 case LDKErrorAction_IgnoreAndLog: {
1672 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1673 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1675 case LDKErrorAction_SendErrorMessage: {
1676 LDKErrorMessage msg_var = obj->send_error_message.msg;
1677 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1678 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1679 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1680 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1685 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1686 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1687 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1688 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1689 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1690 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1691 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1692 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1693 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1694 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1695 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1696 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1697 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1698 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1699 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1700 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1701 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1702 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1703 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1704 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1705 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1706 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1707 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1708 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1709 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1710 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1711 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1712 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1713 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1714 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1715 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1716 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1717 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1718 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1719 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1720 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1721 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1722 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1724 LDKMessageSendEvent_SendAcceptChannel_class =
1725 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1726 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1727 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1728 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1729 LDKMessageSendEvent_SendOpenChannel_class =
1730 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1731 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1732 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1733 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1734 LDKMessageSendEvent_SendFundingCreated_class =
1735 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1736 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1737 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1738 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1739 LDKMessageSendEvent_SendFundingSigned_class =
1740 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1741 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1742 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1743 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1744 LDKMessageSendEvent_SendFundingLocked_class =
1745 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1746 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1747 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1748 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1749 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1751 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1752 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1753 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1754 LDKMessageSendEvent_UpdateHTLCs_class =
1755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1756 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1757 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1758 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1759 LDKMessageSendEvent_SendRevokeAndACK_class =
1760 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1761 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1762 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1763 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1764 LDKMessageSendEvent_SendClosingSigned_class =
1765 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1766 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1767 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1768 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1769 LDKMessageSendEvent_SendShutdown_class =
1770 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1771 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1772 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1773 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1774 LDKMessageSendEvent_SendChannelReestablish_class =
1775 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1776 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1777 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1778 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1779 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1780 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1781 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1782 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1783 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1784 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1785 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1786 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1787 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1788 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1789 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1790 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1791 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1792 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1793 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1794 LDKMessageSendEvent_SendChannelUpdate_class =
1795 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1796 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1797 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1798 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1799 LDKMessageSendEvent_HandleError_class =
1800 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1801 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1802 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1803 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1804 LDKMessageSendEvent_SendChannelRangeQuery_class =
1805 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1806 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1807 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1808 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1809 LDKMessageSendEvent_SendShortIdsQuery_class =
1810 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1811 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1812 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1813 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1814 LDKMessageSendEvent_SendReplyChannelRange_class =
1815 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1816 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1817 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1818 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1820 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1821 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1823 case LDKMessageSendEvent_SendAcceptChannel: {
1824 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1825 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1826 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1827 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1828 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1829 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1830 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1832 case LDKMessageSendEvent_SendOpenChannel: {
1833 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1834 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1835 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1836 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1837 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1838 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1839 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1841 case LDKMessageSendEvent_SendFundingCreated: {
1842 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1843 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1844 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1845 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1846 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1847 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1848 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1850 case LDKMessageSendEvent_SendFundingSigned: {
1851 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1852 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1853 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1854 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1855 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1856 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1857 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1859 case LDKMessageSendEvent_SendFundingLocked: {
1860 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1861 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1862 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1863 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1864 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1865 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1866 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1868 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1869 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1870 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1871 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1872 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1873 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1874 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1875 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1877 case LDKMessageSendEvent_UpdateHTLCs: {
1878 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1879 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1880 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1881 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1882 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1883 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1884 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1886 case LDKMessageSendEvent_SendRevokeAndACK: {
1887 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1888 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1889 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1890 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1891 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1892 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1893 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1895 case LDKMessageSendEvent_SendClosingSigned: {
1896 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1897 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1898 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1899 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1900 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1901 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1902 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1904 case LDKMessageSendEvent_SendShutdown: {
1905 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1906 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1907 LDKShutdown msg_var = obj->send_shutdown.msg;
1908 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1909 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1910 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1911 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1913 case LDKMessageSendEvent_SendChannelReestablish: {
1914 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1915 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1916 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1917 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1918 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1919 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1920 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1922 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1923 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1924 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1925 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1926 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1927 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1928 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1929 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1930 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1931 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1933 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1934 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1935 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1936 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1937 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1938 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1940 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1941 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1942 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1943 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1944 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1945 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1947 case LDKMessageSendEvent_SendChannelUpdate: {
1948 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1949 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1950 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1951 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1952 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1953 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1954 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1956 case LDKMessageSendEvent_HandleError: {
1957 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1958 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1959 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1960 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1962 case LDKMessageSendEvent_SendChannelRangeQuery: {
1963 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1964 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1965 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1966 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1967 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1968 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1969 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1971 case LDKMessageSendEvent_SendShortIdsQuery: {
1972 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1973 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1974 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1975 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1976 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1977 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1978 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1980 case LDKMessageSendEvent_SendReplyChannelRange: {
1981 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1982 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1983 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1984 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1985 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1986 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1987 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1993 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1994 ret->datalen = (*env)->GetArrayLength(env, elems);
1995 if (ret->datalen == 0) {
1998 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1999 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2000 for (size_t i = 0; i < ret->datalen; i++) {
2001 int64_t arr_elem = java_elems[i];
2002 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
2003 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
2004 ret->data[i] = arr_elem_conv;
2006 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2008 return (uint64_t)ret;
2010 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2011 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2012 for (size_t i = 0; i < ret.datalen; i++) {
2013 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2018 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2021 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2022 CHECK(val->result_ok);
2023 LDKInitFeatures res_var = (*val->contents.result);
2024 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2025 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2026 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2030 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2031 CHECK(!val->result_ok);
2032 LDKDecodeError err_var = (*val->contents.err);
2033 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2034 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2035 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2039 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2042 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2043 CHECK(val->result_ok);
2044 LDKNodeFeatures res_var = (*val->contents.result);
2045 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2046 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2047 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2051 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2052 CHECK(!val->result_ok);
2053 LDKDecodeError err_var = (*val->contents.err);
2054 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2055 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2056 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2060 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2063 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2064 CHECK(val->result_ok);
2065 LDKChannelFeatures res_var = (*val->contents.result);
2066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2072 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2073 CHECK(!val->result_ok);
2074 LDKDecodeError err_var = (*val->contents.err);
2075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2081 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2084 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2085 CHECK(val->result_ok);
2086 LDKInvoiceFeatures res_var = (*val->contents.result);
2087 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2088 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2089 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2093 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2094 CHECK(!val->result_ok);
2095 LDKDecodeError err_var = (*val->contents.err);
2096 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2097 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2098 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2102 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2105 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2106 CHECK(val->result_ok);
2107 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2108 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2109 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2110 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2114 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2115 CHECK(!val->result_ok);
2116 LDKDecodeError err_var = (*val->contents.err);
2117 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2118 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2119 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2123 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2126 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2127 CHECK(val->result_ok);
2128 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2129 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2130 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2131 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2135 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2136 CHECK(!val->result_ok);
2137 LDKDecodeError err_var = (*val->contents.err);
2138 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2139 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2140 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2144 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2147 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2148 CHECK(val->result_ok);
2149 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2153 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2154 CHECK(!val->result_ok);
2155 LDKDecodeError err_var = (*val->contents.err);
2156 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2157 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2158 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2162 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
2164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2165 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2166 CHECK(val->result_ok);
2167 return *val->contents.result;
2169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2170 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2171 CHECK(!val->result_ok);
2172 return *val->contents.err;
2174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2175 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2177 CHECK((*env)->GetArrayLength(env, a) == 64);
2178 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2180 LDKCVec_SignatureZ b_constr;
2181 b_constr.datalen = (*env)->GetArrayLength(env, b);
2182 if (b_constr.datalen > 0)
2183 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2185 b_constr.data = NULL;
2186 for (size_t i = 0; i < b_constr.datalen; i++) {
2187 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2188 LDKSignature b_conv_8_ref;
2189 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2190 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2191 b_constr.data[i] = b_conv_8_ref;
2194 return (uint64_t)ret;
2196 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2199 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
2200 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2201 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2202 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(tuple_conv).compact_form);
2206 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR tuple){
2209 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
2210 LDKC2Tuple_SignatureCVec_SignatureZZ* tuple_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(tuple & ~1);
2211 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(tuple_conv);
2212 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2214 for (size_t i = 0; i < ret_var.datalen; i++) {
2215 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2216 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2217 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2223 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2224 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2227 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2228 CHECK(val->result_ok);
2229 LDKC2Tuple_SignatureCVec_SignatureZZ* res_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2230 *res_conv = (*val->contents.result);
2231 *res_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(res_conv);
2232 return ((uint64_t)res_conv);
2234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2235 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2236 CHECK(!val->result_ok);
2237 return *val->contents.err;
2239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2240 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2243 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2244 CHECK(val->result_ok);
2245 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2246 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2250 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2251 CHECK(!val->result_ok);
2252 return *val->contents.err;
2254 typedef struct LDKBaseSign_JCalls {
2255 atomic_size_t refcnt;
2258 jmethodID get_per_commitment_point_meth;
2259 jmethodID release_commitment_secret_meth;
2260 jmethodID validate_holder_commitment_meth;
2261 jmethodID channel_keys_id_meth;
2262 jmethodID sign_counterparty_commitment_meth;
2263 jmethodID validate_counterparty_revocation_meth;
2264 jmethodID sign_holder_commitment_and_htlcs_meth;
2265 jmethodID sign_justice_revoked_output_meth;
2266 jmethodID sign_justice_revoked_htlc_meth;
2267 jmethodID sign_counterparty_htlc_transaction_meth;
2268 jmethodID sign_closing_transaction_meth;
2269 jmethodID sign_channel_announcement_meth;
2270 jmethodID ready_channel_meth;
2271 } LDKBaseSign_JCalls;
2272 static void LDKBaseSign_JCalls_free(void* this_arg) {
2273 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2274 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2276 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2277 if (get_jenv_res == JNI_EDETACHED) {
2278 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2280 DO_ASSERT(get_jenv_res == JNI_OK);
2282 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2283 if (get_jenv_res == JNI_EDETACHED) {
2284 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2289 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2290 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2292 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2293 if (get_jenv_res == JNI_EDETACHED) {
2294 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2296 DO_ASSERT(get_jenv_res == JNI_OK);
2298 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2300 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2301 if ((*env)->ExceptionCheck(env)) {
2302 (*env)->ExceptionDescribe(env);
2303 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2305 LDKPublicKey ret_ref;
2306 CHECK((*env)->GetArrayLength(env, ret) == 33);
2307 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2308 if (get_jenv_res == JNI_EDETACHED) {
2309 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2313 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2314 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2316 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2317 if (get_jenv_res == JNI_EDETACHED) {
2318 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2320 DO_ASSERT(get_jenv_res == JNI_OK);
2322 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2324 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2325 if ((*env)->ExceptionCheck(env)) {
2326 (*env)->ExceptionDescribe(env);
2327 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2329 LDKThirtyTwoBytes ret_ref;
2330 CHECK((*env)->GetArrayLength(env, ret) == 32);
2331 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2332 if (get_jenv_res == JNI_EDETACHED) {
2333 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2337 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
2338 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2340 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2341 if (get_jenv_res == JNI_EDETACHED) {
2342 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2344 DO_ASSERT(get_jenv_res == JNI_OK);
2346 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2347 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2348 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2349 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2350 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
2351 if (holder_tx_var.is_owned) {
2354 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2356 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
2357 if ((*env)->ExceptionCheck(env)) {
2358 (*env)->ExceptionDescribe(env);
2359 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
2361 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2362 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2363 if (get_jenv_res == JNI_EDETACHED) {
2364 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2368 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2369 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2371 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2372 if (get_jenv_res == JNI_EDETACHED) {
2373 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2375 DO_ASSERT(get_jenv_res == JNI_OK);
2377 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2379 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2380 if ((*env)->ExceptionCheck(env)) {
2381 (*env)->ExceptionDescribe(env);
2382 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2384 LDKThirtyTwoBytes ret_ref;
2385 CHECK((*env)->GetArrayLength(env, ret) == 32);
2386 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2387 if (get_jenv_res == JNI_EDETACHED) {
2388 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2392 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2393 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2395 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2396 if (get_jenv_res == JNI_EDETACHED) {
2397 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2399 DO_ASSERT(get_jenv_res == JNI_OK);
2401 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2402 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2403 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2404 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2405 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2406 if (commitment_tx_var.is_owned) {
2407 commitment_tx_ref |= 1;
2409 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2411 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2412 if ((*env)->ExceptionCheck(env)) {
2413 (*env)->ExceptionDescribe(env);
2414 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2416 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2417 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2418 if (get_jenv_res == JNI_EDETACHED) {
2419 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2423 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2424 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2426 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2427 if (get_jenv_res == JNI_EDETACHED) {
2428 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2430 DO_ASSERT(get_jenv_res == JNI_OK);
2432 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2433 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2434 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2436 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
2437 if ((*env)->ExceptionCheck(env)) {
2438 (*env)->ExceptionDescribe(env);
2439 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
2441 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2442 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2443 if (get_jenv_res == JNI_EDETACHED) {
2444 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2448 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2449 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2451 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2452 if (get_jenv_res == JNI_EDETACHED) {
2453 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2455 DO_ASSERT(get_jenv_res == JNI_OK);
2457 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2458 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2459 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2460 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2461 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2462 if (commitment_tx_var.is_owned) {
2463 commitment_tx_ref |= 1;
2465 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2467 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2468 if ((*env)->ExceptionCheck(env)) {
2469 (*env)->ExceptionDescribe(env);
2470 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2472 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2473 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2474 if (get_jenv_res == JNI_EDETACHED) {
2475 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2479 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]) {
2480 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2482 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2483 if (get_jenv_res == JNI_EDETACHED) {
2484 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2486 DO_ASSERT(get_jenv_res == JNI_OK);
2488 LDKTransaction justice_tx_var = justice_tx;
2489 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2490 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2491 Transaction_free(justice_tx_var);
2492 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2493 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2494 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2496 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2497 if ((*env)->ExceptionCheck(env)) {
2498 (*env)->ExceptionDescribe(env);
2499 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2501 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2502 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2503 if (get_jenv_res == JNI_EDETACHED) {
2504 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2508 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) {
2509 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2511 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2512 if (get_jenv_res == JNI_EDETACHED) {
2513 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2515 DO_ASSERT(get_jenv_res == JNI_OK);
2517 LDKTransaction justice_tx_var = justice_tx;
2518 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2519 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2520 Transaction_free(justice_tx_var);
2521 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2522 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2523 LDKHTLCOutputInCommitment htlc_var = *htlc;
2524 htlc_var = HTLCOutputInCommitment_clone(htlc);
2525 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2526 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2527 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2528 if (htlc_var.is_owned) {
2531 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2533 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2534 if ((*env)->ExceptionCheck(env)) {
2535 (*env)->ExceptionDescribe(env);
2536 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2538 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2539 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2540 if (get_jenv_res == JNI_EDETACHED) {
2541 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2545 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) {
2546 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2548 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2549 if (get_jenv_res == JNI_EDETACHED) {
2550 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2552 DO_ASSERT(get_jenv_res == JNI_OK);
2554 LDKTransaction htlc_tx_var = htlc_tx;
2555 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2556 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2557 Transaction_free(htlc_tx_var);
2558 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2559 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2560 LDKHTLCOutputInCommitment htlc_var = *htlc;
2561 htlc_var = HTLCOutputInCommitment_clone(htlc);
2562 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2563 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2564 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2565 if (htlc_var.is_owned) {
2568 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2570 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2571 if ((*env)->ExceptionCheck(env)) {
2572 (*env)->ExceptionDescribe(env);
2573 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2575 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2576 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2577 if (get_jenv_res == JNI_EDETACHED) {
2578 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2582 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2583 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2585 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2586 if (get_jenv_res == JNI_EDETACHED) {
2587 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2589 DO_ASSERT(get_jenv_res == JNI_OK);
2591 LDKClosingTransaction closing_tx_var = *closing_tx;
2592 // Warning: we may need a move here but no clone is available for LDKClosingTransaction
2593 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2594 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2595 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
2596 if (closing_tx_var.is_owned) {
2597 closing_tx_ref |= 1;
2599 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2601 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2602 if ((*env)->ExceptionCheck(env)) {
2603 (*env)->ExceptionDescribe(env);
2604 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2606 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2607 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2608 if (get_jenv_res == JNI_EDETACHED) {
2609 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2613 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2614 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2616 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2617 if (get_jenv_res == JNI_EDETACHED) {
2618 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2620 DO_ASSERT(get_jenv_res == JNI_OK);
2622 LDKUnsignedChannelAnnouncement msg_var = *msg;
2623 msg_var = UnsignedChannelAnnouncement_clone(msg);
2624 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2625 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2626 uint64_t msg_ref = (uint64_t)msg_var.inner;
2627 if (msg_var.is_owned) {
2630 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2632 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2633 if ((*env)->ExceptionCheck(env)) {
2634 (*env)->ExceptionDescribe(env);
2635 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2637 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2638 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2639 if (get_jenv_res == JNI_EDETACHED) {
2640 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2644 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2645 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2647 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2648 if (get_jenv_res == JNI_EDETACHED) {
2649 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2651 DO_ASSERT(get_jenv_res == JNI_OK);
2653 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2654 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2655 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2656 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2657 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2658 if (channel_parameters_var.is_owned) {
2659 channel_parameters_ref |= 1;
2661 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2663 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2664 if ((*env)->ExceptionCheck(env)) {
2665 (*env)->ExceptionDescribe(env);
2666 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2668 if (get_jenv_res == JNI_EDETACHED) {
2669 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2672 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2673 jclass c = (*env)->GetObjectClass(env, o);
2675 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2676 atomic_init(&calls->refcnt, 1);
2677 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2678 calls->o = (*env)->NewWeakGlobalRef(env, o);
2679 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2680 CHECK(calls->get_per_commitment_point_meth != NULL);
2681 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2682 CHECK(calls->release_commitment_secret_meth != NULL);
2683 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
2684 CHECK(calls->validate_holder_commitment_meth != NULL);
2685 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2686 CHECK(calls->channel_keys_id_meth != NULL);
2687 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2688 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2689 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2690 CHECK(calls->validate_counterparty_revocation_meth != NULL);
2691 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2692 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2693 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2694 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2695 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2696 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2697 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2698 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2699 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2700 CHECK(calls->sign_closing_transaction_meth != NULL);
2701 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2702 CHECK(calls->sign_channel_announcement_meth != NULL);
2703 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2704 CHECK(calls->ready_channel_meth != NULL);
2706 LDKChannelPublicKeys pubkeys_conv;
2707 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2708 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2709 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2712 .this_arg = (void*) calls,
2713 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2714 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2715 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2716 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2717 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2718 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2719 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2720 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2721 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2722 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2723 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2724 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2725 .ready_channel = ready_channel_LDKBaseSign_jcall,
2726 .free = LDKBaseSign_JCalls_free,
2727 .pubkeys = pubkeys_conv,
2728 .set_pubkeys = NULL,
2732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2733 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2734 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2735 return (uint64_t)res_ptr;
2737 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) {
2738 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2739 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2740 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2745 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2746 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2747 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx) {
2752 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2753 LDKHolderCommitmentTransaction holder_tx_conv;
2754 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2755 holder_tx_conv.is_owned = false;
2756 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2757 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2758 return (uint64_t)ret_conv;
2761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2762 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2763 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2764 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2768 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) {
2769 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2770 LDKCommitmentTransaction commitment_tx_conv;
2771 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2772 commitment_tx_conv.is_owned = false;
2773 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2774 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2775 return (uint64_t)ret_conv;
2778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
2779 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2780 unsigned char secret_arr[32];
2781 CHECK((*env)->GetArrayLength(env, secret) == 32);
2782 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
2783 unsigned char (*secret_ref)[32] = &secret_arr;
2784 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2785 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2786 return (uint64_t)ret_conv;
2789 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) {
2790 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2791 LDKHolderCommitmentTransaction commitment_tx_conv;
2792 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2793 commitment_tx_conv.is_owned = false;
2794 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2795 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2796 return (uint64_t)ret_conv;
2799 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) {
2800 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2801 LDKTransaction justice_tx_ref;
2802 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2803 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2804 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2805 justice_tx_ref.data_is_owned = true;
2806 unsigned char per_commitment_key_arr[32];
2807 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2808 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2809 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2810 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2811 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2812 return (uint64_t)ret_conv;
2815 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) {
2816 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2817 LDKTransaction justice_tx_ref;
2818 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2819 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2820 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2821 justice_tx_ref.data_is_owned = true;
2822 unsigned char per_commitment_key_arr[32];
2823 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2824 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2825 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2826 LDKHTLCOutputInCommitment htlc_conv;
2827 htlc_conv.inner = (void*)(htlc & (~1));
2828 htlc_conv.is_owned = false;
2829 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2830 *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);
2831 return (uint64_t)ret_conv;
2834 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) {
2835 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2836 LDKTransaction htlc_tx_ref;
2837 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2838 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2839 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2840 htlc_tx_ref.data_is_owned = true;
2841 LDKPublicKey per_commitment_point_ref;
2842 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2843 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2844 LDKHTLCOutputInCommitment htlc_conv;
2845 htlc_conv.inner = (void*)(htlc & (~1));
2846 htlc_conv.is_owned = false;
2847 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2848 *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);
2849 return (uint64_t)ret_conv;
2852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
2853 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2854 LDKClosingTransaction closing_tx_conv;
2855 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2856 closing_tx_conv.is_owned = false;
2857 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2858 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2859 return (uint64_t)ret_conv;
2862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2863 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2864 LDKUnsignedChannelAnnouncement msg_conv;
2865 msg_conv.inner = (void*)(msg & (~1));
2866 msg_conv.is_owned = false;
2867 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2868 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2869 return (uint64_t)ret_conv;
2872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2873 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2874 LDKChannelTransactionParameters channel_parameters_conv;
2875 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2876 channel_parameters_conv.is_owned = false;
2877 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2880 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2881 if (this_arg->set_pubkeys != NULL)
2882 this_arg->set_pubkeys(this_arg);
2883 return this_arg->pubkeys;
2885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2886 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2887 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2888 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2889 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2890 uint64_t ret_ref = (uint64_t)ret_var.inner;
2891 if (ret_var.is_owned) {
2897 typedef struct LDKSign_JCalls {
2898 atomic_size_t refcnt;
2901 LDKBaseSign_JCalls* BaseSign;
2902 jmethodID write_meth;
2904 static void LDKSign_JCalls_free(void* this_arg) {
2905 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2906 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2908 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2909 if (get_jenv_res == JNI_EDETACHED) {
2910 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2912 DO_ASSERT(get_jenv_res == JNI_OK);
2914 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2915 if (get_jenv_res == JNI_EDETACHED) {
2916 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2921 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2922 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2924 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2925 if (get_jenv_res == JNI_EDETACHED) {
2926 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2928 DO_ASSERT(get_jenv_res == JNI_OK);
2930 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2932 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2933 if ((*env)->ExceptionCheck(env)) {
2934 (*env)->ExceptionDescribe(env);
2935 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2937 LDKCVec_u8Z ret_ref;
2938 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2939 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2940 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2941 if (get_jenv_res == JNI_EDETACHED) {
2942 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2946 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2947 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2948 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2949 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2951 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2952 jclass c = (*env)->GetObjectClass(env, o);
2954 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2955 atomic_init(&calls->refcnt, 1);
2956 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2957 calls->o = (*env)->NewWeakGlobalRef(env, o);
2958 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2959 CHECK(calls->write_meth != NULL);
2961 LDKChannelPublicKeys pubkeys_conv;
2962 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2963 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2964 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2967 .this_arg = (void*) calls,
2968 .write = write_LDKSign_jcall,
2969 .cloned = LDKSign_JCalls_cloned,
2970 .free = LDKSign_JCalls_free,
2971 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2973 calls->BaseSign = ret.BaseSign.this_arg;
2976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2977 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2978 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2979 return (uint64_t)res_ptr;
2981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
2982 LDKSign *inp = (LDKSign *)(arg & ~1);
2983 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
2984 DO_ASSERT((res_ptr & 1) == 0);
2985 return (int64_t)(res_ptr | 1);
2987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2988 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2989 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2990 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2991 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2992 CVec_u8Z_free(ret_var);
2996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2997 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3000 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3001 CHECK(val->result_ok);
3002 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
3003 *res_ret = Sign_clone(&(*val->contents.result));
3004 return (uint64_t)res_ret;
3006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3007 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
3008 CHECK(!val->result_ok);
3009 LDKDecodeError err_var = (*val->contents.err);
3010 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3011 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3012 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3016 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
3018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3019 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3020 CHECK(val->result_ok);
3021 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
3022 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
3025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3026 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3027 CHECK(!val->result_ok);
3028 return *val->contents.err;
3030 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3031 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3032 for (size_t i = 0; i < ret.datalen; i++) {
3033 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3038 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3040 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3041 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3042 CHECK(val->result_ok);
3043 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3044 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3046 for (size_t i = 0; i < res_var.datalen; i++) {
3047 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3048 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3049 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3050 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3055 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3056 CHECK(!val->result_ok);
3057 return *val->contents.err;
3059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3060 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3063 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3064 CHECK(val->result_ok);
3065 LDKInMemorySigner res_var = (*val->contents.result);
3066 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3067 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3068 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3072 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3073 CHECK(!val->result_ok);
3074 LDKDecodeError err_var = (*val->contents.err);
3075 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3076 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3077 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3081 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3082 ret->datalen = (*env)->GetArrayLength(env, elems);
3083 if (ret->datalen == 0) {
3086 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3087 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3088 for (size_t i = 0; i < ret->datalen; i++) {
3089 int64_t arr_elem = java_elems[i];
3090 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3091 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3092 ret->data[i] = arr_elem_conv;
3094 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3096 return (uint64_t)ret;
3098 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3099 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3100 for (size_t i = 0; i < ret.datalen; i++) {
3101 ret.data[i] = TxOut_clone(&orig->data[i]);
3105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3106 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3109 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3110 CHECK(val->result_ok);
3111 LDKTransaction res_var = (*val->contents.result);
3112 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3113 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3117 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3118 CHECK(!val->result_ok);
3119 return *val->contents.err;
3121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3122 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3123 LDKThirtyTwoBytes a_ref;
3124 CHECK((*env)->GetArrayLength(env, a) == 32);
3125 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3127 LDKChannelMonitor b_conv;
3128 b_conv.inner = (void*)(b & (~1));
3129 b_conv.is_owned = (b & 1) || (b == 0);
3130 b_conv = ChannelMonitor_clone(&b_conv);
3132 return (uint64_t)ret;
3134 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3135 return ThirtyTwoBytes_clone(&tuple->a);
3137 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3138 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3139 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3140 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(tuple_conv).data);
3144 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR tuple){
3145 return ChannelMonitor_clone(&tuple->b);
3147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3148 LDKC2Tuple_BlockHashChannelMonitorZ* tuple_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(tuple & ~1);
3149 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(tuple_conv);
3150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3152 uint64_t ret_ref = (uint64_t)ret_var.inner;
3153 if (ret_var.is_owned) {
3159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3160 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3161 ret->datalen = (*env)->GetArrayLength(env, elems);
3162 if (ret->datalen == 0) {
3165 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3166 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3167 for (size_t i = 0; i < ret->datalen; i++) {
3168 int64_t arr_elem = java_elems[i];
3169 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
3170 arr_elem_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1));
3171 ret->data[i] = arr_elem_conv;
3173 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3175 return (uint64_t)ret;
3177 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
3178 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
3179 for (size_t i = 0; i < ret.datalen; i++) {
3180 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
3184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3185 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3187 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3188 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3189 CHECK(val->result_ok);
3190 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3191 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3192 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3193 for (size_t j = 0; j < res_var.datalen; j++) {
3194 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3195 *res_conv_35_conv = res_var.data[j];
3196 *res_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv_35_conv);
3197 res_arr_ptr[j] = ((uint64_t)res_conv_35_conv);
3199 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3202 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3203 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3204 CHECK(!val->result_ok);
3205 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3208 static jclass LDKCOption_u16Z_Some_class = NULL;
3209 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3210 static jclass LDKCOption_u16Z_None_class = NULL;
3211 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3213 LDKCOption_u16Z_Some_class =
3214 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3215 CHECK(LDKCOption_u16Z_Some_class != NULL);
3216 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3217 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3218 LDKCOption_u16Z_None_class =
3219 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3220 CHECK(LDKCOption_u16Z_None_class != NULL);
3221 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3222 CHECK(LDKCOption_u16Z_None_meth != NULL);
3224 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3225 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3227 case LDKCOption_u16Z_Some: {
3228 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3230 case LDKCOption_u16Z_None: {
3231 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3236 static jclass LDKAPIError_APIMisuseError_class = NULL;
3237 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3238 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3239 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3240 static jclass LDKAPIError_RouteError_class = NULL;
3241 static jmethodID LDKAPIError_RouteError_meth = NULL;
3242 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3243 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3244 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3245 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3246 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3247 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3249 LDKAPIError_APIMisuseError_class =
3250 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3251 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3252 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3253 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3254 LDKAPIError_FeeRateTooHigh_class =
3255 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3256 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3257 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3258 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3259 LDKAPIError_RouteError_class =
3260 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3261 CHECK(LDKAPIError_RouteError_class != NULL);
3262 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3263 CHECK(LDKAPIError_RouteError_meth != NULL);
3264 LDKAPIError_ChannelUnavailable_class =
3265 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3266 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3267 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3268 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3269 LDKAPIError_MonitorUpdateFailed_class =
3270 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3271 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3272 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3273 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3274 LDKAPIError_IncompatibleShutdownScript_class =
3275 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3276 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3277 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3278 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3280 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3281 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3283 case LDKAPIError_APIMisuseError: {
3284 LDKStr err_str = obj->api_misuse_error.err;
3285 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3286 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3288 case LDKAPIError_FeeRateTooHigh: {
3289 LDKStr err_str = obj->fee_rate_too_high.err;
3290 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3291 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3293 case LDKAPIError_RouteError: {
3294 LDKStr err_str = obj->route_error.err;
3295 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3296 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3298 case LDKAPIError_ChannelUnavailable: {
3299 LDKStr err_str = obj->channel_unavailable.err;
3300 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3301 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3303 case LDKAPIError_MonitorUpdateFailed: {
3304 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3306 case LDKAPIError_IncompatibleShutdownScript: {
3307 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3308 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3309 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3310 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
3311 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3317 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3320 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3321 CHECK(val->result_ok);
3322 return *val->contents.result;
3324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3325 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3326 CHECK(!val->result_ok);
3327 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3331 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3332 ret->datalen = (*env)->GetArrayLength(env, elems);
3333 if (ret->datalen == 0) {
3336 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3337 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3338 for (size_t i = 0; i < ret->datalen; i++) {
3339 int64_t arr_elem = java_elems[i];
3340 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3341 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3342 ret->data[i] = arr_elem_conv;
3344 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3346 return (uint64_t)ret;
3348 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3349 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3350 for (size_t i = 0; i < ret.datalen; i++) {
3351 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3356 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3357 ret->datalen = (*env)->GetArrayLength(env, elems);
3358 if (ret->datalen == 0) {
3361 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3362 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3363 for (size_t i = 0; i < ret->datalen; i++) {
3364 int64_t arr_elem = java_elems[i];
3365 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3366 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3367 ret->data[i] = arr_elem_conv;
3369 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3371 return (uint64_t)ret;
3373 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3374 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3375 for (size_t i = 0; i < ret.datalen; i++) {
3376 ret.data[i] = APIError_clone(&orig->data[i]);
3380 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3381 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3382 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3383 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3384 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3385 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3386 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3387 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3389 LDKPaymentSendFailure_ParameterError_class =
3390 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3391 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3392 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3393 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3394 LDKPaymentSendFailure_PathParameterError_class =
3395 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3396 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3397 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3398 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3399 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3400 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3401 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3402 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3403 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3404 LDKPaymentSendFailure_PartialFailure_class =
3405 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3406 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3407 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3408 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3410 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3411 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3413 case LDKPaymentSendFailure_ParameterError: {
3414 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3415 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3417 case LDKPaymentSendFailure_PathParameterError: {
3418 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3419 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3420 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3421 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3422 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3423 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3424 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3425 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3427 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3428 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3430 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3431 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3432 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3433 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3434 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3435 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3436 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3438 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3439 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3441 case LDKPaymentSendFailure_PartialFailure: {
3442 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3443 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3444 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3445 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3446 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3447 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3448 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3449 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3451 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3452 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3457 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3458 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3461 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3462 CHECK(val->result_ok);
3463 return *val->contents.result;
3465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3466 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3467 CHECK(!val->result_ok);
3468 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3472 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
3474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3475 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3476 CHECK(val->result_ok);
3477 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3478 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3482 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3483 CHECK(!val->result_ok);
3484 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3487 static jclass LDKNetAddress_IPv4_class = NULL;
3488 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3489 static jclass LDKNetAddress_IPv6_class = NULL;
3490 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3491 static jclass LDKNetAddress_OnionV2_class = NULL;
3492 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3493 static jclass LDKNetAddress_OnionV3_class = NULL;
3494 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3496 LDKNetAddress_IPv4_class =
3497 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3498 CHECK(LDKNetAddress_IPv4_class != NULL);
3499 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3500 CHECK(LDKNetAddress_IPv4_meth != NULL);
3501 LDKNetAddress_IPv6_class =
3502 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3503 CHECK(LDKNetAddress_IPv6_class != NULL);
3504 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3505 CHECK(LDKNetAddress_IPv6_meth != NULL);
3506 LDKNetAddress_OnionV2_class =
3507 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3508 CHECK(LDKNetAddress_OnionV2_class != NULL);
3509 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3510 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3511 LDKNetAddress_OnionV3_class =
3512 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3513 CHECK(LDKNetAddress_OnionV3_class != NULL);
3514 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3515 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3517 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3518 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3520 case LDKNetAddress_IPv4: {
3521 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3522 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3523 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3525 case LDKNetAddress_IPv6: {
3526 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3527 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3528 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3530 case LDKNetAddress_OnionV2: {
3531 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3532 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3533 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3535 case LDKNetAddress_OnionV3: {
3536 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3537 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3538 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);
3543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3544 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3545 ret->datalen = (*env)->GetArrayLength(env, elems);
3546 if (ret->datalen == 0) {
3549 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3550 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3551 for (size_t i = 0; i < ret->datalen; i++) {
3552 int64_t arr_elem = java_elems[i];
3553 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3554 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3555 ret->data[i] = arr_elem_conv;
3557 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3559 return (uint64_t)ret;
3561 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3562 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3563 for (size_t i = 0; i < ret.datalen; i++) {
3564 ret.data[i] = NetAddress_clone(&orig->data[i]);
3568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3569 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3570 LDKThirtyTwoBytes a_ref;
3571 CHECK((*env)->GetArrayLength(env, a) == 32);
3572 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3574 LDKThirtyTwoBytes b_ref;
3575 CHECK((*env)->GetArrayLength(env, b) == 32);
3576 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3578 return (uint64_t)ret;
3580 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3581 return ThirtyTwoBytes_clone(&tuple->a);
3583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
3584 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3585 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3586 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(tuple_conv).data);
3590 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple){
3591 return ThirtyTwoBytes_clone(&tuple->b);
3593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
3594 LDKC2Tuple_PaymentHashPaymentSecretZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(tuple & ~1);
3595 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3596 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple_conv).data);
3600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3601 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3604 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3605 CHECK(val->result_ok);
3606 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3607 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3611 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3612 CHECK(!val->result_ok);
3613 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3617 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3618 ret->datalen = (*env)->GetArrayLength(env, elems);
3619 if (ret->datalen == 0) {
3622 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3623 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3624 for (size_t i = 0; i < ret->datalen; i++) {
3625 int64_t arr_elem = java_elems[i];
3626 LDKChannelMonitor arr_elem_conv;
3627 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3628 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3629 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3630 ret->data[i] = arr_elem_conv;
3632 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3634 return (uint64_t)ret;
3636 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3637 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3638 for (size_t i = 0; i < ret.datalen; i++) {
3639 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3643 typedef struct LDKWatch_JCalls {
3644 atomic_size_t refcnt;
3647 jmethodID watch_channel_meth;
3648 jmethodID update_channel_meth;
3649 jmethodID release_pending_monitor_events_meth;
3651 static void LDKWatch_JCalls_free(void* this_arg) {
3652 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3653 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3662 if (get_jenv_res == JNI_EDETACHED) {
3663 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3668 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3669 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3671 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3672 if (get_jenv_res == JNI_EDETACHED) {
3673 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3675 DO_ASSERT(get_jenv_res == JNI_OK);
3677 LDKOutPoint funding_txo_var = funding_txo;
3678 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3679 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3680 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3681 if (funding_txo_var.is_owned) {
3682 funding_txo_ref |= 1;
3684 LDKChannelMonitor monitor_var = monitor;
3685 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3686 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3687 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3688 if (monitor_var.is_owned) {
3691 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3693 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3694 if ((*env)->ExceptionCheck(env)) {
3695 (*env)->ExceptionDescribe(env);
3696 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3698 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3699 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3700 if (get_jenv_res == JNI_EDETACHED) {
3701 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3705 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3706 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3708 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3709 if (get_jenv_res == JNI_EDETACHED) {
3710 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3712 DO_ASSERT(get_jenv_res == JNI_OK);
3714 LDKOutPoint funding_txo_var = funding_txo;
3715 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3716 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3717 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3718 if (funding_txo_var.is_owned) {
3719 funding_txo_ref |= 1;
3721 LDKChannelMonitorUpdate update_var = update;
3722 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3723 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3724 uint64_t update_ref = (uint64_t)update_var.inner;
3725 if (update_var.is_owned) {
3728 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3730 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3731 if ((*env)->ExceptionCheck(env)) {
3732 (*env)->ExceptionDescribe(env);
3733 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3735 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3736 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3737 if (get_jenv_res == JNI_EDETACHED) {
3738 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3742 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3743 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3745 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3746 if (get_jenv_res == JNI_EDETACHED) {
3747 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3749 DO_ASSERT(get_jenv_res == JNI_OK);
3751 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3753 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3754 if ((*env)->ExceptionCheck(env)) {
3755 (*env)->ExceptionDescribe(env);
3756 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
3758 LDKCVec_MonitorEventZ ret_constr;
3759 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3760 if (ret_constr.datalen > 0)
3761 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3763 ret_constr.data = NULL;
3764 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3765 for (size_t o = 0; o < ret_constr.datalen; o++) {
3766 int64_t ret_conv_14 = ret_vals[o];
3767 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3768 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3769 ret_constr.data[o] = ret_conv_14_conv;
3771 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3772 if (get_jenv_res == JNI_EDETACHED) {
3773 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3777 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3778 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3779 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3781 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3782 jclass c = (*env)->GetObjectClass(env, o);
3784 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3785 atomic_init(&calls->refcnt, 1);
3786 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3787 calls->o = (*env)->NewWeakGlobalRef(env, o);
3788 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3789 CHECK(calls->watch_channel_meth != NULL);
3790 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3791 CHECK(calls->update_channel_meth != NULL);
3792 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3793 CHECK(calls->release_pending_monitor_events_meth != NULL);
3796 .this_arg = (void*) calls,
3797 .watch_channel = watch_channel_LDKWatch_jcall,
3798 .update_channel = update_channel_LDKWatch_jcall,
3799 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3800 .free = LDKWatch_JCalls_free,
3804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3805 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3806 *res_ptr = LDKWatch_init(env, clz, o);
3807 return (uint64_t)res_ptr;
3809 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) {
3810 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3811 LDKOutPoint funding_txo_conv;
3812 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3813 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3814 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3815 LDKChannelMonitor monitor_conv;
3816 monitor_conv.inner = (void*)(monitor & (~1));
3817 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3818 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3819 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3820 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3821 return (uint64_t)ret_conv;
3824 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) {
3825 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3826 LDKOutPoint funding_txo_conv;
3827 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3828 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3829 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3830 LDKChannelMonitorUpdate update_conv;
3831 update_conv.inner = (void*)(update & (~1));
3832 update_conv.is_owned = (update & 1) || (update == 0);
3833 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3834 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3835 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3836 return (uint64_t)ret_conv;
3839 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3840 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3841 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3842 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3843 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3844 for (size_t o = 0; o < ret_var.datalen; o++) {
3845 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3846 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3847 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3848 ret_arr_ptr[o] = ret_conv_14_ref;
3850 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3855 typedef struct LDKBroadcasterInterface_JCalls {
3856 atomic_size_t refcnt;
3859 jmethodID broadcast_transaction_meth;
3860 } LDKBroadcasterInterface_JCalls;
3861 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3862 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3863 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3865 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3866 if (get_jenv_res == JNI_EDETACHED) {
3867 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3869 DO_ASSERT(get_jenv_res == JNI_OK);
3871 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3872 if (get_jenv_res == JNI_EDETACHED) {
3873 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3878 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3879 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3881 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3882 if (get_jenv_res == JNI_EDETACHED) {
3883 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3885 DO_ASSERT(get_jenv_res == JNI_OK);
3887 LDKTransaction tx_var = tx;
3888 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3889 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3890 Transaction_free(tx_var);
3891 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3893 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3894 if ((*env)->ExceptionCheck(env)) {
3895 (*env)->ExceptionDescribe(env);
3896 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
3898 if (get_jenv_res == JNI_EDETACHED) {
3899 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3902 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3903 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3904 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3906 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3907 jclass c = (*env)->GetObjectClass(env, o);
3909 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3910 atomic_init(&calls->refcnt, 1);
3911 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3912 calls->o = (*env)->NewWeakGlobalRef(env, o);
3913 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3914 CHECK(calls->broadcast_transaction_meth != NULL);
3916 LDKBroadcasterInterface ret = {
3917 .this_arg = (void*) calls,
3918 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3919 .free = LDKBroadcasterInterface_JCalls_free,
3923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3924 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3925 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3926 return (uint64_t)res_ptr;
3928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3929 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3930 LDKTransaction tx_ref;
3931 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3932 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3933 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3934 tx_ref.data_is_owned = true;
3935 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3938 typedef struct LDKKeysInterface_JCalls {
3939 atomic_size_t refcnt;
3942 jmethodID get_node_secret_meth;
3943 jmethodID get_destination_script_meth;
3944 jmethodID get_shutdown_scriptpubkey_meth;
3945 jmethodID get_channel_signer_meth;
3946 jmethodID get_secure_random_bytes_meth;
3947 jmethodID read_chan_signer_meth;
3948 jmethodID sign_invoice_meth;
3949 } LDKKeysInterface_JCalls;
3950 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3951 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3952 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3954 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3955 if (get_jenv_res == JNI_EDETACHED) {
3956 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3958 DO_ASSERT(get_jenv_res == JNI_OK);
3960 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3961 if (get_jenv_res == JNI_EDETACHED) {
3962 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3967 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3968 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3970 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3971 if (get_jenv_res == JNI_EDETACHED) {
3972 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3974 DO_ASSERT(get_jenv_res == JNI_OK);
3976 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3978 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3979 if ((*env)->ExceptionCheck(env)) {
3980 (*env)->ExceptionDescribe(env);
3981 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
3983 LDKSecretKey ret_ref;
3984 CHECK((*env)->GetArrayLength(env, ret) == 32);
3985 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3986 if (get_jenv_res == JNI_EDETACHED) {
3987 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3991 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3992 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3994 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3995 if (get_jenv_res == JNI_EDETACHED) {
3996 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3998 DO_ASSERT(get_jenv_res == JNI_OK);
4000 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4002 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
4003 if ((*env)->ExceptionCheck(env)) {
4004 (*env)->ExceptionDescribe(env);
4005 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
4007 LDKCVec_u8Z ret_ref;
4008 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4009 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4010 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4011 if (get_jenv_res == JNI_EDETACHED) {
4012 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4016 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
4017 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4019 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4020 if (get_jenv_res == JNI_EDETACHED) {
4021 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4023 DO_ASSERT(get_jenv_res == JNI_OK);
4025 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4027 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
4028 if ((*env)->ExceptionCheck(env)) {
4029 (*env)->ExceptionDescribe(env);
4030 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
4032 LDKShutdownScript ret_conv;
4033 ret_conv.inner = (void*)(ret & (~1));
4034 ret_conv.is_owned = (ret & 1) || (ret == 0);
4035 ret_conv = ShutdownScript_clone(&ret_conv);
4036 if (get_jenv_res == JNI_EDETACHED) {
4037 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4041 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
4042 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4044 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4045 if (get_jenv_res == JNI_EDETACHED) {
4046 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4048 DO_ASSERT(get_jenv_res == JNI_OK);
4050 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4052 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
4053 if ((*env)->ExceptionCheck(env)) {
4054 (*env)->ExceptionDescribe(env);
4055 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
4057 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
4058 ret_conv = Sign_clone(&ret_conv);
4059 if (get_jenv_res == JNI_EDETACHED) {
4060 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4064 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4065 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4067 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4068 if (get_jenv_res == JNI_EDETACHED) {
4069 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4071 DO_ASSERT(get_jenv_res == JNI_OK);
4073 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4075 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
4076 if ((*env)->ExceptionCheck(env)) {
4077 (*env)->ExceptionDescribe(env);
4078 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
4080 LDKThirtyTwoBytes ret_ref;
4081 CHECK((*env)->GetArrayLength(env, ret) == 32);
4082 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4083 if (get_jenv_res == JNI_EDETACHED) {
4084 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4088 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4089 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4091 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4092 if (get_jenv_res == JNI_EDETACHED) {
4093 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4095 DO_ASSERT(get_jenv_res == JNI_OK);
4097 LDKu8slice reader_var = reader;
4098 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
4099 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
4100 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4102 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
4103 if ((*env)->ExceptionCheck(env)) {
4104 (*env)->ExceptionDescribe(env);
4105 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
4107 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
4108 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
4109 if (get_jenv_res == JNI_EDETACHED) {
4110 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4114 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
4115 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4117 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4118 if (get_jenv_res == JNI_EDETACHED) {
4119 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4121 DO_ASSERT(get_jenv_res == JNI_OK);
4123 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
4124 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
4125 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
4126 CVec_u8Z_free(invoice_preimage_var);
4127 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4129 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
4130 if ((*env)->ExceptionCheck(env)) {
4131 (*env)->ExceptionDescribe(env);
4132 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
4134 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
4135 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
4136 if (get_jenv_res == JNI_EDETACHED) {
4137 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4141 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4142 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4143 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4145 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4146 jclass c = (*env)->GetObjectClass(env, o);
4148 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4149 atomic_init(&calls->refcnt, 1);
4150 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4151 calls->o = (*env)->NewWeakGlobalRef(env, o);
4152 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4153 CHECK(calls->get_node_secret_meth != NULL);
4154 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4155 CHECK(calls->get_destination_script_meth != NULL);
4156 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
4157 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
4158 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4159 CHECK(calls->get_channel_signer_meth != NULL);
4160 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4161 CHECK(calls->get_secure_random_bytes_meth != NULL);
4162 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4163 CHECK(calls->read_chan_signer_meth != NULL);
4164 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4165 CHECK(calls->sign_invoice_meth != NULL);
4167 LDKKeysInterface ret = {
4168 .this_arg = (void*) calls,
4169 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4170 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4171 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4172 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4173 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4174 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4175 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4176 .free = LDKKeysInterface_JCalls_free,
4180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4181 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4182 *res_ptr = LDKKeysInterface_init(env, clz, o);
4183 return (uint64_t)res_ptr;
4185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4186 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4187 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4188 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4193 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4194 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4195 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4196 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4197 CVec_u8Z_free(ret_var);
4201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4202 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4203 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4204 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4205 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4206 uint64_t ret_ref = (uint64_t)ret_var.inner;
4207 if (ret_var.is_owned) {
4213 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) {
4214 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4215 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
4216 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4217 return (uint64_t)ret_ret;
4220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4221 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4222 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4228 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4229 LDKu8slice reader_ref;
4230 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4231 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4232 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4233 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4234 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4235 return (uint64_t)ret_conv;
4238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4239 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4240 LDKCVec_u8Z invoice_preimage_ref;
4241 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4242 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4243 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4244 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4245 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4246 return (uint64_t)ret_conv;
4249 typedef struct LDKFeeEstimator_JCalls {
4250 atomic_size_t refcnt;
4253 jmethodID get_est_sat_per_1000_weight_meth;
4254 } LDKFeeEstimator_JCalls;
4255 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4256 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4257 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4259 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4260 if (get_jenv_res == JNI_EDETACHED) {
4261 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4263 DO_ASSERT(get_jenv_res == JNI_OK);
4265 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4266 if (get_jenv_res == JNI_EDETACHED) {
4267 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4272 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4273 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4275 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4276 if (get_jenv_res == JNI_EDETACHED) {
4277 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4279 DO_ASSERT(get_jenv_res == JNI_OK);
4281 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4282 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4284 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4285 if ((*env)->ExceptionCheck(env)) {
4286 (*env)->ExceptionDescribe(env);
4287 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4289 if (get_jenv_res == JNI_EDETACHED) {
4290 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4294 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4295 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4296 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4298 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4299 jclass c = (*env)->GetObjectClass(env, o);
4301 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4302 atomic_init(&calls->refcnt, 1);
4303 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4304 calls->o = (*env)->NewWeakGlobalRef(env, o);
4305 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4306 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4308 LDKFeeEstimator ret = {
4309 .this_arg = (void*) calls,
4310 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4311 .free = LDKFeeEstimator_JCalls_free,
4315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4316 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4317 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4318 return (uint64_t)res_ptr;
4320 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) {
4321 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
4322 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4323 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4327 typedef struct LDKLogger_JCalls {
4328 atomic_size_t refcnt;
4333 static void LDKLogger_JCalls_free(void* this_arg) {
4334 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4335 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4337 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4338 if (get_jenv_res == JNI_EDETACHED) {
4339 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4341 DO_ASSERT(get_jenv_res == JNI_OK);
4343 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4344 if (get_jenv_res == JNI_EDETACHED) {
4345 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4350 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4351 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4353 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4354 if (get_jenv_res == JNI_EDETACHED) {
4355 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4357 DO_ASSERT(get_jenv_res == JNI_OK);
4359 const char* record_str = record;
4360 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4361 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4363 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4364 if ((*env)->ExceptionCheck(env)) {
4365 (*env)->ExceptionDescribe(env);
4366 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4368 if (get_jenv_res == JNI_EDETACHED) {
4369 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4372 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4373 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4374 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4376 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4377 jclass c = (*env)->GetObjectClass(env, o);
4379 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4380 atomic_init(&calls->refcnt, 1);
4381 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4382 calls->o = (*env)->NewWeakGlobalRef(env, o);
4383 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4384 CHECK(calls->log_meth != NULL);
4387 .this_arg = (void*) calls,
4388 .log = log_LDKLogger_jcall,
4389 .free = LDKLogger_JCalls_free,
4393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4394 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4395 *res_ptr = LDKLogger_init(env, clz, o);
4396 return (uint64_t)res_ptr;
4398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4399 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4400 LDKThirtyTwoBytes a_ref;
4401 CHECK((*env)->GetArrayLength(env, a) == 32);
4402 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4404 LDKChannelManager b_conv;
4405 b_conv.inner = (void*)(b & (~1));
4406 b_conv.is_owned = (b & 1) || (b == 0);
4407 // Warning: we need a move here but no clone is available for LDKChannelManager
4409 return (uint64_t)ret;
4411 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4412 return ThirtyTwoBytes_clone(&tuple->a);
4414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4415 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4416 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4417 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(tuple_conv).data);
4421 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR tuple){
4424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4425 LDKC2Tuple_BlockHashChannelManagerZ* tuple_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(tuple & ~1);
4426 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(tuple_conv);
4427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4429 uint64_t ret_ref = (uint64_t)ret_var.inner & ~1;
4433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4434 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4437 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4438 CHECK(val->result_ok);
4439 LDKC2Tuple_BlockHashChannelManagerZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4440 *res_conv = (*val->contents.result);
4441 // Warning: we really need to clone here, but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
4442 return ((uint64_t)res_conv) | 1;
4444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4445 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4446 CHECK(!val->result_ok);
4447 LDKDecodeError err_var = (*val->contents.err);
4448 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4449 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4450 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4454 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4457 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4458 CHECK(val->result_ok);
4459 LDKChannelConfig res_var = (*val->contents.result);
4460 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4461 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4462 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4466 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4467 CHECK(!val->result_ok);
4468 LDKDecodeError err_var = (*val->contents.err);
4469 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4470 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4471 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4475 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4478 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4479 CHECK(val->result_ok);
4480 LDKOutPoint res_var = (*val->contents.result);
4481 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4487 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4488 CHECK(!val->result_ok);
4489 LDKDecodeError err_var = (*val->contents.err);
4490 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4491 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4492 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4495 typedef struct LDKType_JCalls {
4496 atomic_size_t refcnt;
4499 jmethodID type_id_meth;
4500 jmethodID debug_str_meth;
4501 jmethodID write_meth;
4503 static void LDKType_JCalls_free(void* this_arg) {
4504 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4505 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4507 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4508 if (get_jenv_res == JNI_EDETACHED) {
4509 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4511 DO_ASSERT(get_jenv_res == JNI_OK);
4513 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4514 if (get_jenv_res == JNI_EDETACHED) {
4515 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4520 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4521 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4523 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4524 if (get_jenv_res == JNI_EDETACHED) {
4525 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4527 DO_ASSERT(get_jenv_res == JNI_OK);
4529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4531 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
4532 if ((*env)->ExceptionCheck(env)) {
4533 (*env)->ExceptionDescribe(env);
4534 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
4536 if (get_jenv_res == JNI_EDETACHED) {
4537 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4541 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4542 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4544 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4545 if (get_jenv_res == JNI_EDETACHED) {
4546 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4548 DO_ASSERT(get_jenv_res == JNI_OK);
4550 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4552 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
4553 if ((*env)->ExceptionCheck(env)) {
4554 (*env)->ExceptionDescribe(env);
4555 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
4557 LDKStr ret_conv = java_to_owned_str(env, ret);
4558 if (get_jenv_res == JNI_EDETACHED) {
4559 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4563 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
4564 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4566 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4567 if (get_jenv_res == JNI_EDETACHED) {
4568 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4570 DO_ASSERT(get_jenv_res == JNI_OK);
4572 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4574 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4575 if ((*env)->ExceptionCheck(env)) {
4576 (*env)->ExceptionDescribe(env);
4577 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
4579 LDKCVec_u8Z ret_ref;
4580 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4581 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4582 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4583 if (get_jenv_res == JNI_EDETACHED) {
4584 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4588 static void LDKType_JCalls_cloned(LDKType* new_obj) {
4589 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
4590 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4592 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
4593 jclass c = (*env)->GetObjectClass(env, o);
4595 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
4596 atomic_init(&calls->refcnt, 1);
4597 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4598 calls->o = (*env)->NewWeakGlobalRef(env, o);
4599 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
4600 CHECK(calls->type_id_meth != NULL);
4601 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
4602 CHECK(calls->debug_str_meth != NULL);
4603 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4604 CHECK(calls->write_meth != NULL);
4607 .this_arg = (void*) calls,
4608 .type_id = type_id_LDKType_jcall,
4609 .debug_str = debug_str_LDKType_jcall,
4610 .write = write_LDKType_jcall,
4611 .cloned = LDKType_JCalls_cloned,
4612 .free = LDKType_JCalls_free,
4616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
4617 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
4618 *res_ptr = LDKType_init(env, clz, o);
4619 return (uint64_t)res_ptr;
4621 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4622 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4623 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
4627 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
4628 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4629 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
4630 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
4635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4636 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4637 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4638 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4639 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4640 CVec_u8Z_free(ret_var);
4644 static jclass LDKCOption_TypeZ_Some_class = NULL;
4645 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
4646 static jclass LDKCOption_TypeZ_None_class = NULL;
4647 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
4648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
4649 LDKCOption_TypeZ_Some_class =
4650 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
4651 CHECK(LDKCOption_TypeZ_Some_class != NULL);
4652 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
4653 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
4654 LDKCOption_TypeZ_None_class =
4655 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
4656 CHECK(LDKCOption_TypeZ_None_class != NULL);
4657 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
4658 CHECK(LDKCOption_TypeZ_None_meth != NULL);
4660 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4661 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
4663 case LDKCOption_TypeZ_Some: {
4664 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
4665 *some_ret = Type_clone(&obj->some);
4666 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
4668 case LDKCOption_TypeZ_None: {
4669 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
4674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4675 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
4677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4678 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4679 CHECK(val->result_ok);
4680 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4684 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4685 CHECK(!val->result_ok);
4686 LDKDecodeError err_var = (*val->contents.err);
4687 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4688 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4689 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4693 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4695 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4696 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4697 CHECK(val->result_ok);
4698 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4702 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4703 CHECK(!val->result_ok);
4704 return *val->contents.err;
4706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4707 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4710 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4711 CHECK(val->result_ok);
4712 LDKInvoice res_var = (*val->contents.result);
4713 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4714 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4715 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4719 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4720 CHECK(!val->result_ok);
4721 return *val->contents.err;
4723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4724 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4727 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4728 CHECK(val->result_ok);
4729 LDKSignedRawInvoice res_var = (*val->contents.result);
4730 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4731 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4732 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4736 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4737 CHECK(!val->result_ok);
4738 return *val->contents.err;
4740 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) {
4741 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4742 LDKRawInvoice a_conv;
4743 a_conv.inner = (void*)(a & (~1));
4744 a_conv.is_owned = (a & 1) || (a == 0);
4745 a_conv = RawInvoice_clone(&a_conv);
4747 LDKThirtyTwoBytes b_ref;
4748 CHECK((*env)->GetArrayLength(env, b) == 32);
4749 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4751 LDKInvoiceSignature c_conv;
4752 c_conv.inner = (void*)(c & (~1));
4753 c_conv.is_owned = (c & 1) || (c == 0);
4754 c_conv = InvoiceSignature_clone(&c_conv);
4756 return (uint64_t)ret;
4758 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4759 return RawInvoice_clone(&tuple->a);
4761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
4762 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4763 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(tuple_conv);
4764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4766 uint64_t ret_ref = (uint64_t)ret_var.inner;
4767 if (ret_var.is_owned) {
4773 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4774 return ThirtyTwoBytes_clone(&tuple->b);
4776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
4777 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4778 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(tuple_conv).data);
4783 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR tuple){
4784 return InvoiceSignature_clone(&tuple->c);
4786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
4787 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* tuple_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(tuple & ~1);
4788 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(tuple_conv);
4789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4791 uint64_t ret_ref = (uint64_t)ret_var.inner;
4792 if (ret_var.is_owned) {
4798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4799 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4802 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4803 CHECK(val->result_ok);
4804 LDKPayeePubKey res_var = (*val->contents.result);
4805 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4806 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4807 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4810 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4811 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4812 CHECK(!val->result_ok);
4813 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4817 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4818 ret->datalen = (*env)->GetArrayLength(env, elems);
4819 if (ret->datalen == 0) {
4822 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4823 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4824 for (size_t i = 0; i < ret->datalen; i++) {
4825 int64_t arr_elem = java_elems[i];
4826 LDKPrivateRoute arr_elem_conv;
4827 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4828 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4829 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4830 ret->data[i] = arr_elem_conv;
4832 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4834 return (uint64_t)ret;
4836 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4837 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4838 for (size_t i = 0; i < ret.datalen; i++) {
4839 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4844 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4847 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4848 CHECK(val->result_ok);
4849 LDKPositiveTimestamp res_var = (*val->contents.result);
4850 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4851 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4852 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4855 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4856 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4857 CHECK(!val->result_ok);
4858 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4862 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4865 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4866 CHECK(val->result_ok);
4867 return *val->contents.result;
4869 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4870 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4871 CHECK(!val->result_ok);
4872 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4876 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4879 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4880 CHECK(val->result_ok);
4881 LDKInvoice res_var = (*val->contents.result);
4882 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4883 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4884 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4887 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4888 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4889 CHECK(!val->result_ok);
4890 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4894 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4897 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4898 CHECK(val->result_ok);
4899 LDKDescription res_var = (*val->contents.result);
4900 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4901 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4902 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4905 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4906 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4907 CHECK(!val->result_ok);
4908 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4912 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4915 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4916 CHECK(val->result_ok);
4917 LDKExpiryTime res_var = (*val->contents.result);
4918 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4919 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4920 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4923 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4924 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4925 CHECK(!val->result_ok);
4926 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4930 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4933 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4934 CHECK(val->result_ok);
4935 LDKPrivateRoute 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 jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4942 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4943 CHECK(!val->result_ok);
4944 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4948 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4950 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4951 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4952 CHECK(val->result_ok);
4953 LDKStr res_str = (*val->contents.result);
4954 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4957 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4958 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4959 CHECK(!val->result_ok);
4960 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4964 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4967 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4968 CHECK(val->result_ok);
4969 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4970 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4971 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4972 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4976 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4977 CHECK(!val->result_ok);
4978 LDKDecodeError err_var = (*val->contents.err);
4979 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4980 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4981 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4985 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4988 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4989 CHECK(val->result_ok);
4990 LDKHTLCUpdate res_var = (*val->contents.result);
4991 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4992 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4993 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4997 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4998 CHECK(!val->result_ok);
4999 LDKDecodeError err_var = (*val->contents.err);
5000 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5001 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5002 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5006 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
5008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5009 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5010 CHECK(val->result_ok);
5011 return *val->contents.result;
5013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5014 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
5015 CHECK(!val->result_ok);
5016 LDKMonitorUpdateError err_var = (*val->contents.err);
5017 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5018 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5019 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
5023 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5025 a_conv.inner = (void*)(a & (~1));
5026 a_conv.is_owned = (a & 1) || (a == 0);
5027 a_conv = OutPoint_clone(&a_conv);
5030 b_ref.datalen = (*env)->GetArrayLength(env, b);
5031 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5032 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5034 return (uint64_t)ret;
5036 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5037 return OutPoint_clone(&tuple->a);
5039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5040 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5041 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(tuple_conv);
5042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5044 uint64_t ret_ref = (uint64_t)ret_var.inner;
5045 if (ret_var.is_owned) {
5051 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){
5052 return CVec_u8Z_clone(&tuple->b);
5054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5055 LDKC2Tuple_OutPointScriptZ* tuple_conv = (LDKC2Tuple_OutPointScriptZ*)(tuple & ~1);
5056 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(tuple_conv);
5057 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5058 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5059 CVec_u8Z_free(ret_var);
5063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
5064 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5067 b_ref.datalen = (*env)->GetArrayLength(env, b);
5068 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5069 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5071 return (uint64_t)ret;
5073 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5076 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5077 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5078 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(tuple_conv);
5082 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR tuple){
5083 return CVec_u8Z_clone(&tuple->b);
5085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5086 LDKC2Tuple_u32ScriptZ* tuple_conv = (LDKC2Tuple_u32ScriptZ*)(tuple & ~1);
5087 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(tuple_conv);
5088 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5089 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5090 CVec_u8Z_free(ret_var);
5094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5095 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
5096 ret->datalen = (*env)->GetArrayLength(env, elems);
5097 if (ret->datalen == 0) {
5100 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
5101 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5102 for (size_t i = 0; i < ret->datalen; i++) {
5103 int64_t arr_elem = java_elems[i];
5104 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
5105 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
5106 ret->data[i] = arr_elem_conv;
5108 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5110 return (uint64_t)ret;
5112 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5113 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5114 for (size_t i = 0; i < ret.datalen; i++) {
5115 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5120 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
5121 LDKThirtyTwoBytes a_ref;
5122 CHECK((*env)->GetArrayLength(env, a) == 32);
5123 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5125 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
5126 b_constr.datalen = (*env)->GetArrayLength(env, b);
5127 if (b_constr.datalen > 0)
5128 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
5130 b_constr.data = NULL;
5131 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5132 for (size_t v = 0; v < b_constr.datalen; v++) {
5133 int64_t b_conv_21 = b_vals[v];
5134 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
5135 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
5136 b_constr.data[v] = b_conv_21_conv;
5138 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5140 return (uint64_t)ret;
5142 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5143 return ThirtyTwoBytes_clone(&tuple->a);
5145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5146 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5147 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5148 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(tuple_conv).data);
5152 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR tuple){
5153 return CVec_C2Tuple_u32ScriptZZ_clone(&tuple->b);
5155 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5156 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(tuple & ~1);
5157 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(tuple_conv);
5158 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5159 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5160 for (size_t v = 0; v < ret_var.datalen; v++) {
5161 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
5162 *ret_conv_21_conv = ret_var.data[v];
5163 ret_arr_ptr[v] = ((uint64_t)ret_conv_21_conv);
5165 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5171 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
5172 ret->datalen = (*env)->GetArrayLength(env, elems);
5173 if (ret->datalen == 0) {
5176 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
5177 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5178 for (size_t i = 0; i < ret->datalen; i++) {
5179 int64_t arr_elem = java_elems[i];
5180 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
5181 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
5182 ret->data[i] = arr_elem_conv;
5184 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5186 return (uint64_t)ret;
5188 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5189 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 };
5190 for (size_t i = 0; i < ret.datalen; i++) {
5191 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5195 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
5196 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
5197 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
5198 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
5199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
5200 LDKPaymentPurpose_InvoicePayment_class =
5201 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
5202 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
5203 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
5204 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
5205 LDKPaymentPurpose_SpontaneousPayment_class =
5206 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
5207 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
5208 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
5209 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
5211 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5212 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
5214 case LDKPaymentPurpose_InvoicePayment: {
5215 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5216 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
5217 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
5218 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
5219 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
5221 case LDKPaymentPurpose_SpontaneousPayment: {
5222 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
5223 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
5224 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
5229 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5230 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5231 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5232 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5233 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
5234 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
5235 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5236 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5237 static jclass LDKClosureReason_ProcessingError_class = NULL;
5238 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5239 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5240 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5241 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5242 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5244 LDKClosureReason_CounterpartyForceClosed_class =
5245 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
5246 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5247 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
5248 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5249 LDKClosureReason_HolderForceClosed_class =
5250 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
5251 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5252 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5253 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5254 LDKClosureReason_CooperativeClosure_class =
5255 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
5256 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
5257 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
5258 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
5259 LDKClosureReason_CommitmentTxConfirmed_class =
5260 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
5261 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5262 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5263 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5264 LDKClosureReason_ProcessingError_class =
5265 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
5266 CHECK(LDKClosureReason_ProcessingError_class != NULL);
5267 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5268 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5269 LDKClosureReason_DisconnectedPeer_class =
5270 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
5271 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5272 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5273 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5274 LDKClosureReason_OutdatedChannelManager_class =
5275 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
5276 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5277 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5278 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5280 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5281 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
5283 case LDKClosureReason_CounterpartyForceClosed: {
5284 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
5285 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
5286 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
5288 case LDKClosureReason_HolderForceClosed: {
5289 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5291 case LDKClosureReason_CooperativeClosure: {
5292 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
5294 case LDKClosureReason_CommitmentTxConfirmed: {
5295 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5297 case LDKClosureReason_ProcessingError: {
5298 LDKStr err_str = obj->processing_error.err;
5299 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5300 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5302 case LDKClosureReason_DisconnectedPeer: {
5303 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5305 case LDKClosureReason_OutdatedChannelManager: {
5306 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5311 static jclass LDKEvent_FundingGenerationReady_class = NULL;
5312 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
5313 static jclass LDKEvent_PaymentReceived_class = NULL;
5314 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
5315 static jclass LDKEvent_PaymentSent_class = NULL;
5316 static jmethodID LDKEvent_PaymentSent_meth = NULL;
5317 static jclass LDKEvent_PaymentPathFailed_class = NULL;
5318 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
5319 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
5320 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
5321 static jclass LDKEvent_SpendableOutputs_class = NULL;
5322 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
5323 static jclass LDKEvent_PaymentForwarded_class = NULL;
5324 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
5325 static jclass LDKEvent_ChannelClosed_class = NULL;
5326 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
5327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
5328 LDKEvent_FundingGenerationReady_class =
5329 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
5330 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
5331 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
5332 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
5333 LDKEvent_PaymentReceived_class =
5334 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
5335 CHECK(LDKEvent_PaymentReceived_class != NULL);
5336 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
5337 CHECK(LDKEvent_PaymentReceived_meth != NULL);
5338 LDKEvent_PaymentSent_class =
5339 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
5340 CHECK(LDKEvent_PaymentSent_class != NULL);
5341 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
5342 CHECK(LDKEvent_PaymentSent_meth != NULL);
5343 LDKEvent_PaymentPathFailed_class =
5344 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
5345 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
5346 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([BZJZ[J)V");
5347 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
5348 LDKEvent_PendingHTLCsForwardable_class =
5349 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
5350 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
5351 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
5352 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
5353 LDKEvent_SpendableOutputs_class =
5354 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
5355 CHECK(LDKEvent_SpendableOutputs_class != NULL);
5356 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
5357 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
5358 LDKEvent_PaymentForwarded_class =
5359 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
5360 CHECK(LDKEvent_PaymentForwarded_class != NULL);
5361 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
5362 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
5363 LDKEvent_ChannelClosed_class =
5364 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
5365 CHECK(LDKEvent_ChannelClosed_class != NULL);
5366 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJ)V");
5367 CHECK(LDKEvent_ChannelClosed_meth != NULL);
5369 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5370 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
5372 case LDKEvent_FundingGenerationReady: {
5373 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
5374 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
5375 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
5376 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
5377 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
5378 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);
5380 case LDKEvent_PaymentReceived: {
5381 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5382 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
5383 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
5384 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
5386 case LDKEvent_PaymentSent: {
5387 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5388 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
5389 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
5391 case LDKEvent_PaymentPathFailed: {
5392 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5393 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
5394 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
5395 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
5396 int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen);
5397 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
5398 for (size_t k = 0; k < path_var.datalen; k++) {
5399 LDKRouteHop path_conv_10_var = path_var.data[k];
5400 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5401 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5402 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
5403 path_arr_ptr[k] = path_conv_10_ref;
5405 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
5406 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr);
5408 case LDKEvent_PendingHTLCsForwardable: {
5409 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
5411 case LDKEvent_SpendableOutputs: {
5412 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
5413 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
5414 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
5415 for (size_t b = 0; b < outputs_var.datalen; b++) {
5416 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
5417 outputs_arr_ptr[b] = outputs_conv_27_ref;
5419 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
5420 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
5422 case LDKEvent_PaymentForwarded: {
5423 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
5424 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
5426 case LDKEvent_ChannelClosed: {
5427 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5428 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
5429 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
5430 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, reason_ref);
5435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5436 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5437 ret->datalen = (*env)->GetArrayLength(env, elems);
5438 if (ret->datalen == 0) {
5441 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
5442 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5443 for (size_t i = 0; i < ret->datalen; i++) {
5444 int64_t arr_elem = java_elems[i];
5445 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
5446 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
5447 ret->data[i] = arr_elem_conv;
5449 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5451 return (uint64_t)ret;
5453 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5454 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5455 for (size_t i = 0; i < ret.datalen; i++) {
5456 ret.data[i] = Event_clone(&orig->data[i]);
5460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5461 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5463 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
5464 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
5466 return (uint64_t)ret;
5468 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5471 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5472 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5473 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(tuple_conv);
5477 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR tuple){
5478 return TxOut_clone(&tuple->b);
5480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5481 LDKC2Tuple_u32TxOutZ* tuple_conv = (LDKC2Tuple_u32TxOutZ*)(tuple & ~1);
5482 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5483 *ret_ref = C2Tuple_u32TxOutZ_get_b(tuple_conv);
5484 return (uint64_t)ret_ref;
5487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5488 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
5489 ret->datalen = (*env)->GetArrayLength(env, elems);
5490 if (ret->datalen == 0) {
5493 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
5494 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5495 for (size_t i = 0; i < ret->datalen; i++) {
5496 int64_t arr_elem = java_elems[i];
5497 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
5498 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
5499 ret->data[i] = arr_elem_conv;
5501 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5503 return (uint64_t)ret;
5505 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5506 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5507 for (size_t i = 0; i < ret.datalen; i++) {
5508 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5513 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5514 LDKThirtyTwoBytes a_ref;
5515 CHECK((*env)->GetArrayLength(env, a) == 32);
5516 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5518 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5519 b_constr.datalen = (*env)->GetArrayLength(env, b);
5520 if (b_constr.datalen > 0)
5521 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5523 b_constr.data = NULL;
5524 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5525 for (size_t u = 0; u < b_constr.datalen; u++) {
5526 int64_t b_conv_20 = b_vals[u];
5527 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
5528 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
5529 b_constr.data[u] = b_conv_20_conv;
5531 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5533 return (uint64_t)ret;
5535 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5536 return ThirtyTwoBytes_clone(&tuple->a);
5538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5539 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5540 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5541 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(tuple_conv).data);
5545 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR tuple){
5546 return CVec_C2Tuple_u32TxOutZZ_clone(&tuple->b);
5548 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5549 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* tuple_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(tuple & ~1);
5550 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(tuple_conv);
5551 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5552 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5553 for (size_t u = 0; u < ret_var.datalen; u++) {
5554 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5555 *ret_conv_20_conv = ret_var.data[u];
5556 ret_arr_ptr[u] = ((uint64_t)ret_conv_20_conv);
5558 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5564 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
5565 ret->datalen = (*env)->GetArrayLength(env, elems);
5566 if (ret->datalen == 0) {
5569 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
5570 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5571 for (size_t i = 0; i < ret->datalen; i++) {
5572 int64_t arr_elem = java_elems[i];
5573 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
5574 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
5575 ret->data[i] = arr_elem_conv;
5577 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5579 return (uint64_t)ret;
5581 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5582 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 };
5583 for (size_t i = 0; i < ret.datalen; i++) {
5584 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5588 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
5589 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
5590 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
5591 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
5592 static jclass LDKBalance_ContentiousClaimable_class = NULL;
5593 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
5594 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
5595 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
5596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
5597 LDKBalance_ClaimableOnChannelClose_class =
5598 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
5599 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
5600 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
5601 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
5602 LDKBalance_ClaimableAwaitingConfirmations_class =
5603 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
5604 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
5605 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
5606 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
5607 LDKBalance_ContentiousClaimable_class =
5608 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
5609 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
5610 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
5611 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
5612 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
5613 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
5614 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
5615 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
5616 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
5618 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5619 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5621 case LDKBalance_ClaimableOnChannelClose: {
5622 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
5624 case LDKBalance_ClaimableAwaitingConfirmations: {
5625 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
5627 case LDKBalance_ContentiousClaimable: {
5628 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
5630 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
5631 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis, obj->maybe_claimable_htlc_awaiting_timeout.claimable_height);
5636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5637 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
5638 ret->datalen = (*env)->GetArrayLength(env, elems);
5639 if (ret->datalen == 0) {
5642 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
5643 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5644 for (size_t i = 0; i < ret->datalen; i++) {
5645 int64_t arr_elem = java_elems[i];
5646 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
5647 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
5648 ret->data[i] = arr_elem_conv;
5650 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5652 return (uint64_t)ret;
5654 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
5655 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
5656 for (size_t i = 0; i < ret.datalen; i++) {
5657 ret.data[i] = Balance_clone(&orig->data[i]);
5661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5662 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5665 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5666 CHECK(val->result_ok);
5667 LDKC2Tuple_BlockHashChannelMonitorZ* res_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5668 *res_conv = (*val->contents.result);
5669 *res_conv = C2Tuple_BlockHashChannelMonitorZ_clone(res_conv);
5670 return ((uint64_t)res_conv);
5672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5673 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5674 CHECK(!val->result_ok);
5675 LDKDecodeError err_var = (*val->contents.err);
5676 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5677 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5678 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5682 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5685 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5686 CHECK(val->result_ok);
5687 return *val->contents.result;
5689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5690 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5691 CHECK(!val->result_ok);
5692 LDKLightningError err_var = (*val->contents.err);
5693 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5694 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5695 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5699 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
5701 CHECK((*env)->GetArrayLength(env, a) == 33);
5702 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
5704 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
5705 b_conv = Type_clone(&b_conv);
5707 return (uint64_t)ret;
5709 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
5712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5713 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
5714 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5715 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(tuple_conv).compressed_form);
5719 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR tuple){
5720 return Type_clone(&tuple->b);
5722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5723 LDKC2Tuple_PublicKeyTypeZ* tuple_conv = (LDKC2Tuple_PublicKeyTypeZ*)(tuple & ~1);
5724 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
5725 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(tuple_conv);
5726 return (uint64_t)ret_ret;
5729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5730 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
5731 ret->datalen = (*env)->GetArrayLength(env, elems);
5732 if (ret->datalen == 0) {
5735 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
5736 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5737 for (size_t i = 0; i < ret->datalen; i++) {
5738 int64_t arr_elem = java_elems[i];
5739 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
5740 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
5741 ret->data[i] = arr_elem_conv;
5743 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5745 return (uint64_t)ret;
5747 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
5748 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
5749 for (size_t i = 0; i < ret.datalen; i++) {
5750 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
5754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5755 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5758 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5759 CHECK(val->result_ok);
5760 return *val->contents.result;
5762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5763 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5764 CHECK(!val->result_ok);
5765 LDKLightningError err_var = (*val->contents.err);
5766 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5767 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5768 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5771 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) {
5772 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5773 LDKChannelAnnouncement a_conv;
5774 a_conv.inner = (void*)(a & (~1));
5775 a_conv.is_owned = (a & 1) || (a == 0);
5776 a_conv = ChannelAnnouncement_clone(&a_conv);
5778 LDKChannelUpdate b_conv;
5779 b_conv.inner = (void*)(b & (~1));
5780 b_conv.is_owned = (b & 1) || (b == 0);
5781 b_conv = ChannelUpdate_clone(&b_conv);
5783 LDKChannelUpdate c_conv;
5784 c_conv.inner = (void*)(c & (~1));
5785 c_conv.is_owned = (c & 1) || (c == 0);
5786 c_conv = ChannelUpdate_clone(&c_conv);
5788 return (uint64_t)ret;
5790 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5791 return ChannelAnnouncement_clone(&tuple->a);
5793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) {
5794 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5795 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(tuple_conv);
5796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5798 uint64_t ret_ref = (uint64_t)ret_var.inner;
5799 if (ret_var.is_owned) {
5805 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5806 return ChannelUpdate_clone(&tuple->b);
5808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) {
5809 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5810 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(tuple_conv);
5811 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5812 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5813 uint64_t ret_ref = (uint64_t)ret_var.inner;
5814 if (ret_var.is_owned) {
5820 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR tuple){
5821 return ChannelUpdate_clone(&tuple->c);
5823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t tuple) {
5824 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* tuple_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(tuple & ~1);
5825 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(tuple_conv);
5826 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5827 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5828 uint64_t ret_ref = (uint64_t)ret_var.inner;
5829 if (ret_var.is_owned) {
5835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5836 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5837 ret->datalen = (*env)->GetArrayLength(env, elems);
5838 if (ret->datalen == 0) {
5841 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5842 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5843 for (size_t i = 0; i < ret->datalen; i++) {
5844 int64_t arr_elem = java_elems[i];
5845 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
5846 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5847 ret->data[i] = arr_elem_conv;
5849 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5851 return (uint64_t)ret;
5853 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5854 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5855 for (size_t i = 0; i < ret.datalen; i++) {
5856 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5861 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5862 ret->datalen = (*env)->GetArrayLength(env, elems);
5863 if (ret->datalen == 0) {
5866 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5867 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5868 for (size_t i = 0; i < ret->datalen; i++) {
5869 int64_t arr_elem = java_elems[i];
5870 LDKNodeAnnouncement arr_elem_conv;
5871 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5872 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5873 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5874 ret->data[i] = arr_elem_conv;
5876 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5878 return (uint64_t)ret;
5880 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5881 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5882 for (size_t i = 0; i < ret.datalen; i++) {
5883 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5888 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
5890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5891 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5892 CHECK(val->result_ok);
5893 LDKCVec_u8Z res_var = (*val->contents.result);
5894 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
5895 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
5898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5899 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5900 CHECK(!val->result_ok);
5901 LDKPeerHandleError err_var = (*val->contents.err);
5902 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5903 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5904 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5908 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5911 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5912 CHECK(val->result_ok);
5913 return *val->contents.result;
5915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5916 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5917 CHECK(!val->result_ok);
5918 LDKPeerHandleError err_var = (*val->contents.err);
5919 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5920 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5921 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5925 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5928 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5929 CHECK(val->result_ok);
5930 return *val->contents.result;
5932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5933 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5934 CHECK(!val->result_ok);
5935 LDKPeerHandleError err_var = (*val->contents.err);
5936 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5937 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5938 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5941 typedef struct LDKAccess_JCalls {
5942 atomic_size_t refcnt;
5945 jmethodID get_utxo_meth;
5947 static void LDKAccess_JCalls_free(void* this_arg) {
5948 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
5949 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5951 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5952 if (get_jenv_res == JNI_EDETACHED) {
5953 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5955 DO_ASSERT(get_jenv_res == JNI_OK);
5957 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5958 if (get_jenv_res == JNI_EDETACHED) {
5959 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5964 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5965 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
5967 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5968 if (get_jenv_res == JNI_EDETACHED) {
5969 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5971 DO_ASSERT(get_jenv_res == JNI_OK);
5973 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
5974 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
5975 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5977 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
5978 if ((*env)->ExceptionCheck(env)) {
5979 (*env)->ExceptionDescribe(env);
5980 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
5982 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
5983 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
5984 if (get_jenv_res == JNI_EDETACHED) {
5985 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5989 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
5990 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
5991 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5993 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
5994 jclass c = (*env)->GetObjectClass(env, o);
5996 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
5997 atomic_init(&calls->refcnt, 1);
5998 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5999 calls->o = (*env)->NewWeakGlobalRef(env, o);
6000 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6001 CHECK(calls->get_utxo_meth != NULL);
6004 .this_arg = (void*) calls,
6005 .get_utxo = get_utxo_LDKAccess_jcall,
6006 .free = LDKAccess_JCalls_free,
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6011 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6012 *res_ptr = LDKAccess_init(env, clz, o);
6013 return (uint64_t)res_ptr;
6015 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) {
6016 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6017 unsigned char genesis_hash_arr[32];
6018 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6019 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6020 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6021 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6022 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6023 return (uint64_t)ret_conv;
6026 static jclass LDKCOption_AccessZ_Some_class = NULL;
6027 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
6028 static jclass LDKCOption_AccessZ_None_class = NULL;
6029 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
6030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
6031 LDKCOption_AccessZ_Some_class =
6032 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
6033 CHECK(LDKCOption_AccessZ_Some_class != NULL);
6034 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
6035 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
6036 LDKCOption_AccessZ_None_class =
6037 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
6038 CHECK(LDKCOption_AccessZ_None_class != NULL);
6039 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
6040 CHECK(LDKCOption_AccessZ_None_meth != NULL);
6042 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6043 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
6045 case LDKCOption_AccessZ_Some: {
6046 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
6047 *some_ret = obj->some;
6048 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
6049 if ((*some_ret).free == LDKAccess_JCalls_free) {
6050 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6051 LDKAccess_JCalls_cloned(&(*some_ret));
6053 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
6055 case LDKCOption_AccessZ_None: {
6056 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
6061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6062 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
6064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6065 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6066 CHECK(val->result_ok);
6067 LDKDirectionalChannelInfo res_var = (*val->contents.result);
6068 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6069 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6070 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6074 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
6075 CHECK(!val->result_ok);
6076 LDKDecodeError err_var = (*val->contents.err);
6077 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6078 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6079 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6083 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
6085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6086 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6087 CHECK(val->result_ok);
6088 LDKChannelInfo res_var = (*val->contents.result);
6089 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6090 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6091 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6095 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
6096 CHECK(!val->result_ok);
6097 LDKDecodeError err_var = (*val->contents.err);
6098 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6099 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6100 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6104 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
6106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6107 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6108 CHECK(val->result_ok);
6109 LDKRoutingFees res_var = (*val->contents.result);
6110 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6111 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6112 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6116 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
6117 CHECK(!val->result_ok);
6118 LDKDecodeError err_var = (*val->contents.err);
6119 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6120 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6121 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6124 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6125 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
6127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6128 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6129 CHECK(val->result_ok);
6130 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
6131 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6132 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6133 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6137 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
6138 CHECK(!val->result_ok);
6139 LDKDecodeError err_var = (*val->contents.err);
6140 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6141 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6142 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6146 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
6147 ret->datalen = (*env)->GetArrayLength(env, elems);
6148 if (ret->datalen == 0) {
6151 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
6152 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6153 for (size_t i = 0; i < ret->datalen; i++) {
6154 ret->data[i] = java_elems[i];
6156 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6158 return (uint64_t)ret;
6160 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6161 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6162 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6166 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
6168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6169 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6170 CHECK(val->result_ok);
6171 LDKNodeInfo res_var = (*val->contents.result);
6172 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6173 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6174 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6178 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6179 CHECK(!val->result_ok);
6180 LDKDecodeError err_var = (*val->contents.err);
6181 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6182 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6183 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6186 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6187 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
6189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6190 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6191 CHECK(val->result_ok);
6192 LDKNetworkGraph res_var = (*val->contents.result);
6193 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6194 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6195 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6199 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6200 CHECK(!val->result_ok);
6201 LDKDecodeError err_var = (*val->contents.err);
6202 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6203 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6204 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6208 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
6210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6211 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6212 CHECK(val->result_ok);
6213 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6216 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6217 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6218 CHECK(!val->result_ok);
6219 return *val->contents.err;
6221 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6222 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
6224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6225 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6226 CHECK(val->result_ok);
6227 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6228 *res_conv = (*val->contents.result);
6229 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
6230 return (uint64_t)res_conv;
6232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6233 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6234 CHECK(!val->result_ok);
6235 LDKDecodeError err_var = (*val->contents.err);
6236 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6237 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6238 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6241 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6242 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
6244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6245 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6246 CHECK(val->result_ok);
6247 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6251 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6252 CHECK(!val->result_ok);
6253 LDKDecodeError err_var = (*val->contents.err);
6254 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6255 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6256 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6260 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
6261 ret->datalen = (*env)->GetArrayLength(env, elems);
6262 if (ret->datalen == 0) {
6265 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
6266 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6267 for (size_t i = 0; i < ret->datalen; i++) {
6268 int64_t arr_elem = java_elems[i];
6269 LDKUpdateAddHTLC arr_elem_conv;
6270 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6271 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6272 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
6273 ret->data[i] = arr_elem_conv;
6275 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6277 return (uint64_t)ret;
6279 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6280 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6281 for (size_t i = 0; i < ret.datalen; i++) {
6282 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6287 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
6288 ret->datalen = (*env)->GetArrayLength(env, elems);
6289 if (ret->datalen == 0) {
6292 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
6293 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6294 for (size_t i = 0; i < ret->datalen; i++) {
6295 int64_t arr_elem = java_elems[i];
6296 LDKUpdateFulfillHTLC arr_elem_conv;
6297 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6298 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6299 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
6300 ret->data[i] = arr_elem_conv;
6302 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6304 return (uint64_t)ret;
6306 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6307 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6308 for (size_t i = 0; i < ret.datalen; i++) {
6309 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6314 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
6315 ret->datalen = (*env)->GetArrayLength(env, elems);
6316 if (ret->datalen == 0) {
6319 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
6320 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6321 for (size_t i = 0; i < ret->datalen; i++) {
6322 int64_t arr_elem = java_elems[i];
6323 LDKUpdateFailHTLC arr_elem_conv;
6324 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6325 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6326 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
6327 ret->data[i] = arr_elem_conv;
6329 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6331 return (uint64_t)ret;
6333 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6334 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6335 for (size_t i = 0; i < ret.datalen; i++) {
6336 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6341 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
6342 ret->datalen = (*env)->GetArrayLength(env, elems);
6343 if (ret->datalen == 0) {
6346 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
6347 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6348 for (size_t i = 0; i < ret->datalen; i++) {
6349 int64_t arr_elem = java_elems[i];
6350 LDKUpdateFailMalformedHTLC arr_elem_conv;
6351 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6352 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6353 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
6354 ret->data[i] = arr_elem_conv;
6356 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6358 return (uint64_t)ret;
6360 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6361 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6362 for (size_t i = 0; i < ret.datalen; i++) {
6363 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6368 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
6370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6371 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6372 CHECK(val->result_ok);
6373 LDKAcceptChannel res_var = (*val->contents.result);
6374 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6375 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6376 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6380 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6381 CHECK(!val->result_ok);
6382 LDKDecodeError err_var = (*val->contents.err);
6383 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6384 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6385 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6389 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
6391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6392 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6393 CHECK(val->result_ok);
6394 LDKAnnouncementSignatures res_var = (*val->contents.result);
6395 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6396 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6397 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6401 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6402 CHECK(!val->result_ok);
6403 LDKDecodeError err_var = (*val->contents.err);
6404 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6405 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6406 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6410 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
6412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6413 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6414 CHECK(val->result_ok);
6415 LDKChannelReestablish res_var = (*val->contents.result);
6416 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6417 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6418 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6422 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6423 CHECK(!val->result_ok);
6424 LDKDecodeError err_var = (*val->contents.err);
6425 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6426 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6427 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6431 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
6433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6434 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6435 CHECK(val->result_ok);
6436 LDKClosingSigned res_var = (*val->contents.result);
6437 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6438 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6439 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6443 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6444 CHECK(!val->result_ok);
6445 LDKDecodeError err_var = (*val->contents.err);
6446 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6447 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6448 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6452 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
6454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6455 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6456 CHECK(val->result_ok);
6457 LDKClosingSignedFeeRange res_var = (*val->contents.result);
6458 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6459 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6460 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6464 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6465 CHECK(!val->result_ok);
6466 LDKDecodeError err_var = (*val->contents.err);
6467 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6468 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6469 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6473 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
6475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6476 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6477 CHECK(val->result_ok);
6478 LDKCommitmentSigned res_var = (*val->contents.result);
6479 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6480 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6481 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6485 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6486 CHECK(!val->result_ok);
6487 LDKDecodeError err_var = (*val->contents.err);
6488 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6489 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6490 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6494 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
6496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6497 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6498 CHECK(val->result_ok);
6499 LDKFundingCreated res_var = (*val->contents.result);
6500 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6501 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6502 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6506 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6507 CHECK(!val->result_ok);
6508 LDKDecodeError err_var = (*val->contents.err);
6509 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6510 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6511 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6515 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
6517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6518 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6519 CHECK(val->result_ok);
6520 LDKFundingSigned res_var = (*val->contents.result);
6521 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6522 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6523 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6527 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6528 CHECK(!val->result_ok);
6529 LDKDecodeError err_var = (*val->contents.err);
6530 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6531 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6532 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6536 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
6538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6539 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6540 CHECK(val->result_ok);
6541 LDKFundingLocked res_var = (*val->contents.result);
6542 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6543 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6544 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6548 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6549 CHECK(!val->result_ok);
6550 LDKDecodeError err_var = (*val->contents.err);
6551 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6552 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6553 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6557 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
6559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6560 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6561 CHECK(val->result_ok);
6562 LDKInit res_var = (*val->contents.result);
6563 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6564 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6565 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6569 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6570 CHECK(!val->result_ok);
6571 LDKDecodeError err_var = (*val->contents.err);
6572 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6573 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6574 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6578 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
6580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6581 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6582 CHECK(val->result_ok);
6583 LDKOpenChannel res_var = (*val->contents.result);
6584 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6585 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6586 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6590 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6591 CHECK(!val->result_ok);
6592 LDKDecodeError err_var = (*val->contents.err);
6593 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6594 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6595 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6599 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
6601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6602 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6603 CHECK(val->result_ok);
6604 LDKRevokeAndACK res_var = (*val->contents.result);
6605 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6606 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6607 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6611 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6612 CHECK(!val->result_ok);
6613 LDKDecodeError err_var = (*val->contents.err);
6614 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6615 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6616 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6620 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
6622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6623 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6624 CHECK(val->result_ok);
6625 LDKShutdown res_var = (*val->contents.result);
6626 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6627 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6628 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6632 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6633 CHECK(!val->result_ok);
6634 LDKDecodeError err_var = (*val->contents.err);
6635 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6636 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6637 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6641 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
6643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6644 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6645 CHECK(val->result_ok);
6646 LDKUpdateFailHTLC res_var = (*val->contents.result);
6647 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6648 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6649 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6653 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6654 CHECK(!val->result_ok);
6655 LDKDecodeError err_var = (*val->contents.err);
6656 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6657 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6658 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6662 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
6664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6665 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6666 CHECK(val->result_ok);
6667 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
6668 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6669 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6670 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6674 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6675 CHECK(!val->result_ok);
6676 LDKDecodeError err_var = (*val->contents.err);
6677 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6678 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6679 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6683 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
6685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6686 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6687 CHECK(val->result_ok);
6688 LDKUpdateFee res_var = (*val->contents.result);
6689 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6690 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6691 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6695 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6696 CHECK(!val->result_ok);
6697 LDKDecodeError err_var = (*val->contents.err);
6698 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6699 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6700 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6704 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
6706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6707 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6708 CHECK(val->result_ok);
6709 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
6710 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6711 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6712 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6716 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6717 CHECK(!val->result_ok);
6718 LDKDecodeError err_var = (*val->contents.err);
6719 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6720 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6721 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6725 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
6727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6728 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6729 CHECK(val->result_ok);
6730 LDKUpdateAddHTLC res_var = (*val->contents.result);
6731 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6732 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6733 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6737 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6738 CHECK(!val->result_ok);
6739 LDKDecodeError err_var = (*val->contents.err);
6740 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6741 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6742 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6746 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
6748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6749 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6750 CHECK(val->result_ok);
6751 LDKPing res_var = (*val->contents.result);
6752 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6753 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6754 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6758 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6759 CHECK(!val->result_ok);
6760 LDKDecodeError err_var = (*val->contents.err);
6761 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6762 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6763 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6767 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
6769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6770 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6771 CHECK(val->result_ok);
6772 LDKPong res_var = (*val->contents.result);
6773 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6774 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6775 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6779 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6780 CHECK(!val->result_ok);
6781 LDKDecodeError err_var = (*val->contents.err);
6782 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6783 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6784 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6788 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6791 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6792 CHECK(val->result_ok);
6793 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
6794 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6795 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6796 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6800 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6801 CHECK(!val->result_ok);
6802 LDKDecodeError err_var = (*val->contents.err);
6803 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6804 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6805 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6809 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6812 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6813 CHECK(val->result_ok);
6814 LDKChannelAnnouncement res_var = (*val->contents.result);
6815 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6816 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6817 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6821 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6822 CHECK(!val->result_ok);
6823 LDKDecodeError err_var = (*val->contents.err);
6824 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6825 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6826 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6830 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
6832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6833 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6834 CHECK(val->result_ok);
6835 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
6836 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6837 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6838 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6842 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6843 CHECK(!val->result_ok);
6844 LDKDecodeError err_var = (*val->contents.err);
6845 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6846 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6847 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6851 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
6853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6854 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6855 CHECK(val->result_ok);
6856 LDKChannelUpdate res_var = (*val->contents.result);
6857 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6858 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6859 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6863 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6864 CHECK(!val->result_ok);
6865 LDKDecodeError err_var = (*val->contents.err);
6866 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6867 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6868 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6872 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
6874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6875 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6876 CHECK(val->result_ok);
6877 LDKErrorMessage res_var = (*val->contents.result);
6878 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6879 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6880 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6884 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6885 CHECK(!val->result_ok);
6886 LDKDecodeError err_var = (*val->contents.err);
6887 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6888 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6889 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6893 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6896 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6897 CHECK(val->result_ok);
6898 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
6899 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6900 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6901 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6905 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6906 CHECK(!val->result_ok);
6907 LDKDecodeError err_var = (*val->contents.err);
6908 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6909 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6910 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6914 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6917 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6918 CHECK(val->result_ok);
6919 LDKNodeAnnouncement res_var = (*val->contents.result);
6920 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6921 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6922 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6926 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6927 CHECK(!val->result_ok);
6928 LDKDecodeError err_var = (*val->contents.err);
6929 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6930 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6931 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6935 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
6937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6938 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6939 CHECK(val->result_ok);
6940 LDKQueryShortChannelIds res_var = (*val->contents.result);
6941 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6942 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6943 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6947 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6948 CHECK(!val->result_ok);
6949 LDKDecodeError err_var = (*val->contents.err);
6950 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6951 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6952 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6956 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
6958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6959 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6960 CHECK(val->result_ok);
6961 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
6962 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6963 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6964 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6968 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6969 CHECK(!val->result_ok);
6970 LDKDecodeError err_var = (*val->contents.err);
6971 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6972 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6973 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6977 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
6979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6980 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6981 CHECK(val->result_ok);
6982 LDKQueryChannelRange res_var = (*val->contents.result);
6983 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6984 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6985 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6989 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6990 CHECK(!val->result_ok);
6991 LDKDecodeError err_var = (*val->contents.err);
6992 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6993 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6994 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6998 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
7000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7001 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7002 CHECK(val->result_ok);
7003 LDKReplyChannelRange res_var = (*val->contents.result);
7004 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7005 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7006 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7010 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
7011 CHECK(!val->result_ok);
7012 LDKDecodeError err_var = (*val->contents.err);
7013 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7014 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7015 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7019 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
7021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7022 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7023 CHECK(val->result_ok);
7024 LDKGossipTimestampFilter res_var = (*val->contents.result);
7025 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7026 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7027 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7031 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
7032 CHECK(!val->result_ok);
7033 LDKDecodeError err_var = (*val->contents.err);
7034 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7035 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7036 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
7039 static jclass LDKSignOrCreationError_SignError_class = NULL;
7040 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
7041 static jclass LDKSignOrCreationError_CreationError_class = NULL;
7042 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
7043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
7044 LDKSignOrCreationError_SignError_class =
7045 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
7046 CHECK(LDKSignOrCreationError_SignError_class != NULL);
7047 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
7048 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
7049 LDKSignOrCreationError_CreationError_class =
7050 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
7051 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
7052 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
7053 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
7055 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7056 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
7058 case LDKSignOrCreationError_SignError: {
7059 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
7061 case LDKSignOrCreationError_CreationError: {
7062 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
7063 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
7068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7069 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
7071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
7072 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7073 CHECK(val->result_ok);
7074 LDKInvoice res_var = (*val->contents.result);
7075 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7076 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7077 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
7080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
7081 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
7082 CHECK(!val->result_ok);
7083 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
7086 typedef struct LDKFilter_JCalls {
7087 atomic_size_t refcnt;
7090 jmethodID register_tx_meth;
7091 jmethodID register_output_meth;
7093 static void LDKFilter_JCalls_free(void* this_arg) {
7094 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7095 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7097 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7098 if (get_jenv_res == JNI_EDETACHED) {
7099 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7101 DO_ASSERT(get_jenv_res == JNI_OK);
7103 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7104 if (get_jenv_res == JNI_EDETACHED) {
7105 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7110 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7111 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7113 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7114 if (get_jenv_res == JNI_EDETACHED) {
7115 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7117 DO_ASSERT(get_jenv_res == JNI_OK);
7119 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7120 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7121 LDKu8slice script_pubkey_var = script_pubkey;
7122 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
7123 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
7124 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7126 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
7127 if ((*env)->ExceptionCheck(env)) {
7128 (*env)->ExceptionDescribe(env);
7129 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
7131 if (get_jenv_res == JNI_EDETACHED) {
7132 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7135 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7136 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7138 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7139 if (get_jenv_res == JNI_EDETACHED) {
7140 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7142 DO_ASSERT(get_jenv_res == JNI_OK);
7144 LDKWatchedOutput output_var = output;
7145 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7146 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7147 uint64_t output_ref = (uint64_t)output_var.inner;
7148 if (output_var.is_owned) {
7151 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7153 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
7154 if ((*env)->ExceptionCheck(env)) {
7155 (*env)->ExceptionDescribe(env);
7156 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
7158 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
7159 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
7160 if (get_jenv_res == JNI_EDETACHED) {
7161 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7165 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7166 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7167 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7169 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7170 jclass c = (*env)->GetObjectClass(env, o);
7172 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7173 atomic_init(&calls->refcnt, 1);
7174 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7175 calls->o = (*env)->NewWeakGlobalRef(env, o);
7176 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7177 CHECK(calls->register_tx_meth != NULL);
7178 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7179 CHECK(calls->register_output_meth != NULL);
7182 .this_arg = (void*) calls,
7183 .register_tx = register_tx_LDKFilter_jcall,
7184 .register_output = register_output_LDKFilter_jcall,
7185 .free = LDKFilter_JCalls_free,
7189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7190 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7191 *res_ptr = LDKFilter_init(env, clz, o);
7192 return (uint64_t)res_ptr;
7194 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) {
7195 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7196 unsigned char txid_arr[32];
7197 CHECK((*env)->GetArrayLength(env, txid) == 32);
7198 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7199 unsigned char (*txid_ref)[32] = &txid_arr;
7200 LDKu8slice script_pubkey_ref;
7201 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7202 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7203 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7204 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7208 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7209 LDKWatchedOutput output_conv;
7210 output_conv.inner = (void*)(output & (~1));
7211 output_conv.is_owned = (output & 1) || (output == 0);
7212 output_conv = WatchedOutput_clone(&output_conv);
7213 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7214 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7215 uint64_t ret_ref = (uint64_t)ret_copy;
7219 static jclass LDKCOption_FilterZ_Some_class = NULL;
7220 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
7221 static jclass LDKCOption_FilterZ_None_class = NULL;
7222 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
7223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
7224 LDKCOption_FilterZ_Some_class =
7225 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
7226 CHECK(LDKCOption_FilterZ_Some_class != NULL);
7227 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
7228 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
7229 LDKCOption_FilterZ_None_class =
7230 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
7231 CHECK(LDKCOption_FilterZ_None_class != NULL);
7232 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
7233 CHECK(LDKCOption_FilterZ_None_meth != NULL);
7235 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7236 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7238 case LDKCOption_FilterZ_Some: {
7239 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
7240 *some_ret = obj->some;
7241 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7242 if ((*some_ret).free == LDKFilter_JCalls_free) {
7243 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7244 LDKFilter_JCalls_cloned(&(*some_ret));
7246 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
7248 case LDKCOption_FilterZ_None: {
7249 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
7254 typedef struct LDKMessageSendEventsProvider_JCalls {
7255 atomic_size_t refcnt;
7258 jmethodID get_and_clear_pending_msg_events_meth;
7259 } LDKMessageSendEventsProvider_JCalls;
7260 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7261 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7262 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7264 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7265 if (get_jenv_res == JNI_EDETACHED) {
7266 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7268 DO_ASSERT(get_jenv_res == JNI_OK);
7270 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7271 if (get_jenv_res == JNI_EDETACHED) {
7272 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7277 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7278 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7280 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7281 if (get_jenv_res == JNI_EDETACHED) {
7282 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7284 DO_ASSERT(get_jenv_res == JNI_OK);
7286 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7288 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
7289 if ((*env)->ExceptionCheck(env)) {
7290 (*env)->ExceptionDescribe(env);
7291 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
7293 LDKCVec_MessageSendEventZ ret_constr;
7294 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7295 if (ret_constr.datalen > 0)
7296 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7298 ret_constr.data = NULL;
7299 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7300 for (size_t s = 0; s < ret_constr.datalen; s++) {
7301 int64_t ret_conv_18 = ret_vals[s];
7302 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
7303 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
7304 ret_constr.data[s] = ret_conv_18_conv;
7306 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7307 if (get_jenv_res == JNI_EDETACHED) {
7308 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7312 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7313 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7314 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7316 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7317 jclass c = (*env)->GetObjectClass(env, o);
7319 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7320 atomic_init(&calls->refcnt, 1);
7321 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7322 calls->o = (*env)->NewWeakGlobalRef(env, o);
7323 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
7324 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
7326 LDKMessageSendEventsProvider ret = {
7327 .this_arg = (void*) calls,
7328 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7329 .free = LDKMessageSendEventsProvider_JCalls_free,
7333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7334 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7335 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
7336 return (uint64_t)res_ptr;
7338 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7339 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
7340 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7341 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7342 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7343 for (size_t s = 0; s < ret_var.datalen; s++) {
7344 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7345 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
7346 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
7347 ret_arr_ptr[s] = ret_conv_18_ref;
7349 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7354 typedef struct LDKEventHandler_JCalls {
7355 atomic_size_t refcnt;
7358 jmethodID handle_event_meth;
7359 } LDKEventHandler_JCalls;
7360 static void LDKEventHandler_JCalls_free(void* this_arg) {
7361 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7362 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7364 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7365 if (get_jenv_res == JNI_EDETACHED) {
7366 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7368 DO_ASSERT(get_jenv_res == JNI_OK);
7370 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7371 if (get_jenv_res == JNI_EDETACHED) {
7372 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7377 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7378 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7380 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7381 if (get_jenv_res == JNI_EDETACHED) {
7382 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7384 DO_ASSERT(get_jenv_res == JNI_OK);
7386 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7387 *ret_event = Event_clone(event);
7388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7390 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
7391 if ((*env)->ExceptionCheck(env)) {
7392 (*env)->ExceptionDescribe(env);
7393 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
7395 if (get_jenv_res == JNI_EDETACHED) {
7396 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7399 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7400 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7401 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7403 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
7404 jclass c = (*env)->GetObjectClass(env, o);
7406 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7407 atomic_init(&calls->refcnt, 1);
7408 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7409 calls->o = (*env)->NewWeakGlobalRef(env, o);
7410 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
7411 CHECK(calls->handle_event_meth != NULL);
7413 LDKEventHandler ret = {
7414 .this_arg = (void*) calls,
7415 .handle_event = handle_event_LDKEventHandler_jcall,
7416 .free = LDKEventHandler_JCalls_free,
7420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
7421 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7422 *res_ptr = LDKEventHandler_init(env, clz, o);
7423 return (uint64_t)res_ptr;
7425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
7426 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
7427 LDKEvent* event_conv = (LDKEvent*)event;
7428 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7431 typedef struct LDKEventsProvider_JCalls {
7432 atomic_size_t refcnt;
7435 jmethodID process_pending_events_meth;
7436 } LDKEventsProvider_JCalls;
7437 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7438 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7439 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7441 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7442 if (get_jenv_res == JNI_EDETACHED) {
7443 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7445 DO_ASSERT(get_jenv_res == JNI_OK);
7447 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7448 if (get_jenv_res == JNI_EDETACHED) {
7449 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7454 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7455 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7457 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7458 if (get_jenv_res == JNI_EDETACHED) {
7459 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7461 DO_ASSERT(get_jenv_res == JNI_OK);
7463 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7464 *handler_ret = handler;
7465 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7467 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
7468 if ((*env)->ExceptionCheck(env)) {
7469 (*env)->ExceptionDescribe(env);
7470 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
7472 if (get_jenv_res == JNI_EDETACHED) {
7473 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7476 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7477 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7478 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7480 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7481 jclass c = (*env)->GetObjectClass(env, o);
7483 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7484 atomic_init(&calls->refcnt, 1);
7485 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7486 calls->o = (*env)->NewWeakGlobalRef(env, o);
7487 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
7488 CHECK(calls->process_pending_events_meth != NULL);
7490 LDKEventsProvider ret = {
7491 .this_arg = (void*) calls,
7492 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7493 .free = LDKEventsProvider_JCalls_free,
7497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7498 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7499 *res_ptr = LDKEventsProvider_init(env, clz, o);
7500 return (uint64_t)res_ptr;
7502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
7503 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
7504 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
7505 if (handler_conv.free == LDKEventHandler_JCalls_free) {
7506 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7507 LDKEventHandler_JCalls_cloned(&handler_conv);
7509 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7512 typedef struct LDKListen_JCalls {
7513 atomic_size_t refcnt;
7516 jmethodID block_connected_meth;
7517 jmethodID block_disconnected_meth;
7519 static void LDKListen_JCalls_free(void* this_arg) {
7520 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7521 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7523 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7524 if (get_jenv_res == JNI_EDETACHED) {
7525 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7527 DO_ASSERT(get_jenv_res == JNI_OK);
7529 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7530 if (get_jenv_res == JNI_EDETACHED) {
7531 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7536 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
7537 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7539 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7540 if (get_jenv_res == JNI_EDETACHED) {
7541 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7543 DO_ASSERT(get_jenv_res == JNI_OK);
7545 LDKu8slice block_var = block;
7546 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
7547 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
7548 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7550 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
7551 if ((*env)->ExceptionCheck(env)) {
7552 (*env)->ExceptionDescribe(env);
7553 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
7555 if (get_jenv_res == JNI_EDETACHED) {
7556 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7559 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7560 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7562 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7563 if (get_jenv_res == JNI_EDETACHED) {
7564 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7566 DO_ASSERT(get_jenv_res == JNI_OK);
7568 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7569 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7570 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7572 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
7573 if ((*env)->ExceptionCheck(env)) {
7574 (*env)->ExceptionDescribe(env);
7575 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
7577 if (get_jenv_res == JNI_EDETACHED) {
7578 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7581 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
7582 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
7583 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7585 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
7586 jclass c = (*env)->GetObjectClass(env, o);
7588 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
7589 atomic_init(&calls->refcnt, 1);
7590 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7591 calls->o = (*env)->NewWeakGlobalRef(env, o);
7592 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
7593 CHECK(calls->block_connected_meth != NULL);
7594 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
7595 CHECK(calls->block_disconnected_meth != NULL);
7598 .this_arg = (void*) calls,
7599 .block_connected = block_connected_LDKListen_jcall,
7600 .block_disconnected = block_disconnected_LDKListen_jcall,
7601 .free = LDKListen_JCalls_free,
7605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
7606 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7607 *res_ptr = LDKListen_init(env, clz, o);
7608 return (uint64_t)res_ptr;
7610 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) {
7611 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7612 LDKu8slice block_ref;
7613 block_ref.datalen = (*env)->GetArrayLength(env, block);
7614 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
7615 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7616 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
7619 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) {
7620 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7621 unsigned char header_arr[80];
7622 CHECK((*env)->GetArrayLength(env, header) == 80);
7623 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7624 unsigned char (*header_ref)[80] = &header_arr;
7625 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7628 typedef struct LDKConfirm_JCalls {
7629 atomic_size_t refcnt;
7632 jmethodID transactions_confirmed_meth;
7633 jmethodID transaction_unconfirmed_meth;
7634 jmethodID best_block_updated_meth;
7635 jmethodID get_relevant_txids_meth;
7636 } LDKConfirm_JCalls;
7637 static void LDKConfirm_JCalls_free(void* this_arg) {
7638 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7639 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7641 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7642 if (get_jenv_res == JNI_EDETACHED) {
7643 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7645 DO_ASSERT(get_jenv_res == JNI_OK);
7647 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7648 if (get_jenv_res == JNI_EDETACHED) {
7649 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7654 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7655 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7657 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7658 if (get_jenv_res == JNI_EDETACHED) {
7659 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7661 DO_ASSERT(get_jenv_res == JNI_OK);
7663 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7664 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7665 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7666 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
7667 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
7668 for (size_t c = 0; c < txdata_var.datalen; c++) {
7669 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7670 *txdata_conv_28_conv = txdata_var.data[c];
7671 txdata_arr_ptr[c] = ((uint64_t)txdata_conv_28_conv);
7673 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
7674 FREE(txdata_var.data);
7675 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7677 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
7678 if ((*env)->ExceptionCheck(env)) {
7679 (*env)->ExceptionDescribe(env);
7680 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
7682 if (get_jenv_res == JNI_EDETACHED) {
7683 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7686 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7687 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7689 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7690 if (get_jenv_res == JNI_EDETACHED) {
7691 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7693 DO_ASSERT(get_jenv_res == JNI_OK);
7695 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7696 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7697 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7699 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
7700 if ((*env)->ExceptionCheck(env)) {
7701 (*env)->ExceptionDescribe(env);
7702 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
7704 if (get_jenv_res == JNI_EDETACHED) {
7705 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7708 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7709 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7711 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7712 if (get_jenv_res == JNI_EDETACHED) {
7713 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7715 DO_ASSERT(get_jenv_res == JNI_OK);
7717 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7718 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7719 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7721 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
7722 if ((*env)->ExceptionCheck(env)) {
7723 (*env)->ExceptionDescribe(env);
7724 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
7726 if (get_jenv_res == JNI_EDETACHED) {
7727 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7730 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
7731 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7733 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7734 if (get_jenv_res == JNI_EDETACHED) {
7735 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7737 DO_ASSERT(get_jenv_res == JNI_OK);
7739 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7741 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
7742 if ((*env)->ExceptionCheck(env)) {
7743 (*env)->ExceptionDescribe(env);
7744 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
7746 LDKCVec_TxidZ ret_constr;
7747 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7748 if (ret_constr.datalen > 0)
7749 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7751 ret_constr.data = NULL;
7752 for (size_t i = 0; i < ret_constr.datalen; i++) {
7753 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
7754 LDKThirtyTwoBytes ret_conv_8_ref;
7755 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
7756 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
7757 ret_constr.data[i] = ret_conv_8_ref;
7759 if (get_jenv_res == JNI_EDETACHED) {
7760 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7764 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
7765 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
7766 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7768 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
7769 jclass c = (*env)->GetObjectClass(env, o);
7771 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
7772 atomic_init(&calls->refcnt, 1);
7773 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7774 calls->o = (*env)->NewWeakGlobalRef(env, o);
7775 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
7776 CHECK(calls->transactions_confirmed_meth != NULL);
7777 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
7778 CHECK(calls->transaction_unconfirmed_meth != NULL);
7779 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
7780 CHECK(calls->best_block_updated_meth != NULL);
7781 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
7782 CHECK(calls->get_relevant_txids_meth != NULL);
7785 .this_arg = (void*) calls,
7786 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
7787 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
7788 .best_block_updated = best_block_updated_LDKConfirm_jcall,
7789 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
7790 .free = LDKConfirm_JCalls_free,
7794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
7795 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
7796 *res_ptr = LDKConfirm_init(env, clz, o);
7797 return (uint64_t)res_ptr;
7799 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) {
7800 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7801 unsigned char header_arr[80];
7802 CHECK((*env)->GetArrayLength(env, header) == 80);
7803 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7804 unsigned char (*header_ref)[80] = &header_arr;
7805 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7806 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7807 if (txdata_constr.datalen > 0)
7808 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7810 txdata_constr.data = NULL;
7811 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
7812 for (size_t c = 0; c < txdata_constr.datalen; c++) {
7813 int64_t txdata_conv_28 = txdata_vals[c];
7814 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
7815 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
7816 txdata_constr.data[c] = txdata_conv_28_conv;
7818 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
7819 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
7822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
7823 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7824 unsigned char txid_arr[32];
7825 CHECK((*env)->GetArrayLength(env, txid) == 32);
7826 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7827 unsigned char (*txid_ref)[32] = &txid_arr;
7828 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
7831 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) {
7832 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7833 unsigned char header_arr[80];
7834 CHECK((*env)->GetArrayLength(env, header) == 80);
7835 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7836 unsigned char (*header_ref)[80] = &header_arr;
7837 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
7840 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
7841 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7842 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
7843 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
7845 for (size_t i = 0; i < ret_var.datalen; i++) {
7846 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
7847 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
7848 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
7854 typedef struct LDKPersist_JCalls {
7855 atomic_size_t refcnt;
7858 jmethodID persist_new_channel_meth;
7859 jmethodID update_persisted_channel_meth;
7860 } LDKPersist_JCalls;
7861 static void LDKPersist_JCalls_free(void* this_arg) {
7862 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7863 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7865 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7866 if (get_jenv_res == JNI_EDETACHED) {
7867 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7869 DO_ASSERT(get_jenv_res == JNI_OK);
7871 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7872 if (get_jenv_res == JNI_EDETACHED) {
7873 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7878 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
7879 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7881 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7882 if (get_jenv_res == JNI_EDETACHED) {
7883 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7885 DO_ASSERT(get_jenv_res == JNI_OK);
7887 LDKOutPoint id_var = id;
7888 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7889 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7890 uint64_t id_ref = (uint64_t)id_var.inner;
7891 if (id_var.is_owned) {
7894 LDKChannelMonitor data_var = *data;
7895 data_var = ChannelMonitor_clone(data);
7896 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7897 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7898 uint64_t data_ref = (uint64_t)data_var.inner;
7899 if (data_var.is_owned) {
7902 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7904 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
7905 if ((*env)->ExceptionCheck(env)) {
7906 (*env)->ExceptionDescribe(env);
7907 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
7909 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7910 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7911 if (get_jenv_res == JNI_EDETACHED) {
7912 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7916 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
7917 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7919 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7920 if (get_jenv_res == JNI_EDETACHED) {
7921 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7923 DO_ASSERT(get_jenv_res == JNI_OK);
7925 LDKOutPoint id_var = id;
7926 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7927 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7928 uint64_t id_ref = (uint64_t)id_var.inner;
7929 if (id_var.is_owned) {
7932 LDKChannelMonitorUpdate update_var = *update;
7933 update_var = ChannelMonitorUpdate_clone(update);
7934 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7935 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7936 uint64_t update_ref = (uint64_t)update_var.inner;
7937 if (update_var.is_owned) {
7940 LDKChannelMonitor data_var = *data;
7941 data_var = ChannelMonitor_clone(data);
7942 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7943 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7944 uint64_t data_ref = (uint64_t)data_var.inner;
7945 if (data_var.is_owned) {
7948 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7950 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
7951 if ((*env)->ExceptionCheck(env)) {
7952 (*env)->ExceptionDescribe(env);
7953 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
7955 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7956 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7957 if (get_jenv_res == JNI_EDETACHED) {
7958 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7962 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7963 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7964 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7966 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
7967 jclass c = (*env)->GetObjectClass(env, o);
7969 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7970 atomic_init(&calls->refcnt, 1);
7971 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7972 calls->o = (*env)->NewWeakGlobalRef(env, o);
7973 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
7974 CHECK(calls->persist_new_channel_meth != NULL);
7975 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
7976 CHECK(calls->update_persisted_channel_meth != NULL);
7979 .this_arg = (void*) calls,
7980 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7981 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7982 .free = LDKPersist_JCalls_free,
7986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
7987 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7988 *res_ptr = LDKPersist_init(env, clz, o);
7989 return (uint64_t)res_ptr;
7991 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) {
7992 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7993 LDKOutPoint id_conv;
7994 id_conv.inner = (void*)(id & (~1));
7995 id_conv.is_owned = (id & 1) || (id == 0);
7996 id_conv = OutPoint_clone(&id_conv);
7997 LDKChannelMonitor data_conv;
7998 data_conv.inner = (void*)(data & (~1));
7999 data_conv.is_owned = false;
8000 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8001 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
8002 return (uint64_t)ret_conv;
8005 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) {
8006 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
8007 LDKOutPoint id_conv;
8008 id_conv.inner = (void*)(id & (~1));
8009 id_conv.is_owned = (id & 1) || (id == 0);
8010 id_conv = OutPoint_clone(&id_conv);
8011 LDKChannelMonitorUpdate update_conv;
8012 update_conv.inner = (void*)(update & (~1));
8013 update_conv.is_owned = false;
8014 LDKChannelMonitor data_conv;
8015 data_conv.inner = (void*)(data & (~1));
8016 data_conv.is_owned = false;
8017 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
8018 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
8019 return (uint64_t)ret_conv;
8022 typedef struct LDKChannelMessageHandler_JCalls {
8023 atomic_size_t refcnt;
8026 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8027 jmethodID handle_open_channel_meth;
8028 jmethodID handle_accept_channel_meth;
8029 jmethodID handle_funding_created_meth;
8030 jmethodID handle_funding_signed_meth;
8031 jmethodID handle_funding_locked_meth;
8032 jmethodID handle_shutdown_meth;
8033 jmethodID handle_closing_signed_meth;
8034 jmethodID handle_update_add_htlc_meth;
8035 jmethodID handle_update_fulfill_htlc_meth;
8036 jmethodID handle_update_fail_htlc_meth;
8037 jmethodID handle_update_fail_malformed_htlc_meth;
8038 jmethodID handle_commitment_signed_meth;
8039 jmethodID handle_revoke_and_ack_meth;
8040 jmethodID handle_update_fee_meth;
8041 jmethodID handle_announcement_signatures_meth;
8042 jmethodID peer_disconnected_meth;
8043 jmethodID peer_connected_meth;
8044 jmethodID handle_channel_reestablish_meth;
8045 jmethodID handle_channel_update_meth;
8046 jmethodID handle_error_meth;
8047 } LDKChannelMessageHandler_JCalls;
8048 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
8049 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8050 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8052 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8053 if (get_jenv_res == JNI_EDETACHED) {
8054 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8056 DO_ASSERT(get_jenv_res == JNI_OK);
8058 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8059 if (get_jenv_res == JNI_EDETACHED) {
8060 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8065 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
8066 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8068 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8069 if (get_jenv_res == JNI_EDETACHED) {
8070 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8072 DO_ASSERT(get_jenv_res == JNI_OK);
8074 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8075 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8076 LDKInitFeatures their_features_var = their_features;
8077 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8078 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8079 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8080 if (their_features_var.is_owned) {
8081 their_features_ref |= 1;
8083 LDKOpenChannel msg_var = *msg;
8084 msg_var = OpenChannel_clone(msg);
8085 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8086 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8087 uint64_t msg_ref = (uint64_t)msg_var.inner;
8088 if (msg_var.is_owned) {
8091 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8093 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8094 if ((*env)->ExceptionCheck(env)) {
8095 (*env)->ExceptionDescribe(env);
8096 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
8098 if (get_jenv_res == JNI_EDETACHED) {
8099 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8102 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
8103 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8105 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8106 if (get_jenv_res == JNI_EDETACHED) {
8107 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8109 DO_ASSERT(get_jenv_res == JNI_OK);
8111 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8112 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8113 LDKInitFeatures their_features_var = their_features;
8114 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8115 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8116 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8117 if (their_features_var.is_owned) {
8118 their_features_ref |= 1;
8120 LDKAcceptChannel msg_var = *msg;
8121 msg_var = AcceptChannel_clone(msg);
8122 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8123 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8124 uint64_t msg_ref = (uint64_t)msg_var.inner;
8125 if (msg_var.is_owned) {
8128 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8130 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
8131 if ((*env)->ExceptionCheck(env)) {
8132 (*env)->ExceptionDescribe(env);
8133 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
8135 if (get_jenv_res == JNI_EDETACHED) {
8136 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8139 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
8140 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8142 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8143 if (get_jenv_res == JNI_EDETACHED) {
8144 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8146 DO_ASSERT(get_jenv_res == JNI_OK);
8148 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8149 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8150 LDKFundingCreated msg_var = *msg;
8151 msg_var = FundingCreated_clone(msg);
8152 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8153 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8154 uint64_t msg_ref = (uint64_t)msg_var.inner;
8155 if (msg_var.is_owned) {
8158 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8160 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
8161 if ((*env)->ExceptionCheck(env)) {
8162 (*env)->ExceptionDescribe(env);
8163 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
8165 if (get_jenv_res == JNI_EDETACHED) {
8166 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8169 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8170 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8172 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8173 if (get_jenv_res == JNI_EDETACHED) {
8174 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8176 DO_ASSERT(get_jenv_res == JNI_OK);
8178 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8179 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8180 LDKFundingSigned msg_var = *msg;
8181 msg_var = FundingSigned_clone(msg);
8182 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8183 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8184 uint64_t msg_ref = (uint64_t)msg_var.inner;
8185 if (msg_var.is_owned) {
8188 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8190 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
8191 if ((*env)->ExceptionCheck(env)) {
8192 (*env)->ExceptionDescribe(env);
8193 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
8195 if (get_jenv_res == JNI_EDETACHED) {
8196 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8199 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8200 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8202 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8203 if (get_jenv_res == JNI_EDETACHED) {
8204 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8206 DO_ASSERT(get_jenv_res == JNI_OK);
8208 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8209 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8210 LDKFundingLocked msg_var = *msg;
8211 msg_var = FundingLocked_clone(msg);
8212 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8213 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8214 uint64_t msg_ref = (uint64_t)msg_var.inner;
8215 if (msg_var.is_owned) {
8218 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8220 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
8221 if ((*env)->ExceptionCheck(env)) {
8222 (*env)->ExceptionDescribe(env);
8223 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
8225 if (get_jenv_res == JNI_EDETACHED) {
8226 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8229 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8230 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8232 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8233 if (get_jenv_res == JNI_EDETACHED) {
8234 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8236 DO_ASSERT(get_jenv_res == JNI_OK);
8238 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8239 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8240 LDKInitFeatures their_features_var = *their_features;
8241 their_features_var = InitFeatures_clone(their_features);
8242 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8243 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8244 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8245 if (their_features_var.is_owned) {
8246 their_features_ref |= 1;
8248 LDKShutdown msg_var = *msg;
8249 msg_var = Shutdown_clone(msg);
8250 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8251 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8252 uint64_t msg_ref = (uint64_t)msg_var.inner;
8253 if (msg_var.is_owned) {
8256 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8258 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
8259 if ((*env)->ExceptionCheck(env)) {
8260 (*env)->ExceptionDescribe(env);
8261 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
8263 if (get_jenv_res == JNI_EDETACHED) {
8264 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8267 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8268 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8270 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8271 if (get_jenv_res == JNI_EDETACHED) {
8272 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8274 DO_ASSERT(get_jenv_res == JNI_OK);
8276 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8277 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8278 LDKClosingSigned msg_var = *msg;
8279 msg_var = ClosingSigned_clone(msg);
8280 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8281 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8282 uint64_t msg_ref = (uint64_t)msg_var.inner;
8283 if (msg_var.is_owned) {
8286 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8288 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
8289 if ((*env)->ExceptionCheck(env)) {
8290 (*env)->ExceptionDescribe(env);
8291 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
8293 if (get_jenv_res == JNI_EDETACHED) {
8294 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8297 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8298 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8300 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8301 if (get_jenv_res == JNI_EDETACHED) {
8302 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8304 DO_ASSERT(get_jenv_res == JNI_OK);
8306 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8307 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8308 LDKUpdateAddHTLC msg_var = *msg;
8309 msg_var = UpdateAddHTLC_clone(msg);
8310 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8311 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8312 uint64_t msg_ref = (uint64_t)msg_var.inner;
8313 if (msg_var.is_owned) {
8316 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8318 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
8319 if ((*env)->ExceptionCheck(env)) {
8320 (*env)->ExceptionDescribe(env);
8321 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
8323 if (get_jenv_res == JNI_EDETACHED) {
8324 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8327 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8328 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8337 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8338 LDKUpdateFulfillHTLC msg_var = *msg;
8339 msg_var = UpdateFulfillHTLC_clone(msg);
8340 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8341 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8342 uint64_t msg_ref = (uint64_t)msg_var.inner;
8343 if (msg_var.is_owned) {
8346 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8348 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
8349 if ((*env)->ExceptionCheck(env)) {
8350 (*env)->ExceptionDescribe(env);
8351 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
8353 if (get_jenv_res == JNI_EDETACHED) {
8354 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8357 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8358 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8360 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8361 if (get_jenv_res == JNI_EDETACHED) {
8362 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8364 DO_ASSERT(get_jenv_res == JNI_OK);
8366 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8367 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8368 LDKUpdateFailHTLC msg_var = *msg;
8369 msg_var = UpdateFailHTLC_clone(msg);
8370 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8371 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8372 uint64_t msg_ref = (uint64_t)msg_var.inner;
8373 if (msg_var.is_owned) {
8376 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8378 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
8379 if ((*env)->ExceptionCheck(env)) {
8380 (*env)->ExceptionDescribe(env);
8381 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
8383 if (get_jenv_res == JNI_EDETACHED) {
8384 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8387 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8388 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8390 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8391 if (get_jenv_res == JNI_EDETACHED) {
8392 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8394 DO_ASSERT(get_jenv_res == JNI_OK);
8396 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8397 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8398 LDKUpdateFailMalformedHTLC msg_var = *msg;
8399 msg_var = UpdateFailMalformedHTLC_clone(msg);
8400 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8401 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8402 uint64_t msg_ref = (uint64_t)msg_var.inner;
8403 if (msg_var.is_owned) {
8406 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8408 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
8409 if ((*env)->ExceptionCheck(env)) {
8410 (*env)->ExceptionDescribe(env);
8411 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
8413 if (get_jenv_res == JNI_EDETACHED) {
8414 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8417 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8418 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8420 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8421 if (get_jenv_res == JNI_EDETACHED) {
8422 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8424 DO_ASSERT(get_jenv_res == JNI_OK);
8426 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8427 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8428 LDKCommitmentSigned msg_var = *msg;
8429 msg_var = CommitmentSigned_clone(msg);
8430 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8431 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8432 uint64_t msg_ref = (uint64_t)msg_var.inner;
8433 if (msg_var.is_owned) {
8436 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8438 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
8439 if ((*env)->ExceptionCheck(env)) {
8440 (*env)->ExceptionDescribe(env);
8441 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
8443 if (get_jenv_res == JNI_EDETACHED) {
8444 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8447 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8448 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8450 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8451 if (get_jenv_res == JNI_EDETACHED) {
8452 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8454 DO_ASSERT(get_jenv_res == JNI_OK);
8456 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8457 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8458 LDKRevokeAndACK msg_var = *msg;
8459 msg_var = RevokeAndACK_clone(msg);
8460 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8461 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8462 uint64_t msg_ref = (uint64_t)msg_var.inner;
8463 if (msg_var.is_owned) {
8466 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8468 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
8469 if ((*env)->ExceptionCheck(env)) {
8470 (*env)->ExceptionDescribe(env);
8471 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
8473 if (get_jenv_res == JNI_EDETACHED) {
8474 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8477 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8478 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8480 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8481 if (get_jenv_res == JNI_EDETACHED) {
8482 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8484 DO_ASSERT(get_jenv_res == JNI_OK);
8486 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8487 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8488 LDKUpdateFee msg_var = *msg;
8489 msg_var = UpdateFee_clone(msg);
8490 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8491 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8492 uint64_t msg_ref = (uint64_t)msg_var.inner;
8493 if (msg_var.is_owned) {
8496 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8498 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
8499 if ((*env)->ExceptionCheck(env)) {
8500 (*env)->ExceptionDescribe(env);
8501 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
8503 if (get_jenv_res == JNI_EDETACHED) {
8504 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8507 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8508 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8510 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8511 if (get_jenv_res == JNI_EDETACHED) {
8512 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8514 DO_ASSERT(get_jenv_res == JNI_OK);
8516 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8517 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8518 LDKAnnouncementSignatures msg_var = *msg;
8519 msg_var = AnnouncementSignatures_clone(msg);
8520 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8521 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8522 uint64_t msg_ref = (uint64_t)msg_var.inner;
8523 if (msg_var.is_owned) {
8526 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8528 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
8529 if ((*env)->ExceptionCheck(env)) {
8530 (*env)->ExceptionDescribe(env);
8531 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
8533 if (get_jenv_res == JNI_EDETACHED) {
8534 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8537 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8538 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8540 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8541 if (get_jenv_res == JNI_EDETACHED) {
8542 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8544 DO_ASSERT(get_jenv_res == JNI_OK);
8546 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8547 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8548 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8550 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
8551 if ((*env)->ExceptionCheck(env)) {
8552 (*env)->ExceptionDescribe(env);
8553 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
8555 if (get_jenv_res == JNI_EDETACHED) {
8556 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8559 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8560 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8562 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8563 if (get_jenv_res == JNI_EDETACHED) {
8564 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8566 DO_ASSERT(get_jenv_res == JNI_OK);
8568 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8569 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8570 LDKInit msg_var = *msg;
8571 msg_var = Init_clone(msg);
8572 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8573 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8574 uint64_t msg_ref = (uint64_t)msg_var.inner;
8575 if (msg_var.is_owned) {
8578 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8580 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
8581 if ((*env)->ExceptionCheck(env)) {
8582 (*env)->ExceptionDescribe(env);
8583 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
8585 if (get_jenv_res == JNI_EDETACHED) {
8586 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8589 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8590 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8592 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8593 if (get_jenv_res == JNI_EDETACHED) {
8594 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8596 DO_ASSERT(get_jenv_res == JNI_OK);
8598 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8599 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8600 LDKChannelReestablish msg_var = *msg;
8601 msg_var = ChannelReestablish_clone(msg);
8602 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8603 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8604 uint64_t msg_ref = (uint64_t)msg_var.inner;
8605 if (msg_var.is_owned) {
8608 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8610 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
8611 if ((*env)->ExceptionCheck(env)) {
8612 (*env)->ExceptionDescribe(env);
8613 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
8615 if (get_jenv_res == JNI_EDETACHED) {
8616 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8619 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8620 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8622 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8623 if (get_jenv_res == JNI_EDETACHED) {
8624 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8626 DO_ASSERT(get_jenv_res == JNI_OK);
8628 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8629 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8630 LDKChannelUpdate msg_var = *msg;
8631 msg_var = ChannelUpdate_clone(msg);
8632 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8633 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8634 uint64_t msg_ref = (uint64_t)msg_var.inner;
8635 if (msg_var.is_owned) {
8638 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8640 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
8641 if ((*env)->ExceptionCheck(env)) {
8642 (*env)->ExceptionDescribe(env);
8643 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
8645 if (get_jenv_res == JNI_EDETACHED) {
8646 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8649 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8650 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8652 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8653 if (get_jenv_res == JNI_EDETACHED) {
8654 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8656 DO_ASSERT(get_jenv_res == JNI_OK);
8658 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8659 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8660 LDKErrorMessage msg_var = *msg;
8661 msg_var = ErrorMessage_clone(msg);
8662 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8663 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8664 uint64_t msg_ref = (uint64_t)msg_var.inner;
8665 if (msg_var.is_owned) {
8668 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8670 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
8671 if ((*env)->ExceptionCheck(env)) {
8672 (*env)->ExceptionDescribe(env);
8673 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
8675 if (get_jenv_res == JNI_EDETACHED) {
8676 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8679 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8680 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8681 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8682 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8684 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8685 jclass c = (*env)->GetObjectClass(env, o);
8687 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8688 atomic_init(&calls->refcnt, 1);
8689 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8690 calls->o = (*env)->NewWeakGlobalRef(env, o);
8691 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
8692 CHECK(calls->handle_open_channel_meth != NULL);
8693 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
8694 CHECK(calls->handle_accept_channel_meth != NULL);
8695 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
8696 CHECK(calls->handle_funding_created_meth != NULL);
8697 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
8698 CHECK(calls->handle_funding_signed_meth != NULL);
8699 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
8700 CHECK(calls->handle_funding_locked_meth != NULL);
8701 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
8702 CHECK(calls->handle_shutdown_meth != NULL);
8703 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
8704 CHECK(calls->handle_closing_signed_meth != NULL);
8705 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
8706 CHECK(calls->handle_update_add_htlc_meth != NULL);
8707 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
8708 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
8709 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
8710 CHECK(calls->handle_update_fail_htlc_meth != NULL);
8711 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
8712 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
8713 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
8714 CHECK(calls->handle_commitment_signed_meth != NULL);
8715 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
8716 CHECK(calls->handle_revoke_and_ack_meth != NULL);
8717 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
8718 CHECK(calls->handle_update_fee_meth != NULL);
8719 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
8720 CHECK(calls->handle_announcement_signatures_meth != NULL);
8721 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
8722 CHECK(calls->peer_disconnected_meth != NULL);
8723 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
8724 CHECK(calls->peer_connected_meth != NULL);
8725 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
8726 CHECK(calls->handle_channel_reestablish_meth != NULL);
8727 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
8728 CHECK(calls->handle_channel_update_meth != NULL);
8729 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
8730 CHECK(calls->handle_error_meth != NULL);
8732 LDKChannelMessageHandler ret = {
8733 .this_arg = (void*) calls,
8734 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8735 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8736 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8737 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8738 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
8739 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8740 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8741 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8742 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8743 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8744 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8745 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8746 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8747 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8748 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8749 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8750 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8751 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8752 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8753 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8754 .free = LDKChannelMessageHandler_JCalls_free,
8755 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8757 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8761 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8762 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8763 return (uint64_t)res_ptr;
8765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8766 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
8767 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8768 DO_ASSERT((res_ptr & 1) == 0);
8769 return (int64_t)(res_ptr | 1);
8771 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) {
8772 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8773 LDKPublicKey their_node_id_ref;
8774 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8775 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8776 LDKInitFeatures their_features_conv;
8777 their_features_conv.inner = (void*)(their_features & (~1));
8778 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8779 their_features_conv = InitFeatures_clone(&their_features_conv);
8780 LDKOpenChannel msg_conv;
8781 msg_conv.inner = (void*)(msg & (~1));
8782 msg_conv.is_owned = false;
8783 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8786 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) {
8787 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8788 LDKPublicKey their_node_id_ref;
8789 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8790 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8791 LDKInitFeatures their_features_conv;
8792 their_features_conv.inner = (void*)(their_features & (~1));
8793 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8794 their_features_conv = InitFeatures_clone(&their_features_conv);
8795 LDKAcceptChannel msg_conv;
8796 msg_conv.inner = (void*)(msg & (~1));
8797 msg_conv.is_owned = false;
8798 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8801 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) {
8802 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8803 LDKPublicKey their_node_id_ref;
8804 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8805 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8806 LDKFundingCreated msg_conv;
8807 msg_conv.inner = (void*)(msg & (~1));
8808 msg_conv.is_owned = false;
8809 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8812 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) {
8813 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8814 LDKPublicKey their_node_id_ref;
8815 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8816 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8817 LDKFundingSigned msg_conv;
8818 msg_conv.inner = (void*)(msg & (~1));
8819 msg_conv.is_owned = false;
8820 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8823 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) {
8824 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8825 LDKPublicKey their_node_id_ref;
8826 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8827 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8828 LDKFundingLocked msg_conv;
8829 msg_conv.inner = (void*)(msg & (~1));
8830 msg_conv.is_owned = false;
8831 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8834 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) {
8835 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8836 LDKPublicKey their_node_id_ref;
8837 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8838 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8839 LDKInitFeatures their_features_conv;
8840 their_features_conv.inner = (void*)(their_features & (~1));
8841 their_features_conv.is_owned = false;
8842 LDKShutdown msg_conv;
8843 msg_conv.inner = (void*)(msg & (~1));
8844 msg_conv.is_owned = false;
8845 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8848 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) {
8849 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8850 LDKPublicKey their_node_id_ref;
8851 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8852 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8853 LDKClosingSigned msg_conv;
8854 msg_conv.inner = (void*)(msg & (~1));
8855 msg_conv.is_owned = false;
8856 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8859 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) {
8860 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8861 LDKPublicKey their_node_id_ref;
8862 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8863 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8864 LDKUpdateAddHTLC msg_conv;
8865 msg_conv.inner = (void*)(msg & (~1));
8866 msg_conv.is_owned = false;
8867 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8870 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) {
8871 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8872 LDKPublicKey their_node_id_ref;
8873 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8874 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8875 LDKUpdateFulfillHTLC msg_conv;
8876 msg_conv.inner = (void*)(msg & (~1));
8877 msg_conv.is_owned = false;
8878 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8881 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) {
8882 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8883 LDKPublicKey their_node_id_ref;
8884 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8885 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8886 LDKUpdateFailHTLC msg_conv;
8887 msg_conv.inner = (void*)(msg & (~1));
8888 msg_conv.is_owned = false;
8889 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8892 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) {
8893 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8894 LDKPublicKey their_node_id_ref;
8895 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8896 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8897 LDKUpdateFailMalformedHTLC msg_conv;
8898 msg_conv.inner = (void*)(msg & (~1));
8899 msg_conv.is_owned = false;
8900 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8903 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) {
8904 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8905 LDKPublicKey their_node_id_ref;
8906 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8907 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8908 LDKCommitmentSigned msg_conv;
8909 msg_conv.inner = (void*)(msg & (~1));
8910 msg_conv.is_owned = false;
8911 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8914 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) {
8915 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8916 LDKPublicKey their_node_id_ref;
8917 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8918 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8919 LDKRevokeAndACK msg_conv;
8920 msg_conv.inner = (void*)(msg & (~1));
8921 msg_conv.is_owned = false;
8922 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8925 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) {
8926 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8927 LDKPublicKey their_node_id_ref;
8928 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8929 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8930 LDKUpdateFee msg_conv;
8931 msg_conv.inner = (void*)(msg & (~1));
8932 msg_conv.is_owned = false;
8933 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8936 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) {
8937 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8938 LDKPublicKey their_node_id_ref;
8939 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8940 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8941 LDKAnnouncementSignatures msg_conv;
8942 msg_conv.inner = (void*)(msg & (~1));
8943 msg_conv.is_owned = false;
8944 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8947 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) {
8948 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8949 LDKPublicKey their_node_id_ref;
8950 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8951 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8952 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8955 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) {
8956 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8957 LDKPublicKey their_node_id_ref;
8958 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8959 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8961 msg_conv.inner = (void*)(msg & (~1));
8962 msg_conv.is_owned = false;
8963 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8966 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) {
8967 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8968 LDKPublicKey their_node_id_ref;
8969 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8970 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8971 LDKChannelReestablish msg_conv;
8972 msg_conv.inner = (void*)(msg & (~1));
8973 msg_conv.is_owned = false;
8974 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8977 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) {
8978 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8979 LDKPublicKey their_node_id_ref;
8980 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8981 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8982 LDKChannelUpdate msg_conv;
8983 msg_conv.inner = (void*)(msg & (~1));
8984 msg_conv.is_owned = false;
8985 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8988 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) {
8989 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8990 LDKPublicKey their_node_id_ref;
8991 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8992 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8993 LDKErrorMessage msg_conv;
8994 msg_conv.inner = (void*)(msg & (~1));
8995 msg_conv.is_owned = false;
8996 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8999 typedef struct LDKRoutingMessageHandler_JCalls {
9000 atomic_size_t refcnt;
9003 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9004 jmethodID handle_node_announcement_meth;
9005 jmethodID handle_channel_announcement_meth;
9006 jmethodID handle_channel_update_meth;
9007 jmethodID get_next_channel_announcements_meth;
9008 jmethodID get_next_node_announcements_meth;
9009 jmethodID sync_routing_table_meth;
9010 jmethodID handle_reply_channel_range_meth;
9011 jmethodID handle_reply_short_channel_ids_end_meth;
9012 jmethodID handle_query_channel_range_meth;
9013 jmethodID handle_query_short_channel_ids_meth;
9014 } LDKRoutingMessageHandler_JCalls;
9015 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9016 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9017 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9019 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9020 if (get_jenv_res == JNI_EDETACHED) {
9021 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9023 DO_ASSERT(get_jenv_res == JNI_OK);
9025 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9026 if (get_jenv_res == JNI_EDETACHED) {
9027 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9032 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9033 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9035 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9036 if (get_jenv_res == JNI_EDETACHED) {
9037 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9039 DO_ASSERT(get_jenv_res == JNI_OK);
9041 LDKNodeAnnouncement msg_var = *msg;
9042 msg_var = NodeAnnouncement_clone(msg);
9043 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9044 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9045 uint64_t msg_ref = (uint64_t)msg_var.inner;
9046 if (msg_var.is_owned) {
9049 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9051 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
9052 if ((*env)->ExceptionCheck(env)) {
9053 (*env)->ExceptionDescribe(env);
9054 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9056 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
9057 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9058 if (get_jenv_res == JNI_EDETACHED) {
9059 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9063 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9064 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9066 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9067 if (get_jenv_res == JNI_EDETACHED) {
9068 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9070 DO_ASSERT(get_jenv_res == JNI_OK);
9072 LDKChannelAnnouncement msg_var = *msg;
9073 msg_var = ChannelAnnouncement_clone(msg);
9074 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9075 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9076 uint64_t msg_ref = (uint64_t)msg_var.inner;
9077 if (msg_var.is_owned) {
9080 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9082 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
9083 if ((*env)->ExceptionCheck(env)) {
9084 (*env)->ExceptionDescribe(env);
9085 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
9087 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
9088 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9089 if (get_jenv_res == JNI_EDETACHED) {
9090 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9094 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9095 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9097 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9098 if (get_jenv_res == JNI_EDETACHED) {
9099 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9101 DO_ASSERT(get_jenv_res == JNI_OK);
9103 LDKChannelUpdate msg_var = *msg;
9104 msg_var = ChannelUpdate_clone(msg);
9105 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9106 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9107 uint64_t msg_ref = (uint64_t)msg_var.inner;
9108 if (msg_var.is_owned) {
9111 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9113 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
9114 if ((*env)->ExceptionCheck(env)) {
9115 (*env)->ExceptionDescribe(env);
9116 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
9118 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
9119 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
9120 if (get_jenv_res == JNI_EDETACHED) {
9121 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9125 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
9126 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9128 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9129 if (get_jenv_res == JNI_EDETACHED) {
9130 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9132 DO_ASSERT(get_jenv_res == JNI_OK);
9134 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9136 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
9137 if ((*env)->ExceptionCheck(env)) {
9138 (*env)->ExceptionDescribe(env);
9139 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9141 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
9142 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9143 if (ret_constr.datalen > 0)
9144 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
9146 ret_constr.data = NULL;
9147 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9148 for (size_t h = 0; h < ret_constr.datalen; h++) {
9149 int64_t ret_conv_59 = ret_vals[h];
9150 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1);
9151 ret_conv_59_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_59) & ~1));
9152 ret_constr.data[h] = ret_conv_59_conv;
9154 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9155 if (get_jenv_res == JNI_EDETACHED) {
9156 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9160 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9161 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9163 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9164 if (get_jenv_res == JNI_EDETACHED) {
9165 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9167 DO_ASSERT(get_jenv_res == JNI_OK);
9169 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
9170 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
9171 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9173 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
9174 if ((*env)->ExceptionCheck(env)) {
9175 (*env)->ExceptionDescribe(env);
9176 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9178 LDKCVec_NodeAnnouncementZ ret_constr;
9179 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9180 if (ret_constr.datalen > 0)
9181 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9183 ret_constr.data = NULL;
9184 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9185 for (size_t s = 0; s < ret_constr.datalen; s++) {
9186 int64_t ret_conv_18 = ret_vals[s];
9187 LDKNodeAnnouncement ret_conv_18_conv;
9188 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9189 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9190 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
9191 ret_constr.data[s] = ret_conv_18_conv;
9193 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9194 if (get_jenv_res == JNI_EDETACHED) {
9195 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9199 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9200 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9202 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9203 if (get_jenv_res == JNI_EDETACHED) {
9204 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9206 DO_ASSERT(get_jenv_res == JNI_OK);
9208 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9209 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9210 LDKInit init_var = *init;
9211 init_var = Init_clone(init);
9212 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9213 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9214 uint64_t init_ref = (uint64_t)init_var.inner;
9215 if (init_var.is_owned) {
9218 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9220 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
9221 if ((*env)->ExceptionCheck(env)) {
9222 (*env)->ExceptionDescribe(env);
9223 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
9225 if (get_jenv_res == JNI_EDETACHED) {
9226 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9229 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9230 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9232 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9233 if (get_jenv_res == JNI_EDETACHED) {
9234 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9236 DO_ASSERT(get_jenv_res == JNI_OK);
9238 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9239 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9240 LDKReplyChannelRange msg_var = msg;
9241 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9242 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9243 uint64_t msg_ref = (uint64_t)msg_var.inner;
9244 if (msg_var.is_owned) {
9247 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9249 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
9250 if ((*env)->ExceptionCheck(env)) {
9251 (*env)->ExceptionDescribe(env);
9252 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9254 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9255 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9256 if (get_jenv_res == JNI_EDETACHED) {
9257 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9261 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9262 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9264 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9265 if (get_jenv_res == JNI_EDETACHED) {
9266 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9268 DO_ASSERT(get_jenv_res == JNI_OK);
9270 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9271 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9272 LDKReplyShortChannelIdsEnd msg_var = msg;
9273 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9274 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9275 uint64_t msg_ref = (uint64_t)msg_var.inner;
9276 if (msg_var.is_owned) {
9279 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9281 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
9282 if ((*env)->ExceptionCheck(env)) {
9283 (*env)->ExceptionDescribe(env);
9284 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
9286 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9287 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9288 if (get_jenv_res == JNI_EDETACHED) {
9289 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9293 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9294 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9296 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9297 if (get_jenv_res == JNI_EDETACHED) {
9298 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9300 DO_ASSERT(get_jenv_res == JNI_OK);
9302 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9303 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9304 LDKQueryChannelRange msg_var = msg;
9305 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9306 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9307 uint64_t msg_ref = (uint64_t)msg_var.inner;
9308 if (msg_var.is_owned) {
9311 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9313 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
9314 if ((*env)->ExceptionCheck(env)) {
9315 (*env)->ExceptionDescribe(env);
9316 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9318 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9319 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9320 if (get_jenv_res == JNI_EDETACHED) {
9321 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9325 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9326 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9328 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9329 if (get_jenv_res == JNI_EDETACHED) {
9330 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9332 DO_ASSERT(get_jenv_res == JNI_OK);
9334 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9335 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9336 LDKQueryShortChannelIds msg_var = msg;
9337 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9338 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9339 uint64_t msg_ref = (uint64_t)msg_var.inner;
9340 if (msg_var.is_owned) {
9343 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9345 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
9346 if ((*env)->ExceptionCheck(env)) {
9347 (*env)->ExceptionDescribe(env);
9348 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
9350 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9351 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9352 if (get_jenv_res == JNI_EDETACHED) {
9353 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9357 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9358 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9359 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9360 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9362 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9363 jclass c = (*env)->GetObjectClass(env, o);
9365 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9366 atomic_init(&calls->refcnt, 1);
9367 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9368 calls->o = (*env)->NewWeakGlobalRef(env, o);
9369 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
9370 CHECK(calls->handle_node_announcement_meth != NULL);
9371 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
9372 CHECK(calls->handle_channel_announcement_meth != NULL);
9373 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
9374 CHECK(calls->handle_channel_update_meth != NULL);
9375 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
9376 CHECK(calls->get_next_channel_announcements_meth != NULL);
9377 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
9378 CHECK(calls->get_next_node_announcements_meth != NULL);
9379 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
9380 CHECK(calls->sync_routing_table_meth != NULL);
9381 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
9382 CHECK(calls->handle_reply_channel_range_meth != NULL);
9383 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
9384 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
9385 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
9386 CHECK(calls->handle_query_channel_range_meth != NULL);
9387 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
9388 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
9390 LDKRoutingMessageHandler ret = {
9391 .this_arg = (void*) calls,
9392 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9393 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9394 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9395 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9396 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9397 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9398 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9399 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9400 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9401 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9402 .free = LDKRoutingMessageHandler_JCalls_free,
9403 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9405 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9409 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9410 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9411 return (uint64_t)res_ptr;
9413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9414 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
9415 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9416 DO_ASSERT((res_ptr & 1) == 0);
9417 return (int64_t)(res_ptr | 1);
9419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9420 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9421 LDKNodeAnnouncement msg_conv;
9422 msg_conv.inner = (void*)(msg & (~1));
9423 msg_conv.is_owned = false;
9424 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9425 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9426 return (uint64_t)ret_conv;
9429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9430 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9431 LDKChannelAnnouncement msg_conv;
9432 msg_conv.inner = (void*)(msg & (~1));
9433 msg_conv.is_owned = false;
9434 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9435 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9436 return (uint64_t)ret_conv;
9439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9440 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9441 LDKChannelUpdate msg_conv;
9442 msg_conv.inner = (void*)(msg & (~1));
9443 msg_conv.is_owned = false;
9444 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9445 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9446 return (uint64_t)ret_conv;
9449 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) {
9450 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9451 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9452 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9453 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9454 for (size_t h = 0; h < ret_var.datalen; h++) {
9455 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9456 *ret_conv_59_conv = ret_var.data[h];
9457 ret_arr_ptr[h] = ((uint64_t)ret_conv_59_conv);
9459 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9464 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) {
9465 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9466 LDKPublicKey starting_point_ref;
9467 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
9468 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
9469 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9470 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9471 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9472 for (size_t s = 0; s < ret_var.datalen; s++) {
9473 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9474 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9475 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9476 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
9477 if (ret_conv_18_var.is_owned) {
9478 ret_conv_18_ref |= 1;
9480 ret_arr_ptr[s] = ret_conv_18_ref;
9482 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9487 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) {
9488 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9489 LDKPublicKey their_node_id_ref;
9490 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9491 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9493 init_conv.inner = (void*)(init & (~1));
9494 init_conv.is_owned = false;
9495 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9498 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) {
9499 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9500 LDKPublicKey their_node_id_ref;
9501 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9502 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9503 LDKReplyChannelRange msg_conv;
9504 msg_conv.inner = (void*)(msg & (~1));
9505 msg_conv.is_owned = (msg & 1) || (msg == 0);
9506 msg_conv = ReplyChannelRange_clone(&msg_conv);
9507 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9508 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9509 return (uint64_t)ret_conv;
9512 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) {
9513 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9514 LDKPublicKey their_node_id_ref;
9515 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9516 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9517 LDKReplyShortChannelIdsEnd msg_conv;
9518 msg_conv.inner = (void*)(msg & (~1));
9519 msg_conv.is_owned = (msg & 1) || (msg == 0);
9520 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9521 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9522 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9523 return (uint64_t)ret_conv;
9526 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) {
9527 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9528 LDKPublicKey their_node_id_ref;
9529 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9530 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9531 LDKQueryChannelRange msg_conv;
9532 msg_conv.inner = (void*)(msg & (~1));
9533 msg_conv.is_owned = (msg & 1) || (msg == 0);
9534 msg_conv = QueryChannelRange_clone(&msg_conv);
9535 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9536 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9537 return (uint64_t)ret_conv;
9540 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) {
9541 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9542 LDKPublicKey their_node_id_ref;
9543 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9544 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9545 LDKQueryShortChannelIds msg_conv;
9546 msg_conv.inner = (void*)(msg & (~1));
9547 msg_conv.is_owned = (msg & 1) || (msg == 0);
9548 msg_conv = QueryShortChannelIds_clone(&msg_conv);
9549 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9550 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9551 return (uint64_t)ret_conv;
9554 typedef struct LDKCustomMessageReader_JCalls {
9555 atomic_size_t refcnt;
9558 jmethodID read_meth;
9559 } LDKCustomMessageReader_JCalls;
9560 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9561 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9562 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9564 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9565 if (get_jenv_res == JNI_EDETACHED) {
9566 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9568 DO_ASSERT(get_jenv_res == JNI_OK);
9570 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9571 if (get_jenv_res == JNI_EDETACHED) {
9572 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9577 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9578 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9580 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9581 if (get_jenv_res == JNI_EDETACHED) {
9582 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9584 DO_ASSERT(get_jenv_res == JNI_OK);
9586 LDKu8slice buffer_var = buffer;
9587 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
9588 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
9589 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9591 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
9592 if ((*env)->ExceptionCheck(env)) {
9593 (*env)->ExceptionDescribe(env);
9594 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
9596 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
9597 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
9598 if (get_jenv_res == JNI_EDETACHED) {
9599 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9603 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9604 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9605 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9607 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
9608 jclass c = (*env)->GetObjectClass(env, o);
9610 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9611 atomic_init(&calls->refcnt, 1);
9612 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9613 calls->o = (*env)->NewWeakGlobalRef(env, o);
9614 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
9615 CHECK(calls->read_meth != NULL);
9617 LDKCustomMessageReader ret = {
9618 .this_arg = (void*) calls,
9619 .read = read_LDKCustomMessageReader_jcall,
9620 .free = LDKCustomMessageReader_JCalls_free,
9624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
9625 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9626 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
9627 return (uint64_t)res_ptr;
9629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
9630 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
9631 LDKu8slice buffer_ref;
9632 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
9633 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
9634 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9635 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9636 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
9637 return (uint64_t)ret_conv;
9640 typedef struct LDKCustomMessageHandler_JCalls {
9641 atomic_size_t refcnt;
9644 LDKCustomMessageReader_JCalls* CustomMessageReader;
9645 jmethodID handle_custom_message_meth;
9646 jmethodID get_and_clear_pending_msg_meth;
9647 } LDKCustomMessageHandler_JCalls;
9648 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9649 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9650 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9652 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9653 if (get_jenv_res == JNI_EDETACHED) {
9654 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9656 DO_ASSERT(get_jenv_res == JNI_OK);
9658 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9659 if (get_jenv_res == JNI_EDETACHED) {
9660 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9665 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9666 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9668 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9669 if (get_jenv_res == JNI_EDETACHED) {
9670 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9672 DO_ASSERT(get_jenv_res == JNI_OK);
9674 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
9676 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
9677 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
9678 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9680 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
9681 if ((*env)->ExceptionCheck(env)) {
9682 (*env)->ExceptionDescribe(env);
9683 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
9685 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9686 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9687 if (get_jenv_res == JNI_EDETACHED) {
9688 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9692 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9693 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9695 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9696 if (get_jenv_res == JNI_EDETACHED) {
9697 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9699 DO_ASSERT(get_jenv_res == JNI_OK);
9701 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9703 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
9704 if ((*env)->ExceptionCheck(env)) {
9705 (*env)->ExceptionDescribe(env);
9706 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
9708 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9709 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9710 if (ret_constr.datalen > 0)
9711 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9713 ret_constr.data = NULL;
9714 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9715 for (size_t z = 0; z < ret_constr.datalen; z++) {
9716 int64_t ret_conv_25 = ret_vals[z];
9717 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1);
9718 ret_conv_25_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_25) & ~1));
9719 ret_constr.data[z] = ret_conv_25_conv;
9721 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9722 if (get_jenv_res == JNI_EDETACHED) {
9723 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9727 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9728 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9729 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9730 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9732 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9733 jclass c = (*env)->GetObjectClass(env, o);
9735 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9736 atomic_init(&calls->refcnt, 1);
9737 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9738 calls->o = (*env)->NewWeakGlobalRef(env, o);
9739 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
9740 CHECK(calls->handle_custom_message_meth != NULL);
9741 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
9742 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
9744 LDKCustomMessageHandler ret = {
9745 .this_arg = (void*) calls,
9746 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9747 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9748 .free = LDKCustomMessageHandler_JCalls_free,
9749 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
9751 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9755 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9756 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
9757 return (uint64_t)res_ptr;
9759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
9760 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
9761 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
9762 DO_ASSERT((res_ptr & 1) == 0);
9763 return (int64_t)(res_ptr | 1);
9765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
9766 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9767 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
9768 if (msg_conv.free == LDKType_JCalls_free) {
9769 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9770 LDKType_JCalls_cloned(&msg_conv);
9772 LDKPublicKey sender_node_id_ref;
9773 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
9774 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
9775 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9776 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9777 return (uint64_t)ret_conv;
9780 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
9781 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9782 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9783 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9784 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9785 for (size_t z = 0; z < ret_var.datalen; z++) {
9786 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9787 *ret_conv_25_conv = ret_var.data[z];
9788 ret_arr_ptr[z] = ((uint64_t)ret_conv_25_conv);
9790 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9795 typedef struct LDKSocketDescriptor_JCalls {
9796 atomic_size_t refcnt;
9799 jmethodID send_data_meth;
9800 jmethodID disconnect_socket_meth;
9802 jmethodID hash_meth;
9803 } LDKSocketDescriptor_JCalls;
9804 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
9805 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9806 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9808 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9809 if (get_jenv_res == JNI_EDETACHED) {
9810 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9812 DO_ASSERT(get_jenv_res == JNI_OK);
9814 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9815 if (get_jenv_res == JNI_EDETACHED) {
9816 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9821 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
9822 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9824 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9825 if (get_jenv_res == JNI_EDETACHED) {
9826 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9828 DO_ASSERT(get_jenv_res == JNI_OK);
9830 LDKu8slice data_var = data;
9831 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
9832 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
9833 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9835 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
9836 if ((*env)->ExceptionCheck(env)) {
9837 (*env)->ExceptionDescribe(env);
9838 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
9840 if (get_jenv_res == JNI_EDETACHED) {
9841 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9845 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
9846 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9848 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9849 if (get_jenv_res == JNI_EDETACHED) {
9850 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9852 DO_ASSERT(get_jenv_res == JNI_OK);
9854 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9856 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
9857 if ((*env)->ExceptionCheck(env)) {
9858 (*env)->ExceptionDescribe(env);
9859 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
9861 if (get_jenv_res == JNI_EDETACHED) {
9862 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9865 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
9866 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9868 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9869 if (get_jenv_res == JNI_EDETACHED) {
9870 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9872 DO_ASSERT(get_jenv_res == JNI_OK);
9874 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9875 *other_arg_clone = SocketDescriptor_clone(other_arg);
9876 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9878 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
9879 if ((*env)->ExceptionCheck(env)) {
9880 (*env)->ExceptionDescribe(env);
9881 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
9883 if (get_jenv_res == JNI_EDETACHED) {
9884 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9888 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
9889 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9891 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9892 if (get_jenv_res == JNI_EDETACHED) {
9893 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9895 DO_ASSERT(get_jenv_res == JNI_OK);
9897 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9899 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
9900 if ((*env)->ExceptionCheck(env)) {
9901 (*env)->ExceptionDescribe(env);
9902 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
9904 if (get_jenv_res == JNI_EDETACHED) {
9905 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9909 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
9910 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
9911 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9913 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
9914 jclass c = (*env)->GetObjectClass(env, o);
9916 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
9917 atomic_init(&calls->refcnt, 1);
9918 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9919 calls->o = (*env)->NewWeakGlobalRef(env, o);
9920 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
9921 CHECK(calls->send_data_meth != NULL);
9922 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
9923 CHECK(calls->disconnect_socket_meth != NULL);
9924 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
9925 CHECK(calls->eq_meth != NULL);
9926 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
9927 CHECK(calls->hash_meth != NULL);
9929 LDKSocketDescriptor ret = {
9930 .this_arg = (void*) calls,
9931 .send_data = send_data_LDKSocketDescriptor_jcall,
9932 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
9933 .eq = eq_LDKSocketDescriptor_jcall,
9934 .hash = hash_LDKSocketDescriptor_jcall,
9935 .cloned = LDKSocketDescriptor_JCalls_cloned,
9936 .free = LDKSocketDescriptor_JCalls_free,
9940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
9941 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9942 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
9943 return (uint64_t)res_ptr;
9945 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) {
9946 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9947 LDKu8slice data_ref;
9948 data_ref.datalen = (*env)->GetArrayLength(env, data);
9949 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
9950 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
9951 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
9955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
9956 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9957 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
9960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
9961 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9962 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
9966 typedef struct LDKChannelManagerPersister_JCalls {
9967 atomic_size_t refcnt;
9970 jmethodID persist_manager_meth;
9971 } LDKChannelManagerPersister_JCalls;
9972 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
9973 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
9974 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9976 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9977 if (get_jenv_res == JNI_EDETACHED) {
9978 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9980 DO_ASSERT(get_jenv_res == JNI_OK);
9982 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9983 if (get_jenv_res == JNI_EDETACHED) {
9984 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9989 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9990 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
9992 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9993 if (get_jenv_res == JNI_EDETACHED) {
9994 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9996 DO_ASSERT(get_jenv_res == JNI_OK);
9998 LDKChannelManager channel_manager_var = *channel_manager;
9999 // Warning: we may need a move here but no clone is available for LDKChannelManager
10000 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10001 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10002 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
10003 if (channel_manager_var.is_owned) {
10004 channel_manager_ref |= 1;
10006 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10007 CHECK(obj != NULL);
10008 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
10009 if ((*env)->ExceptionCheck(env)) {
10010 (*env)->ExceptionDescribe(env);
10011 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
10013 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
10014 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
10015 if (get_jenv_res == JNI_EDETACHED) {
10016 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10020 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
10021 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
10022 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10024 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
10025 jclass c = (*env)->GetObjectClass(env, o);
10027 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
10028 atomic_init(&calls->refcnt, 1);
10029 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10030 calls->o = (*env)->NewWeakGlobalRef(env, o);
10031 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
10032 CHECK(calls->persist_manager_meth != NULL);
10034 LDKChannelManagerPersister ret = {
10035 .this_arg = (void*) calls,
10036 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
10037 .free = LDKChannelManagerPersister_JCalls_free,
10041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
10042 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
10043 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
10044 return (uint64_t)res_ptr;
10046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
10047 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
10048 LDKChannelManager channel_manager_conv;
10049 channel_manager_conv.inner = (void*)(channel_manager & (~1));
10050 channel_manager_conv.is_owned = false;
10051 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10052 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10053 return (uint64_t)ret_conv;
10056 static jclass LDKFallback_SegWitProgram_class = NULL;
10057 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
10058 static jclass LDKFallback_PubKeyHash_class = NULL;
10059 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
10060 static jclass LDKFallback_ScriptHash_class = NULL;
10061 static jmethodID LDKFallback_ScriptHash_meth = NULL;
10062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
10063 LDKFallback_SegWitProgram_class =
10064 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
10065 CHECK(LDKFallback_SegWitProgram_class != NULL);
10066 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
10067 CHECK(LDKFallback_SegWitProgram_meth != NULL);
10068 LDKFallback_PubKeyHash_class =
10069 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
10070 CHECK(LDKFallback_PubKeyHash_class != NULL);
10071 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
10072 CHECK(LDKFallback_PubKeyHash_meth != NULL);
10073 LDKFallback_ScriptHash_class =
10074 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
10075 CHECK(LDKFallback_ScriptHash_class != NULL);
10076 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
10077 CHECK(LDKFallback_ScriptHash_meth != NULL);
10079 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10080 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
10082 case LDKFallback_SegWitProgram: {
10083 uint8_t version_val = obj->seg_wit_program.version._0;
10084 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10085 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
10086 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
10087 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
10089 case LDKFallback_PubKeyHash: {
10090 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
10091 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
10092 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
10094 case LDKFallback_ScriptHash: {
10095 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
10096 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
10097 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
10102 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
10103 LDKStr ret_str = _ldk_get_compiled_version();
10104 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10109 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
10110 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
10111 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
10116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10117 LDKTransaction _res_ref;
10118 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10119 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
10120 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10121 _res_ref.data_is_owned = true;
10122 Transaction_free(_res_ref);
10125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
10126 LDKCVec_u8Z script_pubkey_ref;
10127 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
10128 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
10129 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
10130 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10131 *ret_ref = TxOut_new(script_pubkey_ref, value);
10132 return (uint64_t)ret_ref;
10135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
10136 if ((_res & 1) != 0) return;
10137 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
10139 TxOut_free(_res_conv);
10142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10143 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
10144 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
10145 *ret_ref = TxOut_clone(orig_conv);
10146 return (uint64_t)ret_ref;
10149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
10150 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
10154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10155 LDKSecretKey o_ref;
10156 CHECK((*env)->GetArrayLength(env, o) == 32);
10157 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
10158 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10159 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10160 return (uint64_t)ret_conv;
10163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10164 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10165 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10166 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10167 return (uint64_t)ret_conv;
10170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10171 if ((_res & 1) != 0) return;
10172 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
10174 CResult_SecretKeyErrorZ_free(_res_conv);
10177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10178 LDKPublicKey o_ref;
10179 CHECK((*env)->GetArrayLength(env, o) == 33);
10180 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
10181 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10182 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10183 return (uint64_t)ret_conv;
10186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10187 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10188 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10189 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10190 return (uint64_t)ret_conv;
10193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10194 if ((_res & 1) != 0) return;
10195 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
10197 CResult_PublicKeyErrorZ_free(_res_conv);
10200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10201 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
10202 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10203 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10204 return (uint64_t)ret_conv;
10207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10208 LDKTxCreationKeys o_conv;
10209 o_conv.inner = (void*)(o & (~1));
10210 o_conv.is_owned = (o & 1) || (o == 0);
10211 o_conv = TxCreationKeys_clone(&o_conv);
10212 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10213 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10214 return (uint64_t)ret_conv;
10217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10218 LDKDecodeError e_conv;
10219 e_conv.inner = (void*)(e & (~1));
10220 e_conv.is_owned = (e & 1) || (e == 0);
10221 e_conv = DecodeError_clone(&e_conv);
10222 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10223 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10224 return (uint64_t)ret_conv;
10227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10228 if ((_res & 1) != 0) return;
10229 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10231 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10235 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
10236 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10237 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10238 return (uint64_t)ret_conv;
10241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10242 LDKChannelPublicKeys o_conv;
10243 o_conv.inner = (void*)(o & (~1));
10244 o_conv.is_owned = (o & 1) || (o == 0);
10245 o_conv = ChannelPublicKeys_clone(&o_conv);
10246 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10247 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10248 return (uint64_t)ret_conv;
10251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10252 LDKDecodeError e_conv;
10253 e_conv.inner = (void*)(e & (~1));
10254 e_conv.is_owned = (e & 1) || (e == 0);
10255 e_conv = DecodeError_clone(&e_conv);
10256 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10257 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10258 return (uint64_t)ret_conv;
10261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10262 if ((_res & 1) != 0) return;
10263 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10265 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10269 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
10270 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10271 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10272 return (uint64_t)ret_conv;
10275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10276 LDKTxCreationKeys o_conv;
10277 o_conv.inner = (void*)(o & (~1));
10278 o_conv.is_owned = (o & 1) || (o == 0);
10279 o_conv = TxCreationKeys_clone(&o_conv);
10280 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10281 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10282 return (uint64_t)ret_conv;
10285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10286 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10287 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10288 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10289 return (uint64_t)ret_conv;
10292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10293 if ((_res & 1) != 0) return;
10294 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
10296 CResult_TxCreationKeysErrorZ_free(_res_conv);
10299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10300 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
10301 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10302 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10303 return (uint64_t)ret_conv;
10306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
10307 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10308 *ret_copy = COption_u32Z_some(o);
10309 uint64_t ret_ref = (uint64_t)ret_copy;
10313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
10314 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10315 *ret_copy = COption_u32Z_none();
10316 uint64_t ret_ref = (uint64_t)ret_copy;
10320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10321 if ((_res & 1) != 0) return;
10322 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
10324 COption_u32Z_free(_res_conv);
10327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10328 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
10329 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10330 *ret_copy = COption_u32Z_clone(orig_conv);
10331 uint64_t ret_ref = (uint64_t)ret_copy;
10335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10336 LDKHTLCOutputInCommitment o_conv;
10337 o_conv.inner = (void*)(o & (~1));
10338 o_conv.is_owned = (o & 1) || (o == 0);
10339 o_conv = HTLCOutputInCommitment_clone(&o_conv);
10340 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10341 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10342 return (uint64_t)ret_conv;
10345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10346 LDKDecodeError e_conv;
10347 e_conv.inner = (void*)(e & (~1));
10348 e_conv.is_owned = (e & 1) || (e == 0);
10349 e_conv = DecodeError_clone(&e_conv);
10350 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10351 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10352 return (uint64_t)ret_conv;
10355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10356 if ((_res & 1) != 0) return;
10357 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
10359 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10363 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
10364 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10365 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10366 return (uint64_t)ret_conv;
10369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10370 LDKCounterpartyChannelTransactionParameters o_conv;
10371 o_conv.inner = (void*)(o & (~1));
10372 o_conv.is_owned = (o & 1) || (o == 0);
10373 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10374 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10375 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10376 return (uint64_t)ret_conv;
10379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10380 LDKDecodeError e_conv;
10381 e_conv.inner = (void*)(e & (~1));
10382 e_conv.is_owned = (e & 1) || (e == 0);
10383 e_conv = DecodeError_clone(&e_conv);
10384 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10385 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10386 return (uint64_t)ret_conv;
10389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10390 if ((_res & 1) != 0) return;
10391 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10393 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10397 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10398 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10399 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10400 return (uint64_t)ret_conv;
10403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10404 LDKChannelTransactionParameters o_conv;
10405 o_conv.inner = (void*)(o & (~1));
10406 o_conv.is_owned = (o & 1) || (o == 0);
10407 o_conv = ChannelTransactionParameters_clone(&o_conv);
10408 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10409 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10410 return (uint64_t)ret_conv;
10413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10414 LDKDecodeError e_conv;
10415 e_conv.inner = (void*)(e & (~1));
10416 e_conv.is_owned = (e & 1) || (e == 0);
10417 e_conv = DecodeError_clone(&e_conv);
10418 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10419 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10420 return (uint64_t)ret_conv;
10423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10424 if ((_res & 1) != 0) return;
10425 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10427 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10431 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10432 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10433 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10434 return (uint64_t)ret_conv;
10437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10438 LDKCVec_SignatureZ _res_constr;
10439 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10440 if (_res_constr.datalen > 0)
10441 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10443 _res_constr.data = NULL;
10444 for (size_t i = 0; i < _res_constr.datalen; i++) {
10445 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10446 LDKSignature _res_conv_8_ref;
10447 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
10448 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
10449 _res_constr.data[i] = _res_conv_8_ref;
10451 CVec_SignatureZ_free(_res_constr);
10454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10455 LDKHolderCommitmentTransaction o_conv;
10456 o_conv.inner = (void*)(o & (~1));
10457 o_conv.is_owned = (o & 1) || (o == 0);
10458 o_conv = HolderCommitmentTransaction_clone(&o_conv);
10459 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10460 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
10461 return (uint64_t)ret_conv;
10464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10465 LDKDecodeError e_conv;
10466 e_conv.inner = (void*)(e & (~1));
10467 e_conv.is_owned = (e & 1) || (e == 0);
10468 e_conv = DecodeError_clone(&e_conv);
10469 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10470 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
10471 return (uint64_t)ret_conv;
10474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10475 if ((_res & 1) != 0) return;
10476 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10478 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
10481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10482 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10483 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10484 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10485 return (uint64_t)ret_conv;
10488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10489 LDKBuiltCommitmentTransaction o_conv;
10490 o_conv.inner = (void*)(o & (~1));
10491 o_conv.is_owned = (o & 1) || (o == 0);
10492 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
10493 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10494 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
10495 return (uint64_t)ret_conv;
10498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10499 LDKDecodeError e_conv;
10500 e_conv.inner = (void*)(e & (~1));
10501 e_conv.is_owned = (e & 1) || (e == 0);
10502 e_conv = DecodeError_clone(&e_conv);
10503 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10504 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
10505 return (uint64_t)ret_conv;
10508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10509 if ((_res & 1) != 0) return;
10510 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10512 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
10515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10516 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10517 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10518 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10519 return (uint64_t)ret_conv;
10522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10523 LDKTrustedClosingTransaction o_conv;
10524 o_conv.inner = (void*)(o & (~1));
10525 o_conv.is_owned = (o & 1) || (o == 0);
10526 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
10527 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10528 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
10529 return (uint64_t)ret_conv;
10532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10533 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10534 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
10535 return (uint64_t)ret_conv;
10538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10539 if ((_res & 1) != 0) return;
10540 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
10542 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
10545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10546 LDKCommitmentTransaction o_conv;
10547 o_conv.inner = (void*)(o & (~1));
10548 o_conv.is_owned = (o & 1) || (o == 0);
10549 o_conv = CommitmentTransaction_clone(&o_conv);
10550 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10551 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
10552 return (uint64_t)ret_conv;
10555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10556 LDKDecodeError e_conv;
10557 e_conv.inner = (void*)(e & (~1));
10558 e_conv.is_owned = (e & 1) || (e == 0);
10559 e_conv = DecodeError_clone(&e_conv);
10560 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10561 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
10562 return (uint64_t)ret_conv;
10565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10566 if ((_res & 1) != 0) return;
10567 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10569 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
10572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10573 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
10574 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10575 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
10576 return (uint64_t)ret_conv;
10579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10580 LDKTrustedCommitmentTransaction o_conv;
10581 o_conv.inner = (void*)(o & (~1));
10582 o_conv.is_owned = (o & 1) || (o == 0);
10583 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
10584 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10585 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
10586 return (uint64_t)ret_conv;
10589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10590 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10591 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
10592 return (uint64_t)ret_conv;
10595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10596 if ((_res & 1) != 0) return;
10597 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
10599 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
10602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10603 LDKCVec_SignatureZ o_constr;
10604 o_constr.datalen = (*env)->GetArrayLength(env, o);
10605 if (o_constr.datalen > 0)
10606 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10608 o_constr.data = NULL;
10609 for (size_t i = 0; i < o_constr.datalen; i++) {
10610 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10611 LDKSignature o_conv_8_ref;
10612 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
10613 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
10614 o_constr.data[i] = o_conv_8_ref;
10616 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10617 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
10618 return (uint64_t)ret_conv;
10621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
10622 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10623 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
10624 return (uint64_t)ret_conv;
10627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10628 if ((_res & 1) != 0) return;
10629 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
10631 CResult_CVec_SignatureZNoneZ_free(_res_conv);
10634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10635 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
10636 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10637 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
10638 return (uint64_t)ret_conv;
10641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10642 LDKShutdownScript o_conv;
10643 o_conv.inner = (void*)(o & (~1));
10644 o_conv.is_owned = (o & 1) || (o == 0);
10645 o_conv = ShutdownScript_clone(&o_conv);
10646 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10647 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
10648 return (uint64_t)ret_conv;
10651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10652 LDKDecodeError e_conv;
10653 e_conv.inner = (void*)(e & (~1));
10654 e_conv.is_owned = (e & 1) || (e == 0);
10655 e_conv = DecodeError_clone(&e_conv);
10656 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10657 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
10658 return (uint64_t)ret_conv;
10661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10662 if ((_res & 1) != 0) return;
10663 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
10665 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
10668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10669 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
10670 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10671 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
10672 return (uint64_t)ret_conv;
10675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10676 LDKShutdownScript o_conv;
10677 o_conv.inner = (void*)(o & (~1));
10678 o_conv.is_owned = (o & 1) || (o == 0);
10679 o_conv = ShutdownScript_clone(&o_conv);
10680 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10681 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
10682 return (uint64_t)ret_conv;
10685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10686 LDKInvalidShutdownScript e_conv;
10687 e_conv.inner = (void*)(e & (~1));
10688 e_conv.is_owned = (e & 1) || (e == 0);
10689 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
10690 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10691 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
10692 return (uint64_t)ret_conv;
10695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10696 if ((_res & 1) != 0) return;
10697 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
10699 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
10702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
10703 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10704 *ret_conv = CResult_NoneErrorZ_ok();
10705 return (uint64_t)ret_conv;
10708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10709 LDKIOError e_conv = LDKIOError_from_java(env, e);
10710 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10711 *ret_conv = CResult_NoneErrorZ_err(e_conv);
10712 return (uint64_t)ret_conv;
10715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10716 if ((_res & 1) != 0) return;
10717 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
10719 CResult_NoneErrorZ_free(_res_conv);
10722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10723 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
10724 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10725 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
10726 return (uint64_t)ret_conv;
10729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10730 LDKRouteHop o_conv;
10731 o_conv.inner = (void*)(o & (~1));
10732 o_conv.is_owned = (o & 1) || (o == 0);
10733 o_conv = RouteHop_clone(&o_conv);
10734 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10735 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
10736 return (uint64_t)ret_conv;
10739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10740 LDKDecodeError e_conv;
10741 e_conv.inner = (void*)(e & (~1));
10742 e_conv.is_owned = (e & 1) || (e == 0);
10743 e_conv = DecodeError_clone(&e_conv);
10744 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10745 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
10746 return (uint64_t)ret_conv;
10749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10750 if ((_res & 1) != 0) return;
10751 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
10753 CResult_RouteHopDecodeErrorZ_free(_res_conv);
10756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10757 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
10758 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10759 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
10760 return (uint64_t)ret_conv;
10763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10764 LDKCVec_RouteHopZ _res_constr;
10765 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10766 if (_res_constr.datalen > 0)
10767 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10769 _res_constr.data = NULL;
10770 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10771 for (size_t k = 0; k < _res_constr.datalen; k++) {
10772 int64_t _res_conv_10 = _res_vals[k];
10773 LDKRouteHop _res_conv_10_conv;
10774 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
10775 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
10776 _res_constr.data[k] = _res_conv_10_conv;
10778 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10779 CVec_RouteHopZ_free(_res_constr);
10782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10783 LDKCVec_CVec_RouteHopZZ _res_constr;
10784 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10785 if (_res_constr.datalen > 0)
10786 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
10788 _res_constr.data = NULL;
10789 for (size_t m = 0; m < _res_constr.datalen; m++) {
10790 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
10791 LDKCVec_RouteHopZ _res_conv_12_constr;
10792 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
10793 if (_res_conv_12_constr.datalen > 0)
10794 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10796 _res_conv_12_constr.data = NULL;
10797 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
10798 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
10799 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
10800 LDKRouteHop _res_conv_12_conv_10_conv;
10801 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
10802 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
10803 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
10805 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
10806 _res_constr.data[m] = _res_conv_12_constr;
10808 CVec_CVec_RouteHopZZ_free(_res_constr);
10811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10813 o_conv.inner = (void*)(o & (~1));
10814 o_conv.is_owned = (o & 1) || (o == 0);
10815 o_conv = Route_clone(&o_conv);
10816 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10817 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
10818 return (uint64_t)ret_conv;
10821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10822 LDKDecodeError e_conv;
10823 e_conv.inner = (void*)(e & (~1));
10824 e_conv.is_owned = (e & 1) || (e == 0);
10825 e_conv = DecodeError_clone(&e_conv);
10826 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10827 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
10828 return (uint64_t)ret_conv;
10831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10832 if ((_res & 1) != 0) return;
10833 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
10835 CResult_RouteDecodeErrorZ_free(_res_conv);
10838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10839 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
10840 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10841 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
10842 return (uint64_t)ret_conv;
10845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
10846 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10847 *ret_copy = COption_u64Z_some(o);
10848 uint64_t ret_ref = (uint64_t)ret_copy;
10852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
10853 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10854 *ret_copy = COption_u64Z_none();
10855 uint64_t ret_ref = (uint64_t)ret_copy;
10859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10860 if ((_res & 1) != 0) return;
10861 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
10863 COption_u64Z_free(_res_conv);
10866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10867 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
10868 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10869 *ret_copy = COption_u64Z_clone(orig_conv);
10870 uint64_t ret_ref = (uint64_t)ret_copy;
10874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10875 LDKCVec_ChannelDetailsZ _res_constr;
10876 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10877 if (_res_constr.datalen > 0)
10878 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10880 _res_constr.data = NULL;
10881 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10882 for (size_t q = 0; q < _res_constr.datalen; q++) {
10883 int64_t _res_conv_16 = _res_vals[q];
10884 LDKChannelDetails _res_conv_16_conv;
10885 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10886 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10887 _res_constr.data[q] = _res_conv_16_conv;
10889 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10890 CVec_ChannelDetailsZ_free(_res_constr);
10893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10894 LDKCVec_RouteHintZ _res_constr;
10895 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10896 if (_res_constr.datalen > 0)
10897 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
10899 _res_constr.data = NULL;
10900 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10901 for (size_t l = 0; l < _res_constr.datalen; l++) {
10902 int64_t _res_conv_11 = _res_vals[l];
10903 LDKRouteHint _res_conv_11_conv;
10904 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
10905 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
10906 _res_constr.data[l] = _res_conv_11_conv;
10908 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10909 CVec_RouteHintZ_free(_res_constr);
10912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10914 o_conv.inner = (void*)(o & (~1));
10915 o_conv.is_owned = (o & 1) || (o == 0);
10916 o_conv = Route_clone(&o_conv);
10917 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10918 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
10919 return (uint64_t)ret_conv;
10922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10923 LDKLightningError e_conv;
10924 e_conv.inner = (void*)(e & (~1));
10925 e_conv.is_owned = (e & 1) || (e == 0);
10926 e_conv = LightningError_clone(&e_conv);
10927 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10928 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
10929 return (uint64_t)ret_conv;
10932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10933 if ((_res & 1) != 0) return;
10934 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
10936 CResult_RouteLightningErrorZ_free(_res_conv);
10939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10940 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
10941 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10942 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
10943 return (uint64_t)ret_conv;
10946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10947 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
10948 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
10949 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10950 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
10951 return (uint64_t)ret_conv;
10954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10955 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
10956 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10957 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
10958 return (uint64_t)ret_conv;
10961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10962 if ((_res & 1) != 0) return;
10963 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
10965 CResult_TxOutAccessErrorZ_free(_res_conv);
10968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10969 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
10970 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10971 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
10972 return (uint64_t)ret_conv;
10975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10976 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
10977 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10978 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
10979 return ((uint64_t)ret_conv);
10982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
10983 LDKTransaction b_ref;
10984 b_ref.datalen = (*env)->GetArrayLength(env, b);
10985 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
10986 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10987 b_ref.data_is_owned = true;
10988 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10989 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
10990 return ((uint64_t)ret_conv);
10993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10994 if ((_res & 1) != 0) return;
10995 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
10997 C2Tuple_usizeTransactionZ_free(_res_conv);
11000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11001 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
11002 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11003 if (_res_constr.datalen > 0)
11004 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11006 _res_constr.data = NULL;
11007 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11008 for (size_t c = 0; c < _res_constr.datalen; c++) {
11009 int64_t _res_conv_28 = _res_vals[c];
11010 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_28) & ~1);
11011 FREE((void*)_res_conv_28);
11012 _res_constr.data[c] = _res_conv_28_conv;
11014 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11015 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
11018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11019 LDKCVec_TxidZ _res_constr;
11020 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11021 if (_res_constr.datalen > 0)
11022 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
11024 _res_constr.data = NULL;
11025 for (size_t i = 0; i < _res_constr.datalen; i++) {
11026 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11027 LDKThirtyTwoBytes _res_conv_8_ref;
11028 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
11029 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
11030 _res_constr.data[i] = _res_conv_8_ref;
11032 CVec_TxidZ_free(_res_constr);
11035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
11036 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11037 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
11038 return (uint64_t)ret_conv;
11041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
11042 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
11043 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11044 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
11045 return (uint64_t)ret_conv;
11048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11049 if ((_res & 1) != 0) return;
11050 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
11052 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
11055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11056 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
11057 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
11058 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
11059 return (uint64_t)ret_conv;
11062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11063 LDKCVec_MonitorEventZ _res_constr;
11064 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11065 if (_res_constr.datalen > 0)
11066 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
11068 _res_constr.data = NULL;
11069 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11070 for (size_t o = 0; o < _res_constr.datalen; o++) {
11071 int64_t _res_conv_14 = _res_vals[o];
11072 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
11073 FREE((void*)_res_conv_14);
11074 _res_constr.data[o] = _res_conv_14_conv;
11076 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11077 CVec_MonitorEventZ_free(_res_constr);
11080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11081 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
11082 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
11083 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11084 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
11085 uint64_t ret_ref = (uint64_t)ret_copy;
11089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
11090 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11091 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
11092 uint64_t ret_ref = (uint64_t)ret_copy;
11096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11097 if ((_res & 1) != 0) return;
11098 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
11100 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
11103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11104 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
11105 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
11106 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
11107 uint64_t ret_ref = (uint64_t)ret_copy;
11111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11112 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
11113 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
11114 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11115 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
11116 uint64_t ret_ref = (uint64_t)ret_copy;
11120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
11121 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11122 *ret_copy = COption_NetworkUpdateZ_none();
11123 uint64_t ret_ref = (uint64_t)ret_copy;
11127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11128 if ((_res & 1) != 0) return;
11129 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
11131 COption_NetworkUpdateZ_free(_res_conv);
11134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11135 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
11136 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
11137 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
11138 uint64_t ret_ref = (uint64_t)ret_copy;
11142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11143 LDKCVec_SpendableOutputDescriptorZ _res_constr;
11144 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11145 if (_res_constr.datalen > 0)
11146 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
11148 _res_constr.data = NULL;
11149 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11150 for (size_t b = 0; b < _res_constr.datalen; b++) {
11151 int64_t _res_conv_27 = _res_vals[b];
11152 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
11153 FREE((void*)_res_conv_27);
11154 _res_constr.data[b] = _res_conv_27_conv;
11156 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11157 CVec_SpendableOutputDescriptorZ_free(_res_constr);
11160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11161 LDKCVec_MessageSendEventZ _res_constr;
11162 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11163 if (_res_constr.datalen > 0)
11164 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11166 _res_constr.data = NULL;
11167 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11168 for (size_t s = 0; s < _res_constr.datalen; s++) {
11169 int64_t _res_conv_18 = _res_vals[s];
11170 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
11171 FREE((void*)_res_conv_18);
11172 _res_constr.data[s] = _res_conv_18_conv;
11174 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11175 CVec_MessageSendEventZ_free(_res_constr);
11178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11179 LDKInitFeatures o_conv;
11180 o_conv.inner = (void*)(o & (~1));
11181 o_conv.is_owned = (o & 1) || (o == 0);
11182 o_conv = InitFeatures_clone(&o_conv);
11183 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11184 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
11185 return (uint64_t)ret_conv;
11188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11189 LDKDecodeError e_conv;
11190 e_conv.inner = (void*)(e & (~1));
11191 e_conv.is_owned = (e & 1) || (e == 0);
11192 e_conv = DecodeError_clone(&e_conv);
11193 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11194 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
11195 return (uint64_t)ret_conv;
11198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11199 if ((_res & 1) != 0) return;
11200 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11202 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
11205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11206 LDKNodeFeatures o_conv;
11207 o_conv.inner = (void*)(o & (~1));
11208 o_conv.is_owned = (o & 1) || (o == 0);
11209 o_conv = NodeFeatures_clone(&o_conv);
11210 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11211 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
11212 return (uint64_t)ret_conv;
11215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11216 LDKDecodeError e_conv;
11217 e_conv.inner = (void*)(e & (~1));
11218 e_conv.is_owned = (e & 1) || (e == 0);
11219 e_conv = DecodeError_clone(&e_conv);
11220 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11221 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
11222 return (uint64_t)ret_conv;
11225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11226 if ((_res & 1) != 0) return;
11227 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11229 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
11232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11233 LDKChannelFeatures o_conv;
11234 o_conv.inner = (void*)(o & (~1));
11235 o_conv.is_owned = (o & 1) || (o == 0);
11236 o_conv = ChannelFeatures_clone(&o_conv);
11237 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11238 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
11239 return (uint64_t)ret_conv;
11242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11243 LDKDecodeError e_conv;
11244 e_conv.inner = (void*)(e & (~1));
11245 e_conv.is_owned = (e & 1) || (e == 0);
11246 e_conv = DecodeError_clone(&e_conv);
11247 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11248 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
11249 return (uint64_t)ret_conv;
11252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11253 if ((_res & 1) != 0) return;
11254 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11256 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
11259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11260 LDKInvoiceFeatures o_conv;
11261 o_conv.inner = (void*)(o & (~1));
11262 o_conv.is_owned = (o & 1) || (o == 0);
11263 o_conv = InvoiceFeatures_clone(&o_conv);
11264 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11265 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
11266 return (uint64_t)ret_conv;
11269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11270 LDKDecodeError e_conv;
11271 e_conv.inner = (void*)(e & (~1));
11272 e_conv.is_owned = (e & 1) || (e == 0);
11273 e_conv = DecodeError_clone(&e_conv);
11274 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11275 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
11276 return (uint64_t)ret_conv;
11279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11280 if ((_res & 1) != 0) return;
11281 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11283 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
11286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11287 LDKDelayedPaymentOutputDescriptor o_conv;
11288 o_conv.inner = (void*)(o & (~1));
11289 o_conv.is_owned = (o & 1) || (o == 0);
11290 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
11291 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11292 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11293 return (uint64_t)ret_conv;
11296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11297 LDKDecodeError e_conv;
11298 e_conv.inner = (void*)(e & (~1));
11299 e_conv.is_owned = (e & 1) || (e == 0);
11300 e_conv = DecodeError_clone(&e_conv);
11301 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11302 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11303 return (uint64_t)ret_conv;
11306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11307 if ((_res & 1) != 0) return;
11308 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11310 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11314 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11315 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11316 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11317 return (uint64_t)ret_conv;
11320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11321 LDKStaticPaymentOutputDescriptor o_conv;
11322 o_conv.inner = (void*)(o & (~1));
11323 o_conv.is_owned = (o & 1) || (o == 0);
11324 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
11325 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11326 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11327 return (uint64_t)ret_conv;
11330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11331 LDKDecodeError e_conv;
11332 e_conv.inner = (void*)(e & (~1));
11333 e_conv.is_owned = (e & 1) || (e == 0);
11334 e_conv = DecodeError_clone(&e_conv);
11335 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11336 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11337 return (uint64_t)ret_conv;
11340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11341 if ((_res & 1) != 0) return;
11342 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11344 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11348 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11349 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11350 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11351 return (uint64_t)ret_conv;
11354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11355 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
11356 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
11357 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11358 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
11359 return (uint64_t)ret_conv;
11362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11363 LDKDecodeError e_conv;
11364 e_conv.inner = (void*)(e & (~1));
11365 e_conv.is_owned = (e & 1) || (e == 0);
11366 e_conv = DecodeError_clone(&e_conv);
11367 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11368 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
11369 return (uint64_t)ret_conv;
11372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11373 if ((_res & 1) != 0) return;
11374 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11376 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
11379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11380 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
11381 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11382 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
11383 return (uint64_t)ret_conv;
11386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
11387 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11388 *ret_conv = CResult_NoneNoneZ_ok();
11389 return (uint64_t)ret_conv;
11392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
11393 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11394 *ret_conv = CResult_NoneNoneZ_err();
11395 return (uint64_t)ret_conv;
11398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11399 if ((_res & 1) != 0) return;
11400 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
11402 CResult_NoneNoneZ_free(_res_conv);
11405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11406 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11407 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11408 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11409 return (uint64_t)ret_conv;
11412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11413 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
11414 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11415 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
11416 return ((uint64_t)ret_conv);
11419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
11420 LDKSignature a_ref;
11421 CHECK((*env)->GetArrayLength(env, a) == 64);
11422 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
11423 LDKCVec_SignatureZ b_constr;
11424 b_constr.datalen = (*env)->GetArrayLength(env, b);
11425 if (b_constr.datalen > 0)
11426 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11428 b_constr.data = NULL;
11429 for (size_t i = 0; i < b_constr.datalen; i++) {
11430 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
11431 LDKSignature b_conv_8_ref;
11432 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
11433 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
11434 b_constr.data[i] = b_conv_8_ref;
11436 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11437 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
11438 return ((uint64_t)ret_conv);
11441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11442 if ((_res & 1) != 0) return;
11443 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
11445 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
11448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11449 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
11450 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
11451 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11452 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
11453 return (uint64_t)ret_conv;
11456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
11457 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11458 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
11459 return (uint64_t)ret_conv;
11462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11463 if ((_res & 1) != 0) return;
11464 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
11466 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
11469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11470 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
11471 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11472 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
11473 return (uint64_t)ret_conv;
11476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11477 LDKSignature o_ref;
11478 CHECK((*env)->GetArrayLength(env, o) == 64);
11479 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
11480 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11481 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
11482 return (uint64_t)ret_conv;
11485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11486 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11487 *ret_conv = CResult_SignatureNoneZ_err();
11488 return (uint64_t)ret_conv;
11491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11492 if ((_res & 1) != 0) return;
11493 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
11495 CResult_SignatureNoneZ_free(_res_conv);
11498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11499 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
11500 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11501 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
11502 return (uint64_t)ret_conv;
11505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11506 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
11507 if (o_conv.free == LDKSign_JCalls_free) {
11508 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11509 LDKSign_JCalls_cloned(&o_conv);
11511 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11512 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
11513 return (uint64_t)ret_conv;
11516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11517 LDKDecodeError e_conv;
11518 e_conv.inner = (void*)(e & (~1));
11519 e_conv.is_owned = (e & 1) || (e == 0);
11520 e_conv = DecodeError_clone(&e_conv);
11521 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11522 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
11523 return (uint64_t)ret_conv;
11526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11527 if ((_res & 1) != 0) return;
11528 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
11530 CResult_SignDecodeErrorZ_free(_res_conv);
11533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11534 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
11535 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11536 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
11537 return (uint64_t)ret_conv;
11540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
11541 LDKCVec_u8Z _res_ref;
11542 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
11543 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11544 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
11545 CVec_u8Z_free(_res_ref);
11548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
11549 LDKRecoverableSignature arg_ref;
11550 CHECK((*env)->GetArrayLength(env, arg) == 68);
11551 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
11552 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11553 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
11554 return (uint64_t)ret_conv;
11557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11558 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11559 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
11560 return (uint64_t)ret_conv;
11563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11564 if ((_res & 1) != 0) return;
11565 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
11567 CResult_RecoverableSignatureNoneZ_free(_res_conv);
11570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11571 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
11572 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11573 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
11574 return (uint64_t)ret_conv;
11577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11578 LDKCVec_CVec_u8ZZ _res_constr;
11579 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11580 if (_res_constr.datalen > 0)
11581 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11583 _res_constr.data = NULL;
11584 for (size_t i = 0; i < _res_constr.datalen; i++) {
11585 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11586 LDKCVec_u8Z _res_conv_8_ref;
11587 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11588 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11589 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11590 _res_constr.data[i] = _res_conv_8_ref;
11592 CVec_CVec_u8ZZ_free(_res_constr);
11595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
11596 LDKCVec_CVec_u8ZZ o_constr;
11597 o_constr.datalen = (*env)->GetArrayLength(env, o);
11598 if (o_constr.datalen > 0)
11599 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11601 o_constr.data = NULL;
11602 for (size_t i = 0; i < o_constr.datalen; i++) {
11603 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
11604 LDKCVec_u8Z o_conv_8_ref;
11605 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
11606 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11607 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
11608 o_constr.data[i] = o_conv_8_ref;
11610 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11611 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
11612 return (uint64_t)ret_conv;
11615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
11616 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11617 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
11618 return (uint64_t)ret_conv;
11621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11622 if ((_res & 1) != 0) return;
11623 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
11625 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
11628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11629 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
11630 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11631 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
11632 return (uint64_t)ret_conv;
11635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11636 LDKInMemorySigner o_conv;
11637 o_conv.inner = (void*)(o & (~1));
11638 o_conv.is_owned = (o & 1) || (o == 0);
11639 o_conv = InMemorySigner_clone(&o_conv);
11640 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11641 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
11642 return (uint64_t)ret_conv;
11645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11646 LDKDecodeError e_conv;
11647 e_conv.inner = (void*)(e & (~1));
11648 e_conv.is_owned = (e & 1) || (e == 0);
11649 e_conv = DecodeError_clone(&e_conv);
11650 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11651 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
11652 return (uint64_t)ret_conv;
11655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11656 if ((_res & 1) != 0) return;
11657 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
11659 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
11662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11663 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
11664 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11665 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
11666 return (uint64_t)ret_conv;
11669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11670 LDKCVec_TxOutZ _res_constr;
11671 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11672 if (_res_constr.datalen > 0)
11673 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11675 _res_constr.data = NULL;
11676 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11677 for (size_t h = 0; h < _res_constr.datalen; h++) {
11678 int64_t _res_conv_7 = _res_vals[h];
11679 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
11680 FREE((void*)_res_conv_7);
11681 _res_constr.data[h] = _res_conv_7_conv;
11683 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11684 CVec_TxOutZ_free(_res_constr);
11687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11688 LDKTransaction o_ref;
11689 o_ref.datalen = (*env)->GetArrayLength(env, o);
11690 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
11691 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11692 o_ref.data_is_owned = true;
11693 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11694 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
11695 return (uint64_t)ret_conv;
11698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
11699 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11700 *ret_conv = CResult_TransactionNoneZ_err();
11701 return (uint64_t)ret_conv;
11704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11705 if ((_res & 1) != 0) return;
11706 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
11708 CResult_TransactionNoneZ_free(_res_conv);
11711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11712 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
11713 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11714 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
11715 return (uint64_t)ret_conv;
11718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11719 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
11720 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
11721 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
11722 return ((uint64_t)ret_conv);
11725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
11726 LDKThirtyTwoBytes a_ref;
11727 CHECK((*env)->GetArrayLength(env, a) == 32);
11728 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11729 LDKChannelMonitor b_conv;
11730 b_conv.inner = (void*)(b & (~1));
11731 b_conv.is_owned = (b & 1) || (b == 0);
11732 b_conv = ChannelMonitor_clone(&b_conv);
11733 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
11734 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
11735 return ((uint64_t)ret_conv);
11738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11739 if ((_res & 1) != 0) return;
11740 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
11742 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
11745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11746 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
11747 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11748 if (_res_constr.datalen > 0)
11749 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11751 _res_constr.data = NULL;
11752 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11753 for (size_t j = 0; j < _res_constr.datalen; j++) {
11754 int64_t _res_conv_35 = _res_vals[j];
11755 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_35) & ~1);
11756 FREE((void*)_res_conv_35);
11757 _res_constr.data[j] = _res_conv_35_conv;
11759 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11760 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
11763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
11764 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
11765 o_constr.datalen = (*env)->GetArrayLength(env, o);
11766 if (o_constr.datalen > 0)
11767 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11769 o_constr.data = NULL;
11770 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
11771 for (size_t j = 0; j < o_constr.datalen; j++) {
11772 int64_t o_conv_35 = o_vals[j];
11773 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1);
11774 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_35) & ~1));
11775 o_constr.data[j] = o_conv_35_conv;
11777 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
11778 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11779 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
11780 return (uint64_t)ret_conv;
11783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11784 LDKIOError e_conv = LDKIOError_from_java(env, e);
11785 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11786 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
11787 return (uint64_t)ret_conv;
11790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11791 if ((_res & 1) != 0) return;
11792 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
11794 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
11797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11798 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
11799 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11800 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
11801 return (uint64_t)ret_conv;
11804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
11805 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11806 *ret_copy = COption_u16Z_some(o);
11807 uint64_t ret_ref = (uint64_t)ret_copy;
11811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
11812 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11813 *ret_copy = COption_u16Z_none();
11814 uint64_t ret_ref = (uint64_t)ret_copy;
11818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11819 if ((_res & 1) != 0) return;
11820 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
11822 COption_u16Z_free(_res_conv);
11825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11826 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
11827 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11828 *ret_copy = COption_u16Z_clone(orig_conv);
11829 uint64_t ret_ref = (uint64_t)ret_copy;
11833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
11834 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11835 *ret_conv = CResult_NoneAPIErrorZ_ok();
11836 return (uint64_t)ret_conv;
11839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11840 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
11841 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11842 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11843 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
11844 return (uint64_t)ret_conv;
11847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11848 if ((_res & 1) != 0) return;
11849 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
11851 CResult_NoneAPIErrorZ_free(_res_conv);
11854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11855 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
11856 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11857 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
11858 return (uint64_t)ret_conv;
11861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11862 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11863 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11864 if (_res_constr.datalen > 0)
11865 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11867 _res_constr.data = NULL;
11868 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11869 for (size_t w = 0; w < _res_constr.datalen; w++) {
11870 int64_t _res_conv_22 = _res_vals[w];
11871 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
11872 FREE((void*)_res_conv_22);
11873 _res_constr.data[w] = _res_conv_22_conv;
11875 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11876 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11880 LDKCVec_APIErrorZ _res_constr;
11881 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11882 if (_res_constr.datalen > 0)
11883 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11885 _res_constr.data = NULL;
11886 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11887 for (size_t k = 0; k < _res_constr.datalen; k++) {
11888 int64_t _res_conv_10 = _res_vals[k];
11889 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
11890 FREE((void*)_res_conv_10);
11891 _res_constr.data[k] = _res_conv_10_conv;
11893 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11894 CVec_APIErrorZ_free(_res_constr);
11897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
11898 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11899 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
11900 return (uint64_t)ret_conv;
11903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11904 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
11905 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11906 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11907 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
11908 return (uint64_t)ret_conv;
11911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11912 if ((_res & 1) != 0) return;
11913 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
11915 CResult_NonePaymentSendFailureZ_free(_res_conv);
11918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11919 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
11920 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11921 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
11922 return (uint64_t)ret_conv;
11925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11926 LDKThirtyTwoBytes o_ref;
11927 CHECK((*env)->GetArrayLength(env, o) == 32);
11928 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
11929 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11930 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
11931 return (uint64_t)ret_conv;
11934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11935 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
11936 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11937 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11938 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
11939 return (uint64_t)ret_conv;
11942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11943 if ((_res & 1) != 0) return;
11944 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
11946 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
11949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11950 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
11951 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11952 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
11953 return (uint64_t)ret_conv;
11956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11957 LDKCVec_NetAddressZ _res_constr;
11958 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11959 if (_res_constr.datalen > 0)
11960 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11962 _res_constr.data = NULL;
11963 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11964 for (size_t m = 0; m < _res_constr.datalen; m++) {
11965 int64_t _res_conv_12 = _res_vals[m];
11966 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
11967 FREE((void*)_res_conv_12);
11968 _res_constr.data[m] = _res_conv_12_conv;
11970 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11971 CVec_NetAddressZ_free(_res_constr);
11974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11975 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
11976 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11977 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
11978 return ((uint64_t)ret_conv);
11981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
11982 LDKThirtyTwoBytes a_ref;
11983 CHECK((*env)->GetArrayLength(env, a) == 32);
11984 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11985 LDKThirtyTwoBytes b_ref;
11986 CHECK((*env)->GetArrayLength(env, b) == 32);
11987 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
11988 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11989 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
11990 return ((uint64_t)ret_conv);
11993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11994 if ((_res & 1) != 0) return;
11995 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
11997 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
12000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
12001 LDKThirtyTwoBytes o_ref;
12002 CHECK((*env)->GetArrayLength(env, o) == 32);
12003 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
12004 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12005 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
12006 return (uint64_t)ret_conv;
12009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12010 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
12011 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
12012 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12013 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
12014 return (uint64_t)ret_conv;
12017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12018 if ((_res & 1) != 0) return;
12019 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
12021 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
12024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12025 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
12026 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
12027 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
12028 return (uint64_t)ret_conv;
12031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12032 LDKCVec_ChannelMonitorZ _res_constr;
12033 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12034 if (_res_constr.datalen > 0)
12035 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
12037 _res_constr.data = NULL;
12038 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12039 for (size_t q = 0; q < _res_constr.datalen; q++) {
12040 int64_t _res_conv_16 = _res_vals[q];
12041 LDKChannelMonitor _res_conv_16_conv;
12042 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12043 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12044 _res_constr.data[q] = _res_conv_16_conv;
12046 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12047 CVec_ChannelMonitorZ_free(_res_constr);
12050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12051 LDKThirtyTwoBytes a_ref;
12052 CHECK((*env)->GetArrayLength(env, a) == 32);
12053 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12054 LDKChannelManager b_conv;
12055 b_conv.inner = (void*)(b & (~1));
12056 b_conv.is_owned = (b & 1) || (b == 0);
12057 // Warning: we need a move here but no clone is available for LDKChannelManager
12058 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
12059 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
12060 return ((uint64_t)ret_conv);
12063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12064 if ((_res & 1) != 0) return;
12065 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
12067 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
12070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12071 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
12072 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
12073 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12074 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
12075 return (uint64_t)ret_conv;
12078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12079 LDKDecodeError e_conv;
12080 e_conv.inner = (void*)(e & (~1));
12081 e_conv.is_owned = (e & 1) || (e == 0);
12082 e_conv = DecodeError_clone(&e_conv);
12083 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
12084 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
12085 return (uint64_t)ret_conv;
12088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12089 if ((_res & 1) != 0) return;
12090 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12092 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
12095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12096 LDKChannelConfig o_conv;
12097 o_conv.inner = (void*)(o & (~1));
12098 o_conv.is_owned = (o & 1) || (o == 0);
12099 o_conv = ChannelConfig_clone(&o_conv);
12100 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12101 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
12102 return (uint64_t)ret_conv;
12105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12106 LDKDecodeError e_conv;
12107 e_conv.inner = (void*)(e & (~1));
12108 e_conv.is_owned = (e & 1) || (e == 0);
12109 e_conv = DecodeError_clone(&e_conv);
12110 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12111 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
12112 return (uint64_t)ret_conv;
12115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12116 if ((_res & 1) != 0) return;
12117 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
12119 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
12122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12123 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
12124 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
12125 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
12126 return (uint64_t)ret_conv;
12129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12130 LDKOutPoint o_conv;
12131 o_conv.inner = (void*)(o & (~1));
12132 o_conv.is_owned = (o & 1) || (o == 0);
12133 o_conv = OutPoint_clone(&o_conv);
12134 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12135 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
12136 return (uint64_t)ret_conv;
12139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12140 LDKDecodeError e_conv;
12141 e_conv.inner = (void*)(e & (~1));
12142 e_conv.is_owned = (e & 1) || (e == 0);
12143 e_conv = DecodeError_clone(&e_conv);
12144 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12145 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
12146 return (uint64_t)ret_conv;
12149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12150 if ((_res & 1) != 0) return;
12151 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
12153 CResult_OutPointDecodeErrorZ_free(_res_conv);
12156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12157 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
12158 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
12159 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
12160 return (uint64_t)ret_conv;
12163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
12164 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
12165 if (o_conv.free == LDKType_JCalls_free) {
12166 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12167 LDKType_JCalls_cloned(&o_conv);
12169 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12170 *ret_copy = COption_TypeZ_some(o_conv);
12171 uint64_t ret_ref = (uint64_t)ret_copy;
12175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
12176 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12177 *ret_copy = COption_TypeZ_none();
12178 uint64_t ret_ref = (uint64_t)ret_copy;
12182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12183 if ((_res & 1) != 0) return;
12184 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
12186 COption_TypeZ_free(_res_conv);
12189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12190 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
12191 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12192 *ret_copy = COption_TypeZ_clone(orig_conv);
12193 uint64_t ret_ref = (uint64_t)ret_copy;
12197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12198 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
12199 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
12200 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12201 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
12202 return (uint64_t)ret_conv;
12205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12206 LDKDecodeError e_conv;
12207 e_conv.inner = (void*)(e & (~1));
12208 e_conv.is_owned = (e & 1) || (e == 0);
12209 e_conv = DecodeError_clone(&e_conv);
12210 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12211 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
12212 return (uint64_t)ret_conv;
12215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12216 if ((_res & 1) != 0) return;
12217 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12219 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
12222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12223 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
12224 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12225 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
12226 return (uint64_t)ret_conv;
12229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
12230 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
12231 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12232 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
12233 return (uint64_t)ret_conv;
12236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
12237 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12238 *ret_conv = CResult_SiPrefixNoneZ_err();
12239 return (uint64_t)ret_conv;
12242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12243 if ((_res & 1) != 0) return;
12244 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
12246 CResult_SiPrefixNoneZ_free(_res_conv);
12249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12250 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
12251 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12252 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
12253 return (uint64_t)ret_conv;
12256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12258 o_conv.inner = (void*)(o & (~1));
12259 o_conv.is_owned = (o & 1) || (o == 0);
12260 o_conv = Invoice_clone(&o_conv);
12261 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12262 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
12263 return (uint64_t)ret_conv;
12266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12267 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12268 *ret_conv = CResult_InvoiceNoneZ_err();
12269 return (uint64_t)ret_conv;
12272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12273 if ((_res & 1) != 0) return;
12274 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
12276 CResult_InvoiceNoneZ_free(_res_conv);
12279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12280 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
12281 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12282 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
12283 return (uint64_t)ret_conv;
12286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12287 LDKSignedRawInvoice o_conv;
12288 o_conv.inner = (void*)(o & (~1));
12289 o_conv.is_owned = (o & 1) || (o == 0);
12290 o_conv = SignedRawInvoice_clone(&o_conv);
12291 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12292 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
12293 return (uint64_t)ret_conv;
12296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12297 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12298 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
12299 return (uint64_t)ret_conv;
12302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12303 if ((_res & 1) != 0) return;
12304 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
12306 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
12309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12310 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
12311 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12312 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
12313 return (uint64_t)ret_conv;
12316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12317 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
12318 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12319 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
12320 return ((uint64_t)ret_conv);
12323 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) {
12324 LDKRawInvoice a_conv;
12325 a_conv.inner = (void*)(a & (~1));
12326 a_conv.is_owned = (a & 1) || (a == 0);
12327 a_conv = RawInvoice_clone(&a_conv);
12328 LDKThirtyTwoBytes b_ref;
12329 CHECK((*env)->GetArrayLength(env, b) == 32);
12330 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
12331 LDKInvoiceSignature c_conv;
12332 c_conv.inner = (void*)(c & (~1));
12333 c_conv.is_owned = (c & 1) || (c == 0);
12334 c_conv = InvoiceSignature_clone(&c_conv);
12335 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12336 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
12337 return ((uint64_t)ret_conv);
12340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12341 if ((_res & 1) != 0) return;
12342 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
12344 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
12347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12348 LDKPayeePubKey o_conv;
12349 o_conv.inner = (void*)(o & (~1));
12350 o_conv.is_owned = (o & 1) || (o == 0);
12351 o_conv = PayeePubKey_clone(&o_conv);
12352 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12353 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
12354 return (uint64_t)ret_conv;
12357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12358 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
12359 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12360 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
12361 return (uint64_t)ret_conv;
12364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12365 if ((_res & 1) != 0) return;
12366 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
12368 CResult_PayeePubKeyErrorZ_free(_res_conv);
12371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12372 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
12373 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12374 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
12375 return (uint64_t)ret_conv;
12378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12379 LDKCVec_PrivateRouteZ _res_constr;
12380 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12381 if (_res_constr.datalen > 0)
12382 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
12384 _res_constr.data = NULL;
12385 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12386 for (size_t o = 0; o < _res_constr.datalen; o++) {
12387 int64_t _res_conv_14 = _res_vals[o];
12388 LDKPrivateRoute _res_conv_14_conv;
12389 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12390 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12391 _res_constr.data[o] = _res_conv_14_conv;
12393 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12394 CVec_PrivateRouteZ_free(_res_constr);
12397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12398 LDKPositiveTimestamp o_conv;
12399 o_conv.inner = (void*)(o & (~1));
12400 o_conv.is_owned = (o & 1) || (o == 0);
12401 o_conv = PositiveTimestamp_clone(&o_conv);
12402 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12403 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
12404 return (uint64_t)ret_conv;
12407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12408 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12409 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12410 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
12411 return (uint64_t)ret_conv;
12414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12415 if ((_res & 1) != 0) return;
12416 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
12418 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
12421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12422 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
12423 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12424 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
12425 return (uint64_t)ret_conv;
12428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
12429 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12430 *ret_conv = CResult_NoneSemanticErrorZ_ok();
12431 return (uint64_t)ret_conv;
12434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12435 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12436 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12437 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
12438 return (uint64_t)ret_conv;
12441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12442 if ((_res & 1) != 0) return;
12443 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
12445 CResult_NoneSemanticErrorZ_free(_res_conv);
12448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12449 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
12450 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12451 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
12452 return (uint64_t)ret_conv;
12455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12457 o_conv.inner = (void*)(o & (~1));
12458 o_conv.is_owned = (o & 1) || (o == 0);
12459 o_conv = Invoice_clone(&o_conv);
12460 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12461 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
12462 return (uint64_t)ret_conv;
12465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12466 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12467 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12468 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
12469 return (uint64_t)ret_conv;
12472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12473 if ((_res & 1) != 0) return;
12474 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
12476 CResult_InvoiceSemanticErrorZ_free(_res_conv);
12479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12480 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
12481 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12482 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
12483 return (uint64_t)ret_conv;
12486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12487 LDKDescription o_conv;
12488 o_conv.inner = (void*)(o & (~1));
12489 o_conv.is_owned = (o & 1) || (o == 0);
12490 o_conv = Description_clone(&o_conv);
12491 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12492 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
12493 return (uint64_t)ret_conv;
12496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12497 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12498 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12499 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
12500 return (uint64_t)ret_conv;
12503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12504 if ((_res & 1) != 0) return;
12505 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
12507 CResult_DescriptionCreationErrorZ_free(_res_conv);
12510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12511 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
12512 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12513 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
12514 return (uint64_t)ret_conv;
12517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12518 LDKExpiryTime o_conv;
12519 o_conv.inner = (void*)(o & (~1));
12520 o_conv.is_owned = (o & 1) || (o == 0);
12521 o_conv = ExpiryTime_clone(&o_conv);
12522 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12523 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
12524 return (uint64_t)ret_conv;
12527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12528 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12529 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12530 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
12531 return (uint64_t)ret_conv;
12534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12535 if ((_res & 1) != 0) return;
12536 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
12538 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
12541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12542 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
12543 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12544 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
12545 return (uint64_t)ret_conv;
12548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12549 LDKPrivateRoute o_conv;
12550 o_conv.inner = (void*)(o & (~1));
12551 o_conv.is_owned = (o & 1) || (o == 0);
12552 o_conv = PrivateRoute_clone(&o_conv);
12553 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12554 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
12555 return (uint64_t)ret_conv;
12558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12559 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12560 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12561 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
12562 return (uint64_t)ret_conv;
12565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12566 if ((_res & 1) != 0) return;
12567 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
12569 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
12572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12573 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
12574 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12575 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
12576 return (uint64_t)ret_conv;
12579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
12580 LDKStr o_conv = java_to_owned_str(env, o);
12581 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12582 *ret_conv = CResult_StringErrorZ_ok(o_conv);
12583 return (uint64_t)ret_conv;
12586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12587 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
12588 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12589 *ret_conv = CResult_StringErrorZ_err(e_conv);
12590 return (uint64_t)ret_conv;
12593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12594 if ((_res & 1) != 0) return;
12595 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
12597 CResult_StringErrorZ_free(_res_conv);
12600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12601 LDKChannelMonitorUpdate o_conv;
12602 o_conv.inner = (void*)(o & (~1));
12603 o_conv.is_owned = (o & 1) || (o == 0);
12604 o_conv = ChannelMonitorUpdate_clone(&o_conv);
12605 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12606 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
12607 return (uint64_t)ret_conv;
12610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12611 LDKDecodeError e_conv;
12612 e_conv.inner = (void*)(e & (~1));
12613 e_conv.is_owned = (e & 1) || (e == 0);
12614 e_conv = DecodeError_clone(&e_conv);
12615 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12616 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
12617 return (uint64_t)ret_conv;
12620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12621 if ((_res & 1) != 0) return;
12622 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12624 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
12627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12628 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
12629 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12630 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
12631 return (uint64_t)ret_conv;
12634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12635 LDKHTLCUpdate o_conv;
12636 o_conv.inner = (void*)(o & (~1));
12637 o_conv.is_owned = (o & 1) || (o == 0);
12638 o_conv = HTLCUpdate_clone(&o_conv);
12639 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12640 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
12641 return (uint64_t)ret_conv;
12644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12645 LDKDecodeError e_conv;
12646 e_conv.inner = (void*)(e & (~1));
12647 e_conv.is_owned = (e & 1) || (e == 0);
12648 e_conv = DecodeError_clone(&e_conv);
12649 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12650 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
12651 return (uint64_t)ret_conv;
12654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12655 if ((_res & 1) != 0) return;
12656 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12658 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
12661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12662 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
12663 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12664 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
12665 return (uint64_t)ret_conv;
12668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
12669 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12670 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
12671 return (uint64_t)ret_conv;
12674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12675 LDKMonitorUpdateError e_conv;
12676 e_conv.inner = (void*)(e & (~1));
12677 e_conv.is_owned = (e & 1) || (e == 0);
12678 e_conv = MonitorUpdateError_clone(&e_conv);
12679 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12680 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
12681 return (uint64_t)ret_conv;
12684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12685 if ((_res & 1) != 0) return;
12686 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
12688 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
12691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12692 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
12693 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12694 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
12695 return (uint64_t)ret_conv;
12698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12699 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
12700 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12701 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
12702 return ((uint64_t)ret_conv);
12705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
12706 LDKOutPoint a_conv;
12707 a_conv.inner = (void*)(a & (~1));
12708 a_conv.is_owned = (a & 1) || (a == 0);
12709 a_conv = OutPoint_clone(&a_conv);
12711 b_ref.datalen = (*env)->GetArrayLength(env, b);
12712 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12713 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
12714 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12715 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
12716 return ((uint64_t)ret_conv);
12719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12720 if ((_res & 1) != 0) return;
12721 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
12723 C2Tuple_OutPointScriptZ_free(_res_conv);
12726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12727 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
12728 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12729 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
12730 return ((uint64_t)ret_conv);
12733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
12735 b_ref.datalen = (*env)->GetArrayLength(env, b);
12736 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12737 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
12738 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12739 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
12740 return ((uint64_t)ret_conv);
12743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12744 if ((_res & 1) != 0) return;
12745 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
12747 C2Tuple_u32ScriptZ_free(_res_conv);
12750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12751 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
12752 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12753 if (_res_constr.datalen > 0)
12754 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12756 _res_constr.data = NULL;
12757 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12758 for (size_t v = 0; v < _res_constr.datalen; v++) {
12759 int64_t _res_conv_21 = _res_vals[v];
12760 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_21) & ~1);
12761 FREE((void*)_res_conv_21);
12762 _res_constr.data[v] = _res_conv_21_conv;
12764 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12765 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
12768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12769 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
12770 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12771 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
12772 return ((uint64_t)ret_conv);
12775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
12776 LDKThirtyTwoBytes a_ref;
12777 CHECK((*env)->GetArrayLength(env, a) == 32);
12778 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12779 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
12780 b_constr.datalen = (*env)->GetArrayLength(env, b);
12781 if (b_constr.datalen > 0)
12782 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12784 b_constr.data = NULL;
12785 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
12786 for (size_t v = 0; v < b_constr.datalen; v++) {
12787 int64_t b_conv_21 = b_vals[v];
12788 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1);
12789 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_21) & ~1));
12790 b_constr.data[v] = b_conv_21_conv;
12792 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
12793 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12794 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
12795 return ((uint64_t)ret_conv);
12798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12799 if ((_res & 1) != 0) return;
12800 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
12802 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
12805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12806 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
12807 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12808 if (_res_constr.datalen > 0)
12809 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
12811 _res_constr.data = NULL;
12812 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12813 for (size_t o = 0; o < _res_constr.datalen; o++) {
12814 int64_t _res_conv_40 = _res_vals[o];
12815 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_40) & ~1);
12816 FREE((void*)_res_conv_40);
12817 _res_constr.data[o] = _res_conv_40_conv;
12819 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12820 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
12823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12824 LDKCVec_EventZ _res_constr;
12825 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12826 if (_res_constr.datalen > 0)
12827 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
12829 _res_constr.data = NULL;
12830 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12831 for (size_t h = 0; h < _res_constr.datalen; h++) {
12832 int64_t _res_conv_7 = _res_vals[h];
12833 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
12834 FREE((void*)_res_conv_7);
12835 _res_constr.data[h] = _res_conv_7_conv;
12837 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12838 CVec_EventZ_free(_res_constr);
12841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12842 LDKCVec_TransactionZ _res_constr;
12843 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12844 if (_res_constr.datalen > 0)
12845 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
12847 _res_constr.data = NULL;
12848 for (size_t i = 0; i < _res_constr.datalen; i++) {
12849 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
12850 LDKTransaction _res_conv_8_ref;
12851 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
12852 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
12853 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
12854 _res_conv_8_ref.data_is_owned = true;
12855 _res_constr.data[i] = _res_conv_8_ref;
12857 CVec_TransactionZ_free(_res_constr);
12860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12861 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
12862 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12863 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
12864 return ((uint64_t)ret_conv);
12867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
12868 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
12869 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
12870 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12871 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
12872 return ((uint64_t)ret_conv);
12875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12876 if ((_res & 1) != 0) return;
12877 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
12879 C2Tuple_u32TxOutZ_free(_res_conv);
12882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12883 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
12884 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12885 if (_res_constr.datalen > 0)
12886 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12888 _res_constr.data = NULL;
12889 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12890 for (size_t u = 0; u < _res_constr.datalen; u++) {
12891 int64_t _res_conv_20 = _res_vals[u];
12892 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_20) & ~1);
12893 FREE((void*)_res_conv_20);
12894 _res_constr.data[u] = _res_conv_20_conv;
12896 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12897 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
12900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12901 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
12902 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12903 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
12904 return ((uint64_t)ret_conv);
12907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
12908 LDKThirtyTwoBytes a_ref;
12909 CHECK((*env)->GetArrayLength(env, a) == 32);
12910 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12911 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
12912 b_constr.datalen = (*env)->GetArrayLength(env, b);
12913 if (b_constr.datalen > 0)
12914 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12916 b_constr.data = NULL;
12917 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
12918 for (size_t u = 0; u < b_constr.datalen; u++) {
12919 int64_t b_conv_20 = b_vals[u];
12920 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1);
12921 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_20) & ~1));
12922 b_constr.data[u] = b_conv_20_conv;
12924 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
12925 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12926 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
12927 return ((uint64_t)ret_conv);
12930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12931 if ((_res & 1) != 0) return;
12932 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
12934 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
12937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12938 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
12939 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12940 if (_res_constr.datalen > 0)
12941 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
12943 _res_constr.data = NULL;
12944 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12945 for (size_t n = 0; n < _res_constr.datalen; n++) {
12946 int64_t _res_conv_39 = _res_vals[n];
12947 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_39) & ~1);
12948 FREE((void*)_res_conv_39);
12949 _res_constr.data[n] = _res_conv_39_conv;
12951 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12952 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
12955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12956 LDKCVec_BalanceZ _res_constr;
12957 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12958 if (_res_constr.datalen > 0)
12959 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
12961 _res_constr.data = NULL;
12962 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12963 for (size_t j = 0; j < _res_constr.datalen; j++) {
12964 int64_t _res_conv_9 = _res_vals[j];
12965 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
12966 FREE((void*)_res_conv_9);
12967 _res_constr.data[j] = _res_conv_9_conv;
12969 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12970 CVec_BalanceZ_free(_res_constr);
12973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12974 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
12975 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1));
12976 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12977 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
12978 return (uint64_t)ret_conv;
12981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12982 LDKDecodeError e_conv;
12983 e_conv.inner = (void*)(e & (~1));
12984 e_conv.is_owned = (e & 1) || (e == 0);
12985 e_conv = DecodeError_clone(&e_conv);
12986 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12987 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
12988 return (uint64_t)ret_conv;
12991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12992 if ((_res & 1) != 0) return;
12993 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12995 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
12998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12999 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
13000 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
13001 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
13002 return (uint64_t)ret_conv;
13005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
13006 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13007 *ret_conv = CResult_NoneLightningErrorZ_ok();
13008 return (uint64_t)ret_conv;
13011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13012 LDKLightningError e_conv;
13013 e_conv.inner = (void*)(e & (~1));
13014 e_conv.is_owned = (e & 1) || (e == 0);
13015 e_conv = LightningError_clone(&e_conv);
13016 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13017 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
13018 return (uint64_t)ret_conv;
13021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13022 if ((_res & 1) != 0) return;
13023 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
13025 CResult_NoneLightningErrorZ_free(_res_conv);
13028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13029 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
13030 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13031 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
13032 return (uint64_t)ret_conv;
13035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13036 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
13037 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13038 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
13039 return ((uint64_t)ret_conv);
13042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
13043 LDKPublicKey a_ref;
13044 CHECK((*env)->GetArrayLength(env, a) == 33);
13045 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
13046 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
13047 if (b_conv.free == LDKType_JCalls_free) {
13048 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13049 LDKType_JCalls_cloned(&b_conv);
13051 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13052 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
13053 return ((uint64_t)ret_conv);
13056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13057 if ((_res & 1) != 0) return;
13058 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
13060 C2Tuple_PublicKeyTypeZ_free(_res_conv);
13063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13064 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
13065 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13066 if (_res_constr.datalen > 0)
13067 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13069 _res_constr.data = NULL;
13070 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13071 for (size_t z = 0; z < _res_constr.datalen; z++) {
13072 int64_t _res_conv_25 = _res_vals[z];
13073 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_25) & ~1);
13074 FREE((void*)_res_conv_25);
13075 _res_constr.data[z] = _res_conv_25_conv;
13077 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13078 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
13081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13082 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13083 *ret_conv = CResult_boolLightningErrorZ_ok(o);
13084 return (uint64_t)ret_conv;
13087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13088 LDKLightningError e_conv;
13089 e_conv.inner = (void*)(e & (~1));
13090 e_conv.is_owned = (e & 1) || (e == 0);
13091 e_conv = LightningError_clone(&e_conv);
13092 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13093 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
13094 return (uint64_t)ret_conv;
13097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13098 if ((_res & 1) != 0) return;
13099 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
13101 CResult_boolLightningErrorZ_free(_res_conv);
13104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13105 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
13106 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
13107 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
13108 return (uint64_t)ret_conv;
13111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13112 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
13113 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13114 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
13115 return ((uint64_t)ret_conv);
13118 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) {
13119 LDKChannelAnnouncement a_conv;
13120 a_conv.inner = (void*)(a & (~1));
13121 a_conv.is_owned = (a & 1) || (a == 0);
13122 a_conv = ChannelAnnouncement_clone(&a_conv);
13123 LDKChannelUpdate b_conv;
13124 b_conv.inner = (void*)(b & (~1));
13125 b_conv.is_owned = (b & 1) || (b == 0);
13126 b_conv = ChannelUpdate_clone(&b_conv);
13127 LDKChannelUpdate c_conv;
13128 c_conv.inner = (void*)(c & (~1));
13129 c_conv.is_owned = (c & 1) || (c == 0);
13130 c_conv = ChannelUpdate_clone(&c_conv);
13131 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
13132 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
13133 return ((uint64_t)ret_conv);
13136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13137 if ((_res & 1) != 0) return;
13138 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
13140 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
13143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13144 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
13145 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13146 if (_res_constr.datalen > 0)
13147 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
13149 _res_constr.data = NULL;
13150 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13151 for (size_t h = 0; h < _res_constr.datalen; h++) {
13152 int64_t _res_conv_59 = _res_vals[h];
13153 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_59) & ~1);
13154 FREE((void*)_res_conv_59);
13155 _res_constr.data[h] = _res_conv_59_conv;
13157 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13158 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
13161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13162 LDKCVec_NodeAnnouncementZ _res_constr;
13163 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13164 if (_res_constr.datalen > 0)
13165 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
13167 _res_constr.data = NULL;
13168 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13169 for (size_t s = 0; s < _res_constr.datalen; s++) {
13170 int64_t _res_conv_18 = _res_vals[s];
13171 LDKNodeAnnouncement _res_conv_18_conv;
13172 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
13173 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
13174 _res_constr.data[s] = _res_conv_18_conv;
13176 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13177 CVec_NodeAnnouncementZ_free(_res_constr);
13180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13181 LDKCVec_PublicKeyZ _res_constr;
13182 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13183 if (_res_constr.datalen > 0)
13184 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13186 _res_constr.data = NULL;
13187 for (size_t i = 0; i < _res_constr.datalen; i++) {
13188 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13189 LDKPublicKey _res_conv_8_ref;
13190 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
13191 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
13192 _res_constr.data[i] = _res_conv_8_ref;
13194 CVec_PublicKeyZ_free(_res_constr);
13197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13199 o_ref.datalen = (*env)->GetArrayLength(env, o);
13200 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13201 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
13202 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13203 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13204 return (uint64_t)ret_conv;
13207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13208 LDKPeerHandleError e_conv;
13209 e_conv.inner = (void*)(e & (~1));
13210 e_conv.is_owned = (e & 1) || (e == 0);
13211 e_conv = PeerHandleError_clone(&e_conv);
13212 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13213 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13214 return (uint64_t)ret_conv;
13217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13218 if ((_res & 1) != 0) return;
13219 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13221 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13225 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13226 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13227 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13228 return (uint64_t)ret_conv;
13231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
13232 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13233 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13234 return (uint64_t)ret_conv;
13237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13238 LDKPeerHandleError e_conv;
13239 e_conv.inner = (void*)(e & (~1));
13240 e_conv.is_owned = (e & 1) || (e == 0);
13241 e_conv = PeerHandleError_clone(&e_conv);
13242 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13243 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13244 return (uint64_t)ret_conv;
13247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13248 if ((_res & 1) != 0) return;
13249 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13251 CResult_NonePeerHandleErrorZ_free(_res_conv);
13254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13255 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13256 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13257 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13258 return (uint64_t)ret_conv;
13261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13262 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13263 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13264 return (uint64_t)ret_conv;
13267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13268 LDKPeerHandleError e_conv;
13269 e_conv.inner = (void*)(e & (~1));
13270 e_conv.is_owned = (e & 1) || (e == 0);
13271 e_conv = PeerHandleError_clone(&e_conv);
13272 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13273 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
13274 return (uint64_t)ret_conv;
13277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13278 if ((_res & 1) != 0) return;
13279 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13281 CResult_boolPeerHandleErrorZ_free(_res_conv);
13284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13285 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
13286 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13287 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
13288 return (uint64_t)ret_conv;
13291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13292 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
13293 if (o_conv.free == LDKAccess_JCalls_free) {
13294 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13295 LDKAccess_JCalls_cloned(&o_conv);
13297 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13298 *ret_copy = COption_AccessZ_some(o_conv);
13299 uint64_t ret_ref = (uint64_t)ret_copy;
13303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
13304 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13305 *ret_copy = COption_AccessZ_none();
13306 uint64_t ret_ref = (uint64_t)ret_copy;
13310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13311 if ((_res & 1) != 0) return;
13312 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
13314 COption_AccessZ_free(_res_conv);
13317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13318 LDKDirectionalChannelInfo o_conv;
13319 o_conv.inner = (void*)(o & (~1));
13320 o_conv.is_owned = (o & 1) || (o == 0);
13321 o_conv = DirectionalChannelInfo_clone(&o_conv);
13322 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13323 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
13324 return (uint64_t)ret_conv;
13327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13328 LDKDecodeError e_conv;
13329 e_conv.inner = (void*)(e & (~1));
13330 e_conv.is_owned = (e & 1) || (e == 0);
13331 e_conv = DecodeError_clone(&e_conv);
13332 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13333 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
13334 return (uint64_t)ret_conv;
13337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13338 if ((_res & 1) != 0) return;
13339 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13341 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
13344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13345 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
13346 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13347 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
13348 return (uint64_t)ret_conv;
13351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13352 LDKChannelInfo o_conv;
13353 o_conv.inner = (void*)(o & (~1));
13354 o_conv.is_owned = (o & 1) || (o == 0);
13355 o_conv = ChannelInfo_clone(&o_conv);
13356 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13357 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13358 return (uint64_t)ret_conv;
13361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13362 LDKDecodeError e_conv;
13363 e_conv.inner = (void*)(e & (~1));
13364 e_conv.is_owned = (e & 1) || (e == 0);
13365 e_conv = DecodeError_clone(&e_conv);
13366 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13367 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13368 return (uint64_t)ret_conv;
13371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13372 if ((_res & 1) != 0) return;
13373 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13375 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13379 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
13380 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13381 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13382 return (uint64_t)ret_conv;
13385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13386 LDKRoutingFees o_conv;
13387 o_conv.inner = (void*)(o & (~1));
13388 o_conv.is_owned = (o & 1) || (o == 0);
13389 o_conv = RoutingFees_clone(&o_conv);
13390 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13391 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13392 return (uint64_t)ret_conv;
13395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13396 LDKDecodeError e_conv;
13397 e_conv.inner = (void*)(e & (~1));
13398 e_conv.is_owned = (e & 1) || (e == 0);
13399 e_conv = DecodeError_clone(&e_conv);
13400 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13401 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13402 return (uint64_t)ret_conv;
13405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13406 if ((_res & 1) != 0) return;
13407 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
13409 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13413 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
13414 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13415 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13416 return (uint64_t)ret_conv;
13419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13420 LDKNodeAnnouncementInfo o_conv;
13421 o_conv.inner = (void*)(o & (~1));
13422 o_conv.is_owned = (o & 1) || (o == 0);
13423 o_conv = NodeAnnouncementInfo_clone(&o_conv);
13424 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13425 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13426 return (uint64_t)ret_conv;
13429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13430 LDKDecodeError e_conv;
13431 e_conv.inner = (void*)(e & (~1));
13432 e_conv.is_owned = (e & 1) || (e == 0);
13433 e_conv = DecodeError_clone(&e_conv);
13434 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13435 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13436 return (uint64_t)ret_conv;
13439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13440 if ((_res & 1) != 0) return;
13441 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13443 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13447 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
13448 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13449 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13450 return (uint64_t)ret_conv;
13453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13454 LDKCVec_u64Z _res_constr;
13455 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13456 if (_res_constr.datalen > 0)
13457 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13459 _res_constr.data = NULL;
13460 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13461 for (size_t g = 0; g < _res_constr.datalen; g++) {
13462 int64_t _res_conv_6 = _res_vals[g];
13463 _res_constr.data[g] = _res_conv_6;
13465 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13466 CVec_u64Z_free(_res_constr);
13469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13470 LDKNodeInfo o_conv;
13471 o_conv.inner = (void*)(o & (~1));
13472 o_conv.is_owned = (o & 1) || (o == 0);
13473 o_conv = NodeInfo_clone(&o_conv);
13474 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13475 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13476 return (uint64_t)ret_conv;
13479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13480 LDKDecodeError e_conv;
13481 e_conv.inner = (void*)(e & (~1));
13482 e_conv.is_owned = (e & 1) || (e == 0);
13483 e_conv = DecodeError_clone(&e_conv);
13484 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13485 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13486 return (uint64_t)ret_conv;
13489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13490 if ((_res & 1) != 0) return;
13491 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13493 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13497 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
13498 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13499 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13500 return (uint64_t)ret_conv;
13503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13504 LDKNetworkGraph o_conv;
13505 o_conv.inner = (void*)(o & (~1));
13506 o_conv.is_owned = (o & 1) || (o == 0);
13507 o_conv = NetworkGraph_clone(&o_conv);
13508 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13509 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13510 return (uint64_t)ret_conv;
13513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13514 LDKDecodeError e_conv;
13515 e_conv.inner = (void*)(e & (~1));
13516 e_conv.is_owned = (e & 1) || (e == 0);
13517 e_conv = DecodeError_clone(&e_conv);
13518 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13519 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13520 return (uint64_t)ret_conv;
13523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13524 if ((_res & 1) != 0) return;
13525 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
13527 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13531 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
13532 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13533 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
13534 return (uint64_t)ret_conv;
13537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
13538 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
13539 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13540 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13541 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
13542 return (uint64_t)ret_conv;
13545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
13546 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13547 *ret_conv = CResult_NetAddressu8Z_err(e);
13548 return (uint64_t)ret_conv;
13551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
13552 if ((_res & 1) != 0) return;
13553 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
13555 CResult_NetAddressu8Z_free(_res_conv);
13558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13559 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
13560 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13561 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
13562 return (uint64_t)ret_conv;
13565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13566 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
13567 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
13568 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13569 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
13570 return (uint64_t)ret_conv;
13573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13574 LDKDecodeError e_conv;
13575 e_conv.inner = (void*)(e & (~1));
13576 e_conv.is_owned = (e & 1) || (e == 0);
13577 e_conv = DecodeError_clone(&e_conv);
13578 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13579 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
13580 return (uint64_t)ret_conv;
13583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13584 if ((_res & 1) != 0) return;
13585 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
13587 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
13590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13591 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
13592 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13593 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
13594 return (uint64_t)ret_conv;
13597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13598 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
13599 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13600 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13601 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
13602 return (uint64_t)ret_conv;
13605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13606 LDKDecodeError e_conv;
13607 e_conv.inner = (void*)(e & (~1));
13608 e_conv.is_owned = (e & 1) || (e == 0);
13609 e_conv = DecodeError_clone(&e_conv);
13610 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13611 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
13612 return (uint64_t)ret_conv;
13615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13616 if ((_res & 1) != 0) return;
13617 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
13619 CResult_NetAddressDecodeErrorZ_free(_res_conv);
13622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13623 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
13624 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13625 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
13626 return (uint64_t)ret_conv;
13629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13630 LDKCVec_UpdateAddHTLCZ _res_constr;
13631 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13632 if (_res_constr.datalen > 0)
13633 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13635 _res_constr.data = NULL;
13636 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13637 for (size_t p = 0; p < _res_constr.datalen; p++) {
13638 int64_t _res_conv_15 = _res_vals[p];
13639 LDKUpdateAddHTLC _res_conv_15_conv;
13640 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
13641 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
13642 _res_constr.data[p] = _res_conv_15_conv;
13644 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13645 CVec_UpdateAddHTLCZ_free(_res_constr);
13648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13649 LDKCVec_UpdateFulfillHTLCZ _res_constr;
13650 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13651 if (_res_constr.datalen > 0)
13652 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13654 _res_constr.data = NULL;
13655 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13656 for (size_t t = 0; t < _res_constr.datalen; t++) {
13657 int64_t _res_conv_19 = _res_vals[t];
13658 LDKUpdateFulfillHTLC _res_conv_19_conv;
13659 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
13660 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
13661 _res_constr.data[t] = _res_conv_19_conv;
13663 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13664 CVec_UpdateFulfillHTLCZ_free(_res_constr);
13667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13668 LDKCVec_UpdateFailHTLCZ _res_constr;
13669 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13670 if (_res_constr.datalen > 0)
13671 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13673 _res_constr.data = NULL;
13674 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13675 for (size_t q = 0; q < _res_constr.datalen; q++) {
13676 int64_t _res_conv_16 = _res_vals[q];
13677 LDKUpdateFailHTLC _res_conv_16_conv;
13678 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
13679 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
13680 _res_constr.data[q] = _res_conv_16_conv;
13682 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13683 CVec_UpdateFailHTLCZ_free(_res_constr);
13686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13687 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
13688 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13689 if (_res_constr.datalen > 0)
13690 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13692 _res_constr.data = NULL;
13693 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13694 for (size_t z = 0; z < _res_constr.datalen; z++) {
13695 int64_t _res_conv_25 = _res_vals[z];
13696 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
13697 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
13698 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
13699 _res_constr.data[z] = _res_conv_25_conv;
13701 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13702 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
13705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13706 LDKAcceptChannel o_conv;
13707 o_conv.inner = (void*)(o & (~1));
13708 o_conv.is_owned = (o & 1) || (o == 0);
13709 o_conv = AcceptChannel_clone(&o_conv);
13710 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13711 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
13712 return (uint64_t)ret_conv;
13715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13716 LDKDecodeError e_conv;
13717 e_conv.inner = (void*)(e & (~1));
13718 e_conv.is_owned = (e & 1) || (e == 0);
13719 e_conv = DecodeError_clone(&e_conv);
13720 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13721 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
13722 return (uint64_t)ret_conv;
13725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13726 if ((_res & 1) != 0) return;
13727 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
13729 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
13732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13733 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
13734 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13735 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
13736 return (uint64_t)ret_conv;
13739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13740 LDKAnnouncementSignatures o_conv;
13741 o_conv.inner = (void*)(o & (~1));
13742 o_conv.is_owned = (o & 1) || (o == 0);
13743 o_conv = AnnouncementSignatures_clone(&o_conv);
13744 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13745 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
13746 return (uint64_t)ret_conv;
13749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13750 LDKDecodeError e_conv;
13751 e_conv.inner = (void*)(e & (~1));
13752 e_conv.is_owned = (e & 1) || (e == 0);
13753 e_conv = DecodeError_clone(&e_conv);
13754 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13755 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
13756 return (uint64_t)ret_conv;
13759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13760 if ((_res & 1) != 0) return;
13761 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
13763 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
13766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13767 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
13768 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13769 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
13770 return (uint64_t)ret_conv;
13773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13774 LDKChannelReestablish o_conv;
13775 o_conv.inner = (void*)(o & (~1));
13776 o_conv.is_owned = (o & 1) || (o == 0);
13777 o_conv = ChannelReestablish_clone(&o_conv);
13778 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13779 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
13780 return (uint64_t)ret_conv;
13783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13784 LDKDecodeError e_conv;
13785 e_conv.inner = (void*)(e & (~1));
13786 e_conv.is_owned = (e & 1) || (e == 0);
13787 e_conv = DecodeError_clone(&e_conv);
13788 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13789 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
13790 return (uint64_t)ret_conv;
13793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13794 if ((_res & 1) != 0) return;
13795 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
13797 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
13800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13801 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
13802 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13803 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
13804 return (uint64_t)ret_conv;
13807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13808 LDKClosingSigned o_conv;
13809 o_conv.inner = (void*)(o & (~1));
13810 o_conv.is_owned = (o & 1) || (o == 0);
13811 o_conv = ClosingSigned_clone(&o_conv);
13812 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13813 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
13814 return (uint64_t)ret_conv;
13817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13818 LDKDecodeError e_conv;
13819 e_conv.inner = (void*)(e & (~1));
13820 e_conv.is_owned = (e & 1) || (e == 0);
13821 e_conv = DecodeError_clone(&e_conv);
13822 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13823 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
13824 return (uint64_t)ret_conv;
13827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13828 if ((_res & 1) != 0) return;
13829 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13831 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
13834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13835 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
13836 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13837 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
13838 return (uint64_t)ret_conv;
13841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13842 LDKClosingSignedFeeRange o_conv;
13843 o_conv.inner = (void*)(o & (~1));
13844 o_conv.is_owned = (o & 1) || (o == 0);
13845 o_conv = ClosingSignedFeeRange_clone(&o_conv);
13846 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13847 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
13848 return (uint64_t)ret_conv;
13851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13852 LDKDecodeError e_conv;
13853 e_conv.inner = (void*)(e & (~1));
13854 e_conv.is_owned = (e & 1) || (e == 0);
13855 e_conv = DecodeError_clone(&e_conv);
13856 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13857 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
13858 return (uint64_t)ret_conv;
13861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13862 if ((_res & 1) != 0) return;
13863 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13865 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
13868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13869 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
13870 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13871 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
13872 return (uint64_t)ret_conv;
13875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13876 LDKCommitmentSigned o_conv;
13877 o_conv.inner = (void*)(o & (~1));
13878 o_conv.is_owned = (o & 1) || (o == 0);
13879 o_conv = CommitmentSigned_clone(&o_conv);
13880 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13881 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
13882 return (uint64_t)ret_conv;
13885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13886 LDKDecodeError e_conv;
13887 e_conv.inner = (void*)(e & (~1));
13888 e_conv.is_owned = (e & 1) || (e == 0);
13889 e_conv = DecodeError_clone(&e_conv);
13890 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13891 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
13892 return (uint64_t)ret_conv;
13895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13896 if ((_res & 1) != 0) return;
13897 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13899 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
13902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13903 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
13904 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13905 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
13906 return (uint64_t)ret_conv;
13909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13910 LDKFundingCreated o_conv;
13911 o_conv.inner = (void*)(o & (~1));
13912 o_conv.is_owned = (o & 1) || (o == 0);
13913 o_conv = FundingCreated_clone(&o_conv);
13914 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13915 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
13916 return (uint64_t)ret_conv;
13919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13920 LDKDecodeError e_conv;
13921 e_conv.inner = (void*)(e & (~1));
13922 e_conv.is_owned = (e & 1) || (e == 0);
13923 e_conv = DecodeError_clone(&e_conv);
13924 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13925 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
13926 return (uint64_t)ret_conv;
13929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13930 if ((_res & 1) != 0) return;
13931 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13933 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
13936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13937 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
13938 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13939 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
13940 return (uint64_t)ret_conv;
13943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13944 LDKFundingSigned o_conv;
13945 o_conv.inner = (void*)(o & (~1));
13946 o_conv.is_owned = (o & 1) || (o == 0);
13947 o_conv = FundingSigned_clone(&o_conv);
13948 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13949 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
13950 return (uint64_t)ret_conv;
13953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13954 LDKDecodeError e_conv;
13955 e_conv.inner = (void*)(e & (~1));
13956 e_conv.is_owned = (e & 1) || (e == 0);
13957 e_conv = DecodeError_clone(&e_conv);
13958 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13959 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
13960 return (uint64_t)ret_conv;
13963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13964 if ((_res & 1) != 0) return;
13965 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13967 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
13970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13971 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
13972 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13973 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
13974 return (uint64_t)ret_conv;
13977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13978 LDKFundingLocked o_conv;
13979 o_conv.inner = (void*)(o & (~1));
13980 o_conv.is_owned = (o & 1) || (o == 0);
13981 o_conv = FundingLocked_clone(&o_conv);
13982 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13983 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
13984 return (uint64_t)ret_conv;
13987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13988 LDKDecodeError e_conv;
13989 e_conv.inner = (void*)(e & (~1));
13990 e_conv.is_owned = (e & 1) || (e == 0);
13991 e_conv = DecodeError_clone(&e_conv);
13992 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13993 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
13994 return (uint64_t)ret_conv;
13997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13998 if ((_res & 1) != 0) return;
13999 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
14001 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
14004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14005 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
14006 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
14007 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
14008 return (uint64_t)ret_conv;
14011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14013 o_conv.inner = (void*)(o & (~1));
14014 o_conv.is_owned = (o & 1) || (o == 0);
14015 o_conv = Init_clone(&o_conv);
14016 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14017 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
14018 return (uint64_t)ret_conv;
14021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14022 LDKDecodeError e_conv;
14023 e_conv.inner = (void*)(e & (~1));
14024 e_conv.is_owned = (e & 1) || (e == 0);
14025 e_conv = DecodeError_clone(&e_conv);
14026 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14027 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
14028 return (uint64_t)ret_conv;
14031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14032 if ((_res & 1) != 0) return;
14033 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
14035 CResult_InitDecodeErrorZ_free(_res_conv);
14038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14039 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
14040 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
14041 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
14042 return (uint64_t)ret_conv;
14045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14046 LDKOpenChannel o_conv;
14047 o_conv.inner = (void*)(o & (~1));
14048 o_conv.is_owned = (o & 1) || (o == 0);
14049 o_conv = OpenChannel_clone(&o_conv);
14050 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14051 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
14052 return (uint64_t)ret_conv;
14055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14056 LDKDecodeError e_conv;
14057 e_conv.inner = (void*)(e & (~1));
14058 e_conv.is_owned = (e & 1) || (e == 0);
14059 e_conv = DecodeError_clone(&e_conv);
14060 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14061 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
14062 return (uint64_t)ret_conv;
14065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14066 if ((_res & 1) != 0) return;
14067 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
14069 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
14072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14073 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
14074 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
14075 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
14076 return (uint64_t)ret_conv;
14079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14080 LDKRevokeAndACK o_conv;
14081 o_conv.inner = (void*)(o & (~1));
14082 o_conv.is_owned = (o & 1) || (o == 0);
14083 o_conv = RevokeAndACK_clone(&o_conv);
14084 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14085 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
14086 return (uint64_t)ret_conv;
14089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14090 LDKDecodeError e_conv;
14091 e_conv.inner = (void*)(e & (~1));
14092 e_conv.is_owned = (e & 1) || (e == 0);
14093 e_conv = DecodeError_clone(&e_conv);
14094 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14095 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
14096 return (uint64_t)ret_conv;
14099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14100 if ((_res & 1) != 0) return;
14101 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
14103 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
14106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14107 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
14108 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
14109 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
14110 return (uint64_t)ret_conv;
14113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14114 LDKShutdown o_conv;
14115 o_conv.inner = (void*)(o & (~1));
14116 o_conv.is_owned = (o & 1) || (o == 0);
14117 o_conv = Shutdown_clone(&o_conv);
14118 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14119 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
14120 return (uint64_t)ret_conv;
14123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14124 LDKDecodeError e_conv;
14125 e_conv.inner = (void*)(e & (~1));
14126 e_conv.is_owned = (e & 1) || (e == 0);
14127 e_conv = DecodeError_clone(&e_conv);
14128 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14129 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
14130 return (uint64_t)ret_conv;
14133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14134 if ((_res & 1) != 0) return;
14135 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
14137 CResult_ShutdownDecodeErrorZ_free(_res_conv);
14140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14141 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
14142 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
14143 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
14144 return (uint64_t)ret_conv;
14147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14148 LDKUpdateFailHTLC o_conv;
14149 o_conv.inner = (void*)(o & (~1));
14150 o_conv.is_owned = (o & 1) || (o == 0);
14151 o_conv = UpdateFailHTLC_clone(&o_conv);
14152 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14153 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
14154 return (uint64_t)ret_conv;
14157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14158 LDKDecodeError e_conv;
14159 e_conv.inner = (void*)(e & (~1));
14160 e_conv.is_owned = (e & 1) || (e == 0);
14161 e_conv = DecodeError_clone(&e_conv);
14162 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14163 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
14164 return (uint64_t)ret_conv;
14167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14168 if ((_res & 1) != 0) return;
14169 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14171 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
14174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14175 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
14176 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
14177 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
14178 return (uint64_t)ret_conv;
14181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14182 LDKUpdateFailMalformedHTLC o_conv;
14183 o_conv.inner = (void*)(o & (~1));
14184 o_conv.is_owned = (o & 1) || (o == 0);
14185 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
14186 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14187 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
14188 return (uint64_t)ret_conv;
14191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14192 LDKDecodeError e_conv;
14193 e_conv.inner = (void*)(e & (~1));
14194 e_conv.is_owned = (e & 1) || (e == 0);
14195 e_conv = DecodeError_clone(&e_conv);
14196 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14197 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
14198 return (uint64_t)ret_conv;
14201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14202 if ((_res & 1) != 0) return;
14203 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14205 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
14208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14209 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
14210 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14211 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
14212 return (uint64_t)ret_conv;
14215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14216 LDKUpdateFee o_conv;
14217 o_conv.inner = (void*)(o & (~1));
14218 o_conv.is_owned = (o & 1) || (o == 0);
14219 o_conv = UpdateFee_clone(&o_conv);
14220 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14221 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
14222 return (uint64_t)ret_conv;
14225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14226 LDKDecodeError e_conv;
14227 e_conv.inner = (void*)(e & (~1));
14228 e_conv.is_owned = (e & 1) || (e == 0);
14229 e_conv = DecodeError_clone(&e_conv);
14230 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14231 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
14232 return (uint64_t)ret_conv;
14235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14236 if ((_res & 1) != 0) return;
14237 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14239 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14243 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14244 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14245 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14246 return (uint64_t)ret_conv;
14249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14250 LDKUpdateFulfillHTLC o_conv;
14251 o_conv.inner = (void*)(o & (~1));
14252 o_conv.is_owned = (o & 1) || (o == 0);
14253 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14254 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14255 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14256 return (uint64_t)ret_conv;
14259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14260 LDKDecodeError e_conv;
14261 e_conv.inner = (void*)(e & (~1));
14262 e_conv.is_owned = (e & 1) || (e == 0);
14263 e_conv = DecodeError_clone(&e_conv);
14264 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14265 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14266 return (uint64_t)ret_conv;
14269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14270 if ((_res & 1) != 0) return;
14271 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14273 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14277 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
14278 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14279 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
14280 return (uint64_t)ret_conv;
14283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14284 LDKUpdateAddHTLC o_conv;
14285 o_conv.inner = (void*)(o & (~1));
14286 o_conv.is_owned = (o & 1) || (o == 0);
14287 o_conv = UpdateAddHTLC_clone(&o_conv);
14288 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14289 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
14290 return (uint64_t)ret_conv;
14293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14294 LDKDecodeError e_conv;
14295 e_conv.inner = (void*)(e & (~1));
14296 e_conv.is_owned = (e & 1) || (e == 0);
14297 e_conv = DecodeError_clone(&e_conv);
14298 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14299 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
14300 return (uint64_t)ret_conv;
14303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14304 if ((_res & 1) != 0) return;
14305 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14307 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
14310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14311 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
14312 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14313 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
14314 return (uint64_t)ret_conv;
14317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14319 o_conv.inner = (void*)(o & (~1));
14320 o_conv.is_owned = (o & 1) || (o == 0);
14321 o_conv = Ping_clone(&o_conv);
14322 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14323 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
14324 return (uint64_t)ret_conv;
14327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14328 LDKDecodeError e_conv;
14329 e_conv.inner = (void*)(e & (~1));
14330 e_conv.is_owned = (e & 1) || (e == 0);
14331 e_conv = DecodeError_clone(&e_conv);
14332 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14333 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
14334 return (uint64_t)ret_conv;
14337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14338 if ((_res & 1) != 0) return;
14339 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
14341 CResult_PingDecodeErrorZ_free(_res_conv);
14344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14345 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
14346 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14347 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
14348 return (uint64_t)ret_conv;
14351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14353 o_conv.inner = (void*)(o & (~1));
14354 o_conv.is_owned = (o & 1) || (o == 0);
14355 o_conv = Pong_clone(&o_conv);
14356 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14357 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
14358 return (uint64_t)ret_conv;
14361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14362 LDKDecodeError e_conv;
14363 e_conv.inner = (void*)(e & (~1));
14364 e_conv.is_owned = (e & 1) || (e == 0);
14365 e_conv = DecodeError_clone(&e_conv);
14366 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14367 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
14368 return (uint64_t)ret_conv;
14371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14372 if ((_res & 1) != 0) return;
14373 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
14375 CResult_PongDecodeErrorZ_free(_res_conv);
14378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14379 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
14380 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14381 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
14382 return (uint64_t)ret_conv;
14385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14386 LDKUnsignedChannelAnnouncement o_conv;
14387 o_conv.inner = (void*)(o & (~1));
14388 o_conv.is_owned = (o & 1) || (o == 0);
14389 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
14390 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14391 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
14392 return (uint64_t)ret_conv;
14395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14396 LDKDecodeError e_conv;
14397 e_conv.inner = (void*)(e & (~1));
14398 e_conv.is_owned = (e & 1) || (e == 0);
14399 e_conv = DecodeError_clone(&e_conv);
14400 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14401 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
14402 return (uint64_t)ret_conv;
14405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14406 if ((_res & 1) != 0) return;
14407 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14409 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
14412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14413 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14414 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14415 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14416 return (uint64_t)ret_conv;
14419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14420 LDKChannelAnnouncement o_conv;
14421 o_conv.inner = (void*)(o & (~1));
14422 o_conv.is_owned = (o & 1) || (o == 0);
14423 o_conv = ChannelAnnouncement_clone(&o_conv);
14424 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14425 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
14426 return (uint64_t)ret_conv;
14429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14430 LDKDecodeError e_conv;
14431 e_conv.inner = (void*)(e & (~1));
14432 e_conv.is_owned = (e & 1) || (e == 0);
14433 e_conv = DecodeError_clone(&e_conv);
14434 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14435 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14436 return (uint64_t)ret_conv;
14439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14440 if ((_res & 1) != 0) return;
14441 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14443 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14447 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14448 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14449 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14450 return (uint64_t)ret_conv;
14453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14454 LDKUnsignedChannelUpdate o_conv;
14455 o_conv.inner = (void*)(o & (~1));
14456 o_conv.is_owned = (o & 1) || (o == 0);
14457 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14458 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14459 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14460 return (uint64_t)ret_conv;
14463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14464 LDKDecodeError e_conv;
14465 e_conv.inner = (void*)(e & (~1));
14466 e_conv.is_owned = (e & 1) || (e == 0);
14467 e_conv = DecodeError_clone(&e_conv);
14468 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14469 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14470 return (uint64_t)ret_conv;
14473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14474 if ((_res & 1) != 0) return;
14475 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
14477 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14481 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14482 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14483 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14484 return (uint64_t)ret_conv;
14487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14488 LDKChannelUpdate o_conv;
14489 o_conv.inner = (void*)(o & (~1));
14490 o_conv.is_owned = (o & 1) || (o == 0);
14491 o_conv = ChannelUpdate_clone(&o_conv);
14492 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14493 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14494 return (uint64_t)ret_conv;
14497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14498 LDKDecodeError e_conv;
14499 e_conv.inner = (void*)(e & (~1));
14500 e_conv.is_owned = (e & 1) || (e == 0);
14501 e_conv = DecodeError_clone(&e_conv);
14502 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14503 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14504 return (uint64_t)ret_conv;
14507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14508 if ((_res & 1) != 0) return;
14509 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
14511 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
14514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14515 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
14516 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14517 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
14518 return (uint64_t)ret_conv;
14521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14522 LDKErrorMessage o_conv;
14523 o_conv.inner = (void*)(o & (~1));
14524 o_conv.is_owned = (o & 1) || (o == 0);
14525 o_conv = ErrorMessage_clone(&o_conv);
14526 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14527 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
14528 return (uint64_t)ret_conv;
14531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14532 LDKDecodeError e_conv;
14533 e_conv.inner = (void*)(e & (~1));
14534 e_conv.is_owned = (e & 1) || (e == 0);
14535 e_conv = DecodeError_clone(&e_conv);
14536 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14537 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
14538 return (uint64_t)ret_conv;
14541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14542 if ((_res & 1) != 0) return;
14543 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
14545 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
14548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14549 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
14550 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14551 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
14552 return (uint64_t)ret_conv;
14555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14556 LDKUnsignedNodeAnnouncement o_conv;
14557 o_conv.inner = (void*)(o & (~1));
14558 o_conv.is_owned = (o & 1) || (o == 0);
14559 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
14560 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14561 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
14562 return (uint64_t)ret_conv;
14565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14566 LDKDecodeError e_conv;
14567 e_conv.inner = (void*)(e & (~1));
14568 e_conv.is_owned = (e & 1) || (e == 0);
14569 e_conv = DecodeError_clone(&e_conv);
14570 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14571 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
14572 return (uint64_t)ret_conv;
14575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14576 if ((_res & 1) != 0) return;
14577 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14579 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
14582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14583 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
14584 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14585 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
14586 return (uint64_t)ret_conv;
14589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14590 LDKNodeAnnouncement o_conv;
14591 o_conv.inner = (void*)(o & (~1));
14592 o_conv.is_owned = (o & 1) || (o == 0);
14593 o_conv = NodeAnnouncement_clone(&o_conv);
14594 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14595 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
14596 return (uint64_t)ret_conv;
14599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14600 LDKDecodeError e_conv;
14601 e_conv.inner = (void*)(e & (~1));
14602 e_conv.is_owned = (e & 1) || (e == 0);
14603 e_conv = DecodeError_clone(&e_conv);
14604 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14605 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
14606 return (uint64_t)ret_conv;
14609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14610 if ((_res & 1) != 0) return;
14611 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14613 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
14616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14617 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
14618 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14619 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
14620 return (uint64_t)ret_conv;
14623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14624 LDKQueryShortChannelIds o_conv;
14625 o_conv.inner = (void*)(o & (~1));
14626 o_conv.is_owned = (o & 1) || (o == 0);
14627 o_conv = QueryShortChannelIds_clone(&o_conv);
14628 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14629 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
14630 return (uint64_t)ret_conv;
14633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14634 LDKDecodeError e_conv;
14635 e_conv.inner = (void*)(e & (~1));
14636 e_conv.is_owned = (e & 1) || (e == 0);
14637 e_conv = DecodeError_clone(&e_conv);
14638 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14639 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
14640 return (uint64_t)ret_conv;
14643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14644 if ((_res & 1) != 0) return;
14645 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
14647 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
14650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14651 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
14652 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14653 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
14654 return (uint64_t)ret_conv;
14657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14658 LDKReplyShortChannelIdsEnd o_conv;
14659 o_conv.inner = (void*)(o & (~1));
14660 o_conv.is_owned = (o & 1) || (o == 0);
14661 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
14662 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14663 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
14664 return (uint64_t)ret_conv;
14667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14668 LDKDecodeError e_conv;
14669 e_conv.inner = (void*)(e & (~1));
14670 e_conv.is_owned = (e & 1) || (e == 0);
14671 e_conv = DecodeError_clone(&e_conv);
14672 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14673 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
14674 return (uint64_t)ret_conv;
14677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14678 if ((_res & 1) != 0) return;
14679 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
14681 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
14684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14685 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
14686 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14687 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
14688 return (uint64_t)ret_conv;
14691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14692 LDKQueryChannelRange o_conv;
14693 o_conv.inner = (void*)(o & (~1));
14694 o_conv.is_owned = (o & 1) || (o == 0);
14695 o_conv = QueryChannelRange_clone(&o_conv);
14696 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14697 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
14698 return (uint64_t)ret_conv;
14701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14702 LDKDecodeError e_conv;
14703 e_conv.inner = (void*)(e & (~1));
14704 e_conv.is_owned = (e & 1) || (e == 0);
14705 e_conv = DecodeError_clone(&e_conv);
14706 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14707 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
14708 return (uint64_t)ret_conv;
14711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14712 if ((_res & 1) != 0) return;
14713 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14715 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14719 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
14720 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14721 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
14722 return (uint64_t)ret_conv;
14725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14726 LDKReplyChannelRange o_conv;
14727 o_conv.inner = (void*)(o & (~1));
14728 o_conv.is_owned = (o & 1) || (o == 0);
14729 o_conv = ReplyChannelRange_clone(&o_conv);
14730 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14731 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
14732 return (uint64_t)ret_conv;
14735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14736 LDKDecodeError e_conv;
14737 e_conv.inner = (void*)(e & (~1));
14738 e_conv.is_owned = (e & 1) || (e == 0);
14739 e_conv = DecodeError_clone(&e_conv);
14740 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14741 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
14742 return (uint64_t)ret_conv;
14745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14746 if ((_res & 1) != 0) return;
14747 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14749 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
14752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14753 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
14754 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14755 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
14756 return (uint64_t)ret_conv;
14759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14760 LDKGossipTimestampFilter o_conv;
14761 o_conv.inner = (void*)(o & (~1));
14762 o_conv.is_owned = (o & 1) || (o == 0);
14763 o_conv = GossipTimestampFilter_clone(&o_conv);
14764 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14765 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
14766 return (uint64_t)ret_conv;
14769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14770 LDKDecodeError e_conv;
14771 e_conv.inner = (void*)(e & (~1));
14772 e_conv.is_owned = (e & 1) || (e == 0);
14773 e_conv = DecodeError_clone(&e_conv);
14774 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14775 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
14776 return (uint64_t)ret_conv;
14779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14780 if ((_res & 1) != 0) return;
14781 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
14783 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
14786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14787 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
14788 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14789 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
14790 return (uint64_t)ret_conv;
14793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14795 o_conv.inner = (void*)(o & (~1));
14796 o_conv.is_owned = (o & 1) || (o == 0);
14797 o_conv = Invoice_clone(&o_conv);
14798 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14799 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
14800 return (uint64_t)ret_conv;
14803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14804 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
14805 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
14806 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14807 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
14808 return (uint64_t)ret_conv;
14811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14812 if ((_res & 1) != 0) return;
14813 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
14815 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
14818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14819 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
14820 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14821 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
14822 return (uint64_t)ret_conv;
14825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14826 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
14827 if (o_conv.free == LDKFilter_JCalls_free) {
14828 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14829 LDKFilter_JCalls_cloned(&o_conv);
14831 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
14832 *ret_copy = COption_FilterZ_some(o_conv);
14833 uint64_t ret_ref = (uint64_t)ret_copy;
14837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
14838 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
14839 *ret_copy = COption_FilterZ_none();
14840 uint64_t ret_ref = (uint64_t)ret_copy;
14844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14845 if ((_res & 1) != 0) return;
14846 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
14848 COption_FilterZ_free(_res_conv);
14851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14852 if ((this_ptr & 1) != 0) return;
14853 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
14854 FREE((void*)this_ptr);
14855 PaymentPurpose_free(this_ptr_conv);
14858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14859 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
14860 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14861 *ret_copy = PaymentPurpose_clone(orig_conv);
14862 uint64_t ret_ref = (uint64_t)ret_copy;
14866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
14867 LDKThirtyTwoBytes payment_preimage_ref;
14868 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14869 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14870 LDKThirtyTwoBytes payment_secret_ref;
14871 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14872 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14873 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14874 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
14875 uint64_t ret_ref = (uint64_t)ret_copy;
14879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
14880 LDKThirtyTwoBytes a_ref;
14881 CHECK((*env)->GetArrayLength(env, a) == 32);
14882 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
14883 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14884 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
14885 uint64_t ret_ref = (uint64_t)ret_copy;
14889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14890 if ((this_ptr & 1) != 0) return;
14891 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
14892 FREE((void*)this_ptr);
14893 ClosureReason_free(this_ptr_conv);
14896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14897 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
14898 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14899 *ret_copy = ClosureReason_clone(orig_conv);
14900 uint64_t ret_ref = (uint64_t)ret_copy;
14904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
14905 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
14906 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14907 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
14908 uint64_t ret_ref = (uint64_t)ret_copy;
14912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
14913 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14914 *ret_copy = ClosureReason_holder_force_closed();
14915 uint64_t ret_ref = (uint64_t)ret_copy;
14919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
14920 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14921 *ret_copy = ClosureReason_cooperative_closure();
14922 uint64_t ret_ref = (uint64_t)ret_copy;
14926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
14927 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14928 *ret_copy = ClosureReason_commitment_tx_confirmed();
14929 uint64_t ret_ref = (uint64_t)ret_copy;
14933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
14934 LDKStr err_conv = java_to_owned_str(env, err);
14935 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14936 *ret_copy = ClosureReason_processing_error(err_conv);
14937 uint64_t ret_ref = (uint64_t)ret_copy;
14941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
14942 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14943 *ret_copy = ClosureReason_disconnected_peer();
14944 uint64_t ret_ref = (uint64_t)ret_copy;
14948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
14949 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14950 *ret_copy = ClosureReason_outdated_channel_manager();
14951 uint64_t ret_ref = (uint64_t)ret_copy;
14955 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
14956 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
14957 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
14958 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14959 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14960 CVec_u8Z_free(ret_var);
14964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14965 if ((this_ptr & 1) != 0) return;
14966 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
14967 FREE((void*)this_ptr);
14968 Event_free(this_ptr_conv);
14971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14972 LDKEvent* orig_conv = (LDKEvent*)orig;
14973 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14974 *ret_copy = Event_clone(orig_conv);
14975 uint64_t ret_ref = (uint64_t)ret_copy;
14979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
14980 LDKThirtyTwoBytes temporary_channel_id_ref;
14981 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
14982 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
14983 LDKCVec_u8Z output_script_ref;
14984 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
14985 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
14986 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
14987 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14988 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
14989 uint64_t ret_ref = (uint64_t)ret_copy;
14993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
14994 LDKThirtyTwoBytes payment_hash_ref;
14995 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14996 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14997 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
14998 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
14999 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15000 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
15001 uint64_t ret_ref = (uint64_t)ret_copy;
15005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) {
15006 LDKThirtyTwoBytes payment_preimage_ref;
15007 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15008 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15009 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15010 *ret_copy = Event_payment_sent(payment_preimage_ref);
15011 uint64_t ret_ref = (uint64_t)ret_copy;
15015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path) {
15016 LDKThirtyTwoBytes payment_hash_ref;
15017 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15018 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15019 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
15020 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
15021 LDKCVec_RouteHopZ path_constr;
15022 path_constr.datalen = (*env)->GetArrayLength(env, path);
15023 if (path_constr.datalen > 0)
15024 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15026 path_constr.data = NULL;
15027 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
15028 for (size_t k = 0; k < path_constr.datalen; k++) {
15029 int64_t path_conv_10 = path_vals[k];
15030 LDKRouteHop path_conv_10_conv;
15031 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
15032 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
15033 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
15034 path_constr.data[k] = path_conv_10_conv;
15036 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
15037 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15038 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
15039 uint64_t ret_ref = (uint64_t)ret_copy;
15043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
15044 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15045 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
15046 uint64_t ret_ref = (uint64_t)ret_copy;
15050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
15051 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
15052 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15053 if (outputs_constr.datalen > 0)
15054 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15056 outputs_constr.data = NULL;
15057 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15058 for (size_t b = 0; b < outputs_constr.datalen; b++) {
15059 int64_t outputs_conv_27 = outputs_vals[b];
15060 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
15061 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
15062 outputs_constr.data[b] = outputs_conv_27_conv;
15064 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15065 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15066 *ret_copy = Event_spendable_outputs(outputs_constr);
15067 uint64_t ret_ref = (uint64_t)ret_copy;
15071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
15072 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
15073 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
15074 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15075 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
15076 uint64_t ret_ref = (uint64_t)ret_copy;
15080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t reason) {
15081 LDKThirtyTwoBytes channel_id_ref;
15082 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15083 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
15084 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
15085 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
15086 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15087 *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
15088 uint64_t ret_ref = (uint64_t)ret_copy;
15092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
15093 LDKEvent* obj_conv = (LDKEvent*)obj;
15094 LDKCVec_u8Z ret_var = Event_write(obj_conv);
15095 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15096 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15097 CVec_u8Z_free(ret_var);
15101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15102 if ((this_ptr & 1) != 0) return;
15103 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
15104 FREE((void*)this_ptr);
15105 MessageSendEvent_free(this_ptr_conv);
15108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15109 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
15110 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15111 *ret_copy = MessageSendEvent_clone(orig_conv);
15112 uint64_t ret_ref = (uint64_t)ret_copy;
15116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15117 LDKPublicKey node_id_ref;
15118 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15119 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15120 LDKAcceptChannel msg_conv;
15121 msg_conv.inner = (void*)(msg & (~1));
15122 msg_conv.is_owned = (msg & 1) || (msg == 0);
15123 msg_conv = AcceptChannel_clone(&msg_conv);
15124 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15125 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
15126 uint64_t ret_ref = (uint64_t)ret_copy;
15130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15131 LDKPublicKey node_id_ref;
15132 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15133 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15134 LDKOpenChannel msg_conv;
15135 msg_conv.inner = (void*)(msg & (~1));
15136 msg_conv.is_owned = (msg & 1) || (msg == 0);
15137 msg_conv = OpenChannel_clone(&msg_conv);
15138 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15139 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
15140 uint64_t ret_ref = (uint64_t)ret_copy;
15144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15145 LDKPublicKey node_id_ref;
15146 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15147 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15148 LDKFundingCreated msg_conv;
15149 msg_conv.inner = (void*)(msg & (~1));
15150 msg_conv.is_owned = (msg & 1) || (msg == 0);
15151 msg_conv = FundingCreated_clone(&msg_conv);
15152 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15153 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
15154 uint64_t ret_ref = (uint64_t)ret_copy;
15158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15159 LDKPublicKey node_id_ref;
15160 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15161 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15162 LDKFundingSigned msg_conv;
15163 msg_conv.inner = (void*)(msg & (~1));
15164 msg_conv.is_owned = (msg & 1) || (msg == 0);
15165 msg_conv = FundingSigned_clone(&msg_conv);
15166 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15167 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
15168 uint64_t ret_ref = (uint64_t)ret_copy;
15172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15173 LDKPublicKey node_id_ref;
15174 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15175 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15176 LDKFundingLocked msg_conv;
15177 msg_conv.inner = (void*)(msg & (~1));
15178 msg_conv.is_owned = (msg & 1) || (msg == 0);
15179 msg_conv = FundingLocked_clone(&msg_conv);
15180 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15181 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
15182 uint64_t ret_ref = (uint64_t)ret_copy;
15186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15187 LDKPublicKey node_id_ref;
15188 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15189 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15190 LDKAnnouncementSignatures msg_conv;
15191 msg_conv.inner = (void*)(msg & (~1));
15192 msg_conv.is_owned = (msg & 1) || (msg == 0);
15193 msg_conv = AnnouncementSignatures_clone(&msg_conv);
15194 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15195 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
15196 uint64_t ret_ref = (uint64_t)ret_copy;
15200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
15201 LDKPublicKey node_id_ref;
15202 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15203 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15204 LDKCommitmentUpdate updates_conv;
15205 updates_conv.inner = (void*)(updates & (~1));
15206 updates_conv.is_owned = (updates & 1) || (updates == 0);
15207 updates_conv = CommitmentUpdate_clone(&updates_conv);
15208 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15209 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
15210 uint64_t ret_ref = (uint64_t)ret_copy;
15214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15215 LDKPublicKey node_id_ref;
15216 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15217 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15218 LDKRevokeAndACK msg_conv;
15219 msg_conv.inner = (void*)(msg & (~1));
15220 msg_conv.is_owned = (msg & 1) || (msg == 0);
15221 msg_conv = RevokeAndACK_clone(&msg_conv);
15222 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15223 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
15224 uint64_t ret_ref = (uint64_t)ret_copy;
15228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15229 LDKPublicKey node_id_ref;
15230 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15231 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15232 LDKClosingSigned msg_conv;
15233 msg_conv.inner = (void*)(msg & (~1));
15234 msg_conv.is_owned = (msg & 1) || (msg == 0);
15235 msg_conv = ClosingSigned_clone(&msg_conv);
15236 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15237 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
15238 uint64_t ret_ref = (uint64_t)ret_copy;
15242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15243 LDKPublicKey node_id_ref;
15244 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15245 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15246 LDKShutdown msg_conv;
15247 msg_conv.inner = (void*)(msg & (~1));
15248 msg_conv.is_owned = (msg & 1) || (msg == 0);
15249 msg_conv = Shutdown_clone(&msg_conv);
15250 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15251 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
15252 uint64_t ret_ref = (uint64_t)ret_copy;
15256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15257 LDKPublicKey node_id_ref;
15258 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15259 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15260 LDKChannelReestablish msg_conv;
15261 msg_conv.inner = (void*)(msg & (~1));
15262 msg_conv.is_owned = (msg & 1) || (msg == 0);
15263 msg_conv = ChannelReestablish_clone(&msg_conv);
15264 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15265 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
15266 uint64_t ret_ref = (uint64_t)ret_copy;
15270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
15271 LDKChannelAnnouncement msg_conv;
15272 msg_conv.inner = (void*)(msg & (~1));
15273 msg_conv.is_owned = (msg & 1) || (msg == 0);
15274 msg_conv = ChannelAnnouncement_clone(&msg_conv);
15275 LDKChannelUpdate update_msg_conv;
15276 update_msg_conv.inner = (void*)(update_msg & (~1));
15277 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
15278 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
15279 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15280 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
15281 uint64_t ret_ref = (uint64_t)ret_copy;
15285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
15286 LDKNodeAnnouncement msg_conv;
15287 msg_conv.inner = (void*)(msg & (~1));
15288 msg_conv.is_owned = (msg & 1) || (msg == 0);
15289 msg_conv = NodeAnnouncement_clone(&msg_conv);
15290 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15291 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
15292 uint64_t ret_ref = (uint64_t)ret_copy;
15296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
15297 LDKChannelUpdate msg_conv;
15298 msg_conv.inner = (void*)(msg & (~1));
15299 msg_conv.is_owned = (msg & 1) || (msg == 0);
15300 msg_conv = ChannelUpdate_clone(&msg_conv);
15301 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15302 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
15303 uint64_t ret_ref = (uint64_t)ret_copy;
15307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15308 LDKPublicKey node_id_ref;
15309 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15310 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15311 LDKChannelUpdate msg_conv;
15312 msg_conv.inner = (void*)(msg & (~1));
15313 msg_conv.is_owned = (msg & 1) || (msg == 0);
15314 msg_conv = ChannelUpdate_clone(&msg_conv);
15315 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15316 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
15317 uint64_t ret_ref = (uint64_t)ret_copy;
15321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
15322 LDKPublicKey node_id_ref;
15323 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15324 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15325 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
15326 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
15327 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15328 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
15329 uint64_t ret_ref = (uint64_t)ret_copy;
15333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15334 LDKPublicKey node_id_ref;
15335 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15336 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15337 LDKQueryChannelRange msg_conv;
15338 msg_conv.inner = (void*)(msg & (~1));
15339 msg_conv.is_owned = (msg & 1) || (msg == 0);
15340 msg_conv = QueryChannelRange_clone(&msg_conv);
15341 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15342 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
15343 uint64_t ret_ref = (uint64_t)ret_copy;
15347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15348 LDKPublicKey node_id_ref;
15349 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15350 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15351 LDKQueryShortChannelIds msg_conv;
15352 msg_conv.inner = (void*)(msg & (~1));
15353 msg_conv.is_owned = (msg & 1) || (msg == 0);
15354 msg_conv = QueryShortChannelIds_clone(&msg_conv);
15355 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15356 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
15357 uint64_t ret_ref = (uint64_t)ret_copy;
15361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15362 LDKPublicKey node_id_ref;
15363 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15364 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15365 LDKReplyChannelRange msg_conv;
15366 msg_conv.inner = (void*)(msg & (~1));
15367 msg_conv.is_owned = (msg & 1) || (msg == 0);
15368 msg_conv = ReplyChannelRange_clone(&msg_conv);
15369 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15370 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
15371 uint64_t ret_ref = (uint64_t)ret_copy;
15375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15376 if ((this_ptr & 1) != 0) return;
15377 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
15378 FREE((void*)this_ptr);
15379 MessageSendEventsProvider_free(this_ptr_conv);
15382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15383 if ((this_ptr & 1) != 0) return;
15384 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
15385 FREE((void*)this_ptr);
15386 EventsProvider_free(this_ptr_conv);
15389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15390 if ((this_ptr & 1) != 0) return;
15391 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
15392 FREE((void*)this_ptr);
15393 EventHandler_free(this_ptr_conv);
15396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15397 if ((this_ptr & 1) != 0) return;
15398 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
15399 FREE((void*)this_ptr);
15400 APIError_free(this_ptr_conv);
15403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15404 LDKAPIError* orig_conv = (LDKAPIError*)orig;
15405 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15406 *ret_copy = APIError_clone(orig_conv);
15407 uint64_t ret_ref = (uint64_t)ret_copy;
15411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
15412 LDKStr err_conv = java_to_owned_str(env, err);
15413 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15414 *ret_copy = APIError_apimisuse_error(err_conv);
15415 uint64_t ret_ref = (uint64_t)ret_copy;
15419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
15420 LDKStr err_conv = java_to_owned_str(env, err);
15421 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15422 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
15423 uint64_t ret_ref = (uint64_t)ret_copy;
15427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
15428 LDKStr err_conv = java_to_owned_str(env, err);
15429 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15430 *ret_copy = APIError_route_error(err_conv);
15431 uint64_t ret_ref = (uint64_t)ret_copy;
15435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
15436 LDKStr err_conv = java_to_owned_str(env, err);
15437 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15438 *ret_copy = APIError_channel_unavailable(err_conv);
15439 uint64_t ret_ref = (uint64_t)ret_copy;
15443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
15444 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15445 *ret_copy = APIError_monitor_update_failed();
15446 uint64_t ret_ref = (uint64_t)ret_copy;
15450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
15451 LDKShutdownScript script_conv;
15452 script_conv.inner = (void*)(script & (~1));
15453 script_conv.is_owned = (script & 1) || (script == 0);
15454 script_conv = ShutdownScript_clone(&script_conv);
15455 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15456 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
15457 uint64_t ret_ref = (uint64_t)ret_copy;
15461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
15462 LDKu8slice msg_ref;
15463 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15464 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15465 unsigned char sk_arr[32];
15466 CHECK((*env)->GetArrayLength(env, sk) == 32);
15467 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
15468 unsigned char (*sk_ref)[32] = &sk_arr;
15469 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
15470 *ret_conv = sign(msg_ref, sk_ref);
15471 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15472 return (uint64_t)ret_conv;
15475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
15476 LDKu8slice msg_ref;
15477 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15478 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15479 LDKStr sig_conv = java_to_owned_str(env, sig);
15480 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15481 *ret_conv = recover_pk(msg_ref, sig_conv);
15482 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15483 return (uint64_t)ret_conv;
15486 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
15487 LDKu8slice msg_ref;
15488 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15489 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15490 LDKStr sig_conv = java_to_owned_str(env, sig);
15491 LDKPublicKey pk_ref;
15492 CHECK((*env)->GetArrayLength(env, pk) == 33);
15493 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
15494 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
15495 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15499 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15500 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
15501 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
15505 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
15506 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
15510 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
15511 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
15515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
15516 jclass ret_conv = LDKLevel_to_java(env, Level_info());
15520 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
15521 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
15525 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
15526 jclass ret_conv = LDKLevel_to_java(env, Level_error());
15530 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
15531 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
15532 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
15533 jboolean ret_val = Level_eq(a_conv, b_conv);
15537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
15538 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
15539 int64_t ret_val = Level_hash(o_conv);
15543 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
15544 jclass ret_conv = LDKLevel_to_java(env, Level_max());
15548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15549 if ((this_ptr & 1) != 0) return;
15550 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
15551 FREE((void*)this_ptr);
15552 Logger_free(this_ptr_conv);
15555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15556 LDKChannelHandshakeConfig this_obj_conv;
15557 this_obj_conv.inner = (void*)(this_obj & (~1));
15558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15559 ChannelHandshakeConfig_free(this_obj_conv);
15562 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
15563 LDKChannelHandshakeConfig this_ptr_conv;
15564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15565 this_ptr_conv.is_owned = false;
15566 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
15570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15571 LDKChannelHandshakeConfig this_ptr_conv;
15572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15573 this_ptr_conv.is_owned = false;
15574 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
15577 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15578 LDKChannelHandshakeConfig this_ptr_conv;
15579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15580 this_ptr_conv.is_owned = false;
15581 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
15585 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) {
15586 LDKChannelHandshakeConfig this_ptr_conv;
15587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15588 this_ptr_conv.is_owned = false;
15589 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
15592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15593 LDKChannelHandshakeConfig this_ptr_conv;
15594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15595 this_ptr_conv.is_owned = false;
15596 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
15600 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) {
15601 LDKChannelHandshakeConfig this_ptr_conv;
15602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15603 this_ptr_conv.is_owned = false;
15604 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
15607 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) {
15608 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
15609 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15610 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15611 uint64_t ret_ref = (uint64_t)ret_var.inner;
15612 if (ret_var.is_owned) {
15618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15619 LDKChannelHandshakeConfig orig_conv;
15620 orig_conv.inner = (void*)(orig & (~1));
15621 orig_conv.is_owned = false;
15622 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
15623 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15624 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15625 uint64_t ret_ref = (uint64_t)ret_var.inner;
15626 if (ret_var.is_owned) {
15632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
15633 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
15634 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15635 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15636 uint64_t ret_ref = (uint64_t)ret_var.inner;
15637 if (ret_var.is_owned) {
15643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15644 LDKChannelHandshakeLimits this_obj_conv;
15645 this_obj_conv.inner = (void*)(this_obj & (~1));
15646 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15647 ChannelHandshakeLimits_free(this_obj_conv);
15650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15651 LDKChannelHandshakeLimits this_ptr_conv;
15652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15653 this_ptr_conv.is_owned = false;
15654 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
15658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15659 LDKChannelHandshakeLimits this_ptr_conv;
15660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15661 this_ptr_conv.is_owned = false;
15662 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
15665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15666 LDKChannelHandshakeLimits this_ptr_conv;
15667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15668 this_ptr_conv.is_owned = false;
15669 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
15673 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) {
15674 LDKChannelHandshakeLimits this_ptr_conv;
15675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15676 this_ptr_conv.is_owned = false;
15677 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
15680 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) {
15681 LDKChannelHandshakeLimits this_ptr_conv;
15682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15683 this_ptr_conv.is_owned = false;
15684 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
15688 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) {
15689 LDKChannelHandshakeLimits this_ptr_conv;
15690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15691 this_ptr_conv.is_owned = false;
15692 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
15695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15696 LDKChannelHandshakeLimits this_ptr_conv;
15697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15698 this_ptr_conv.is_owned = false;
15699 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
15703 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) {
15704 LDKChannelHandshakeLimits this_ptr_conv;
15705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15706 this_ptr_conv.is_owned = false;
15707 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
15710 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
15711 LDKChannelHandshakeLimits this_ptr_conv;
15712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15713 this_ptr_conv.is_owned = false;
15714 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
15718 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) {
15719 LDKChannelHandshakeLimits this_ptr_conv;
15720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15721 this_ptr_conv.is_owned = false;
15722 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
15725 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
15726 LDKChannelHandshakeLimits this_ptr_conv;
15727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15728 this_ptr_conv.is_owned = false;
15729 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
15733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15734 LDKChannelHandshakeLimits this_ptr_conv;
15735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15736 this_ptr_conv.is_owned = false;
15737 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
15740 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
15741 LDKChannelHandshakeLimits this_ptr_conv;
15742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15743 this_ptr_conv.is_owned = false;
15744 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
15748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15749 LDKChannelHandshakeLimits this_ptr_conv;
15750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15751 this_ptr_conv.is_owned = false;
15752 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
15755 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15756 LDKChannelHandshakeLimits this_ptr_conv;
15757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15758 this_ptr_conv.is_owned = false;
15759 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
15763 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) {
15764 LDKChannelHandshakeLimits this_ptr_conv;
15765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15766 this_ptr_conv.is_owned = false;
15767 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
15770 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) {
15771 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);
15772 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15773 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15774 uint64_t ret_ref = (uint64_t)ret_var.inner;
15775 if (ret_var.is_owned) {
15781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15782 LDKChannelHandshakeLimits orig_conv;
15783 orig_conv.inner = (void*)(orig & (~1));
15784 orig_conv.is_owned = false;
15785 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
15786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15788 uint64_t ret_ref = (uint64_t)ret_var.inner;
15789 if (ret_var.is_owned) {
15795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
15796 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
15797 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15798 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15799 uint64_t ret_ref = (uint64_t)ret_var.inner;
15800 if (ret_var.is_owned) {
15806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15807 LDKChannelConfig this_obj_conv;
15808 this_obj_conv.inner = (void*)(this_obj & (~1));
15809 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15810 ChannelConfig_free(this_obj_conv);
15813 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
15814 LDKChannelConfig this_ptr_conv;
15815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15816 this_ptr_conv.is_owned = false;
15817 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
15821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15822 LDKChannelConfig this_ptr_conv;
15823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15824 this_ptr_conv.is_owned = false;
15825 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
15828 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15829 LDKChannelConfig this_ptr_conv;
15830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15831 this_ptr_conv.is_owned = false;
15832 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
15836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15837 LDKChannelConfig this_ptr_conv;
15838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15839 this_ptr_conv.is_owned = false;
15840 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
15843 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15844 LDKChannelConfig this_ptr_conv;
15845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15846 this_ptr_conv.is_owned = false;
15847 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
15851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15852 LDKChannelConfig this_ptr_conv;
15853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15854 this_ptr_conv.is_owned = false;
15855 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
15858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
15859 LDKChannelConfig this_ptr_conv;
15860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15861 this_ptr_conv.is_owned = false;
15862 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
15866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15867 LDKChannelConfig this_ptr_conv;
15868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15869 this_ptr_conv.is_owned = false;
15870 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
15873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15874 LDKChannelConfig this_ptr_conv;
15875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15876 this_ptr_conv.is_owned = false;
15877 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
15881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15882 LDKChannelConfig this_ptr_conv;
15883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15884 this_ptr_conv.is_owned = false;
15885 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
15888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15889 LDKChannelConfig this_ptr_conv;
15890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15891 this_ptr_conv.is_owned = false;
15892 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
15896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15897 LDKChannelConfig this_ptr_conv;
15898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15899 this_ptr_conv.is_owned = false;
15900 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
15903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15904 LDKChannelConfig this_ptr_conv;
15905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15906 this_ptr_conv.is_owned = false;
15907 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
15911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15912 LDKChannelConfig this_ptr_conv;
15913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15914 this_ptr_conv.is_owned = false;
15915 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
15918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
15919 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
15920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15922 uint64_t ret_ref = (uint64_t)ret_var.inner;
15923 if (ret_var.is_owned) {
15929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15930 LDKChannelConfig orig_conv;
15931 orig_conv.inner = (void*)(orig & (~1));
15932 orig_conv.is_owned = false;
15933 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
15934 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15935 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15936 uint64_t ret_ref = (uint64_t)ret_var.inner;
15937 if (ret_var.is_owned) {
15943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
15944 LDKChannelConfig ret_var = ChannelConfig_default();
15945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15947 uint64_t ret_ref = (uint64_t)ret_var.inner;
15948 if (ret_var.is_owned) {
15954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
15955 LDKChannelConfig obj_conv;
15956 obj_conv.inner = (void*)(obj & (~1));
15957 obj_conv.is_owned = false;
15958 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
15959 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15960 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15961 CVec_u8Z_free(ret_var);
15965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15966 LDKu8slice ser_ref;
15967 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15968 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15969 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15970 *ret_conv = ChannelConfig_read(ser_ref);
15971 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15972 return (uint64_t)ret_conv;
15975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15976 LDKUserConfig this_obj_conv;
15977 this_obj_conv.inner = (void*)(this_obj & (~1));
15978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15979 UserConfig_free(this_obj_conv);
15982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
15983 LDKUserConfig this_ptr_conv;
15984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15985 this_ptr_conv.is_owned = false;
15986 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
15987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15989 uint64_t ret_ref = (uint64_t)ret_var.inner;
15990 if (ret_var.is_owned) {
15996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15997 LDKUserConfig this_ptr_conv;
15998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15999 this_ptr_conv.is_owned = false;
16000 LDKChannelHandshakeConfig val_conv;
16001 val_conv.inner = (void*)(val & (~1));
16002 val_conv.is_owned = (val & 1) || (val == 0);
16003 val_conv = ChannelHandshakeConfig_clone(&val_conv);
16004 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
16007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
16008 LDKUserConfig this_ptr_conv;
16009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16010 this_ptr_conv.is_owned = false;
16011 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
16012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16014 uint64_t ret_ref = (uint64_t)ret_var.inner;
16015 if (ret_var.is_owned) {
16021 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) {
16022 LDKUserConfig this_ptr_conv;
16023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16024 this_ptr_conv.is_owned = false;
16025 LDKChannelHandshakeLimits val_conv;
16026 val_conv.inner = (void*)(val & (~1));
16027 val_conv.is_owned = (val & 1) || (val == 0);
16028 val_conv = ChannelHandshakeLimits_clone(&val_conv);
16029 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
16032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
16033 LDKUserConfig this_ptr_conv;
16034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16035 this_ptr_conv.is_owned = false;
16036 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
16037 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16038 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16039 uint64_t ret_ref = (uint64_t)ret_var.inner;
16040 if (ret_var.is_owned) {
16046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16047 LDKUserConfig this_ptr_conv;
16048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16049 this_ptr_conv.is_owned = false;
16050 LDKChannelConfig val_conv;
16051 val_conv.inner = (void*)(val & (~1));
16052 val_conv.is_owned = (val & 1) || (val == 0);
16053 val_conv = ChannelConfig_clone(&val_conv);
16054 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
16057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
16058 LDKUserConfig this_ptr_conv;
16059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16060 this_ptr_conv.is_owned = false;
16061 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
16065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16066 LDKUserConfig this_ptr_conv;
16067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16068 this_ptr_conv.is_owned = false;
16069 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
16072 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, jboolean accept_forwards_to_priv_channels_arg) {
16073 LDKChannelHandshakeConfig own_channel_config_arg_conv;
16074 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
16075 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
16076 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
16077 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
16078 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
16079 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
16080 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
16081 LDKChannelConfig channel_options_arg_conv;
16082 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
16083 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
16084 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
16085 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg);
16086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16088 uint64_t ret_ref = (uint64_t)ret_var.inner;
16089 if (ret_var.is_owned) {
16095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16096 LDKUserConfig orig_conv;
16097 orig_conv.inner = (void*)(orig & (~1));
16098 orig_conv.is_owned = false;
16099 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
16100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16102 uint64_t ret_ref = (uint64_t)ret_var.inner;
16103 if (ret_var.is_owned) {
16109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
16110 LDKUserConfig ret_var = UserConfig_default();
16111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16113 uint64_t ret_ref = (uint64_t)ret_var.inner;
16114 if (ret_var.is_owned) {
16120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16121 LDKBestBlock this_obj_conv;
16122 this_obj_conv.inner = (void*)(this_obj & (~1));
16123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16124 BestBlock_free(this_obj_conv);
16127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16128 LDKBestBlock orig_conv;
16129 orig_conv.inner = (void*)(orig & (~1));
16130 orig_conv.is_owned = false;
16131 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
16132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16134 uint64_t ret_ref = (uint64_t)ret_var.inner;
16135 if (ret_var.is_owned) {
16141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
16142 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
16143 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
16144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16146 uint64_t ret_ref = (uint64_t)ret_var.inner;
16147 if (ret_var.is_owned) {
16153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
16154 LDKThirtyTwoBytes block_hash_ref;
16155 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
16156 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
16157 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
16158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16160 uint64_t ret_ref = (uint64_t)ret_var.inner;
16161 if (ret_var.is_owned) {
16167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
16168 LDKBestBlock this_arg_conv;
16169 this_arg_conv.inner = (void*)(this_arg & (~1));
16170 this_arg_conv.is_owned = false;
16171 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16172 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
16176 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
16177 LDKBestBlock this_arg_conv;
16178 this_arg_conv.inner = (void*)(this_arg & (~1));
16179 this_arg_conv.is_owned = false;
16180 int32_t ret_val = BestBlock_height(&this_arg_conv);
16184 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16185 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
16186 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
16190 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
16191 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
16195 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
16196 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
16200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16201 if ((this_ptr & 1) != 0) return;
16202 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
16203 FREE((void*)this_ptr);
16204 Access_free(this_ptr_conv);
16207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16208 if ((this_ptr & 1) != 0) return;
16209 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
16210 FREE((void*)this_ptr);
16211 Listen_free(this_ptr_conv);
16214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16215 if ((this_ptr & 1) != 0) return;
16216 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
16217 FREE((void*)this_ptr);
16218 Confirm_free(this_ptr_conv);
16221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16222 if ((this_ptr & 1) != 0) return;
16223 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
16224 FREE((void*)this_ptr);
16225 Watch_free(this_ptr_conv);
16228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16229 if ((this_ptr & 1) != 0) return;
16230 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
16231 FREE((void*)this_ptr);
16232 Filter_free(this_ptr_conv);
16235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16236 LDKWatchedOutput this_obj_conv;
16237 this_obj_conv.inner = (void*)(this_obj & (~1));
16238 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16239 WatchedOutput_free(this_obj_conv);
16242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16243 LDKWatchedOutput this_ptr_conv;
16244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16245 this_ptr_conv.is_owned = false;
16246 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16247 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
16251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16252 LDKWatchedOutput this_ptr_conv;
16253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16254 this_ptr_conv.is_owned = false;
16255 LDKThirtyTwoBytes val_ref;
16256 CHECK((*env)->GetArrayLength(env, val) == 32);
16257 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16258 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
16261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16262 LDKWatchedOutput this_ptr_conv;
16263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16264 this_ptr_conv.is_owned = false;
16265 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
16266 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16267 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16268 uint64_t ret_ref = (uint64_t)ret_var.inner;
16269 if (ret_var.is_owned) {
16275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16276 LDKWatchedOutput this_ptr_conv;
16277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16278 this_ptr_conv.is_owned = false;
16279 LDKOutPoint val_conv;
16280 val_conv.inner = (void*)(val & (~1));
16281 val_conv.is_owned = (val & 1) || (val == 0);
16282 val_conv = OutPoint_clone(&val_conv);
16283 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
16286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16287 LDKWatchedOutput this_ptr_conv;
16288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16289 this_ptr_conv.is_owned = false;
16290 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
16291 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16292 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16297 LDKWatchedOutput this_ptr_conv;
16298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16299 this_ptr_conv.is_owned = false;
16300 LDKCVec_u8Z val_ref;
16301 val_ref.datalen = (*env)->GetArrayLength(env, val);
16302 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
16303 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
16304 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
16307 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) {
16308 LDKThirtyTwoBytes block_hash_arg_ref;
16309 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
16310 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
16311 LDKOutPoint outpoint_arg_conv;
16312 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16313 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16314 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16315 LDKCVec_u8Z script_pubkey_arg_ref;
16316 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
16317 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16318 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
16319 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
16320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16322 uint64_t ret_ref = (uint64_t)ret_var.inner;
16323 if (ret_var.is_owned) {
16329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16330 LDKWatchedOutput orig_conv;
16331 orig_conv.inner = (void*)(orig & (~1));
16332 orig_conv.is_owned = false;
16333 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
16334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16336 uint64_t ret_ref = (uint64_t)ret_var.inner;
16337 if (ret_var.is_owned) {
16343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
16344 LDKWatchedOutput o_conv;
16345 o_conv.inner = (void*)(o & (~1));
16346 o_conv.is_owned = false;
16347 int64_t ret_val = WatchedOutput_hash(&o_conv);
16351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16352 if ((this_ptr & 1) != 0) return;
16353 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
16354 FREE((void*)this_ptr);
16355 BroadcasterInterface_free(this_ptr_conv);
16358 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16359 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
16360 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
16364 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
16365 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
16369 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
16370 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
16374 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
16375 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
16379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16380 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
16381 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
16382 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
16386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16387 if ((this_ptr & 1) != 0) return;
16388 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
16389 FREE((void*)this_ptr);
16390 FeeEstimator_free(this_ptr_conv);
16393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16394 LDKChainMonitor this_obj_conv;
16395 this_obj_conv.inner = (void*)(this_obj & (~1));
16396 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16397 ChainMonitor_free(this_obj_conv);
16400 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) {
16401 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
16402 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
16403 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
16404 // Manually implement clone for Java trait instances
16405 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
16406 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16407 LDKFilter_JCalls_cloned(&chain_source_conv.some);
16410 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16411 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16412 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16413 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16415 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16416 if (logger_conv.free == LDKLogger_JCalls_free) {
16417 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16418 LDKLogger_JCalls_cloned(&logger_conv);
16420 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
16421 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
16422 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16423 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
16425 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
16426 if (persister_conv.free == LDKPersist_JCalls_free) {
16427 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16428 LDKPersist_JCalls_cloned(&persister_conv);
16430 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
16431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16433 uint64_t ret_ref = (uint64_t)ret_var.inner;
16434 if (ret_var.is_owned) {
16440 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
16441 LDKChainMonitor this_arg_conv;
16442 this_arg_conv.inner = (void*)(this_arg & (~1));
16443 this_arg_conv.is_owned = false;
16444 LDKCVec_ChannelDetailsZ ignored_channels_constr;
16445 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
16446 if (ignored_channels_constr.datalen > 0)
16447 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16449 ignored_channels_constr.data = NULL;
16450 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
16451 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
16452 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
16453 LDKChannelDetails ignored_channels_conv_16_conv;
16454 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
16455 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
16456 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
16457 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
16459 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
16460 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
16461 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16462 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16463 for (size_t j = 0; j < ret_var.datalen; j++) {
16464 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16465 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
16466 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
16467 ret_arr_ptr[j] = ret_conv_9_ref;
16469 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16470 FREE(ret_var.data);
16474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
16475 LDKChainMonitor this_arg_conv;
16476 this_arg_conv.inner = (void*)(this_arg & (~1));
16477 this_arg_conv.is_owned = false;
16478 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
16479 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
16480 return (uint64_t)ret_ret;
16483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
16484 LDKChainMonitor this_arg_conv;
16485 this_arg_conv.inner = (void*)(this_arg & (~1));
16486 this_arg_conv.is_owned = false;
16487 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16488 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
16489 return (uint64_t)ret_ret;
16492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
16493 LDKChainMonitor this_arg_conv;
16494 this_arg_conv.inner = (void*)(this_arg & (~1));
16495 this_arg_conv.is_owned = false;
16496 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
16497 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
16498 return (uint64_t)ret_ret;
16501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16502 LDKChainMonitor this_arg_conv;
16503 this_arg_conv.inner = (void*)(this_arg & (~1));
16504 this_arg_conv.is_owned = false;
16505 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16506 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
16507 return (uint64_t)ret_ret;
16510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16511 LDKChannelMonitorUpdate this_obj_conv;
16512 this_obj_conv.inner = (void*)(this_obj & (~1));
16513 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16514 ChannelMonitorUpdate_free(this_obj_conv);
16517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16518 LDKChannelMonitorUpdate this_ptr_conv;
16519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16520 this_ptr_conv.is_owned = false;
16521 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
16525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16526 LDKChannelMonitorUpdate this_ptr_conv;
16527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16528 this_ptr_conv.is_owned = false;
16529 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
16532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16533 LDKChannelMonitorUpdate orig_conv;
16534 orig_conv.inner = (void*)(orig & (~1));
16535 orig_conv.is_owned = false;
16536 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
16537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16539 uint64_t ret_ref = (uint64_t)ret_var.inner;
16540 if (ret_var.is_owned) {
16546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16547 LDKChannelMonitorUpdate obj_conv;
16548 obj_conv.inner = (void*)(obj & (~1));
16549 obj_conv.is_owned = false;
16550 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
16551 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16552 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16553 CVec_u8Z_free(ret_var);
16557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16558 LDKu8slice ser_ref;
16559 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16560 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16561 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16562 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
16563 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16564 return (uint64_t)ret_conv;
16567 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16568 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
16569 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
16573 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
16574 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
16578 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
16579 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
16583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16584 LDKMonitorUpdateError this_obj_conv;
16585 this_obj_conv.inner = (void*)(this_obj & (~1));
16586 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16587 MonitorUpdateError_free(this_obj_conv);
16590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16591 LDKMonitorUpdateError orig_conv;
16592 orig_conv.inner = (void*)(orig & (~1));
16593 orig_conv.is_owned = false;
16594 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
16595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16597 uint64_t ret_ref = (uint64_t)ret_var.inner;
16598 if (ret_var.is_owned) {
16604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16605 if ((this_ptr & 1) != 0) return;
16606 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
16607 FREE((void*)this_ptr);
16608 MonitorEvent_free(this_ptr_conv);
16611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16612 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
16613 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16614 *ret_copy = MonitorEvent_clone(orig_conv);
16615 uint64_t ret_ref = (uint64_t)ret_copy;
16619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
16620 LDKHTLCUpdate a_conv;
16621 a_conv.inner = (void*)(a & (~1));
16622 a_conv.is_owned = (a & 1) || (a == 0);
16623 a_conv = HTLCUpdate_clone(&a_conv);
16624 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16625 *ret_copy = MonitorEvent_htlcevent(a_conv);
16626 uint64_t ret_ref = (uint64_t)ret_copy;
16630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
16631 LDKOutPoint a_conv;
16632 a_conv.inner = (void*)(a & (~1));
16633 a_conv.is_owned = (a & 1) || (a == 0);
16634 a_conv = OutPoint_clone(&a_conv);
16635 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16636 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
16637 uint64_t ret_ref = (uint64_t)ret_copy;
16641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16642 LDKHTLCUpdate this_obj_conv;
16643 this_obj_conv.inner = (void*)(this_obj & (~1));
16644 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16645 HTLCUpdate_free(this_obj_conv);
16648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16649 LDKHTLCUpdate orig_conv;
16650 orig_conv.inner = (void*)(orig & (~1));
16651 orig_conv.is_owned = false;
16652 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
16653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16655 uint64_t ret_ref = (uint64_t)ret_var.inner;
16656 if (ret_var.is_owned) {
16662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16663 LDKHTLCUpdate obj_conv;
16664 obj_conv.inner = (void*)(obj & (~1));
16665 obj_conv.is_owned = false;
16666 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
16667 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16668 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16669 CVec_u8Z_free(ret_var);
16673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16674 LDKu8slice ser_ref;
16675 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16676 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16677 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16678 *ret_conv = HTLCUpdate_read(ser_ref);
16679 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16680 return (uint64_t)ret_conv;
16683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16684 if ((this_ptr & 1) != 0) return;
16685 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
16686 FREE((void*)this_ptr);
16687 Balance_free(this_ptr_conv);
16690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16691 LDKBalance* orig_conv = (LDKBalance*)orig;
16692 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16693 *ret_copy = Balance_clone(orig_conv);
16694 uint64_t ret_ref = (uint64_t)ret_copy;
16698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
16699 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16700 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
16701 uint64_t ret_ref = (uint64_t)ret_copy;
16705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
16706 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16707 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
16708 uint64_t ret_ref = (uint64_t)ret_copy;
16712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
16713 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16714 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
16715 uint64_t ret_ref = (uint64_t)ret_copy;
16719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
16720 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16721 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
16722 uint64_t ret_ref = (uint64_t)ret_copy;
16726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16727 LDKBalance* a_conv = (LDKBalance*)a;
16728 LDKBalance* b_conv = (LDKBalance*)b;
16729 jboolean ret_val = Balance_eq(a_conv, b_conv);
16733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16734 LDKChannelMonitor this_obj_conv;
16735 this_obj_conv.inner = (void*)(this_obj & (~1));
16736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16737 ChannelMonitor_free(this_obj_conv);
16740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16741 LDKChannelMonitor orig_conv;
16742 orig_conv.inner = (void*)(orig & (~1));
16743 orig_conv.is_owned = false;
16744 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
16745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16747 uint64_t ret_ref = (uint64_t)ret_var.inner;
16748 if (ret_var.is_owned) {
16754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
16755 LDKChannelMonitor obj_conv;
16756 obj_conv.inner = (void*)(obj & (~1));
16757 obj_conv.is_owned = false;
16758 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
16759 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16760 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16761 CVec_u8Z_free(ret_var);
16765 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) {
16766 LDKChannelMonitor this_arg_conv;
16767 this_arg_conv.inner = (void*)(this_arg & (~1));
16768 this_arg_conv.is_owned = false;
16769 LDKChannelMonitorUpdate updates_conv;
16770 updates_conv.inner = (void*)(updates & (~1));
16771 updates_conv.is_owned = false;
16772 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16773 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16774 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
16775 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
16776 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
16777 return (uint64_t)ret_conv;
16780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
16781 LDKChannelMonitor this_arg_conv;
16782 this_arg_conv.inner = (void*)(this_arg & (~1));
16783 this_arg_conv.is_owned = false;
16784 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
16788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
16789 LDKChannelMonitor this_arg_conv;
16790 this_arg_conv.inner = (void*)(this_arg & (~1));
16791 this_arg_conv.is_owned = false;
16792 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16793 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
16794 return ((uint64_t)ret_conv);
16797 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
16798 LDKChannelMonitor this_arg_conv;
16799 this_arg_conv.inner = (void*)(this_arg & (~1));
16800 this_arg_conv.is_owned = false;
16801 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
16802 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16803 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16804 for (size_t o = 0; o < ret_var.datalen; o++) {
16805 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16806 *ret_conv_40_conv = ret_var.data[o];
16807 ret_arr_ptr[o] = ((uint64_t)ret_conv_40_conv);
16809 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16810 FREE(ret_var.data);
16814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
16815 LDKChannelMonitor this_arg_conv;
16816 this_arg_conv.inner = (void*)(this_arg & (~1));
16817 this_arg_conv.is_owned = false;
16818 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
16819 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
16822 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16823 LDKChannelMonitor this_arg_conv;
16824 this_arg_conv.inner = (void*)(this_arg & (~1));
16825 this_arg_conv.is_owned = false;
16826 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
16827 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16828 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16829 for (size_t o = 0; o < ret_var.datalen; o++) {
16830 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16831 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
16832 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
16833 ret_arr_ptr[o] = ret_conv_14_ref;
16835 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16836 FREE(ret_var.data);
16840 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16841 LDKChannelMonitor this_arg_conv;
16842 this_arg_conv.inner = (void*)(this_arg & (~1));
16843 this_arg_conv.is_owned = false;
16844 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
16845 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16846 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16847 for (size_t h = 0; h < ret_var.datalen; h++) {
16848 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16849 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
16850 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
16851 ret_arr_ptr[h] = ret_conv_7_ref;
16853 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16854 FREE(ret_var.data);
16858 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) {
16859 LDKChannelMonitor this_arg_conv;
16860 this_arg_conv.inner = (void*)(this_arg & (~1));
16861 this_arg_conv.is_owned = false;
16862 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
16863 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
16864 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
16866 for (size_t i = 0; i < ret_var.datalen; i++) {
16867 LDKTransaction ret_conv_8_var = ret_var.data[i];
16868 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
16869 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
16870 Transaction_free(ret_conv_8_var);
16871 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
16873 FREE(ret_var.data);
16877 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) {
16878 LDKChannelMonitor this_arg_conv;
16879 this_arg_conv.inner = (void*)(this_arg & (~1));
16880 this_arg_conv.is_owned = false;
16881 unsigned char header_arr[80];
16882 CHECK((*env)->GetArrayLength(env, header) == 80);
16883 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16884 unsigned char (*header_ref)[80] = &header_arr;
16885 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16886 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16887 if (txdata_constr.datalen > 0)
16888 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16890 txdata_constr.data = NULL;
16891 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16892 for (size_t c = 0; c < txdata_constr.datalen; c++) {
16893 int64_t txdata_conv_28 = txdata_vals[c];
16894 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
16895 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
16896 txdata_constr.data[c] = txdata_conv_28_conv;
16898 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16899 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16900 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16901 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16902 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16904 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16905 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16906 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16907 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16909 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16910 if (logger_conv.free == LDKLogger_JCalls_free) {
16911 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16912 LDKLogger_JCalls_cloned(&logger_conv);
16914 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);
16915 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16916 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16917 for (size_t n = 0; n < ret_var.datalen; n++) {
16918 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16919 *ret_conv_39_conv = ret_var.data[n];
16920 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
16922 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16923 FREE(ret_var.data);
16927 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) {
16928 LDKChannelMonitor this_arg_conv;
16929 this_arg_conv.inner = (void*)(this_arg & (~1));
16930 this_arg_conv.is_owned = false;
16931 unsigned char header_arr[80];
16932 CHECK((*env)->GetArrayLength(env, header) == 80);
16933 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16934 unsigned char (*header_ref)[80] = &header_arr;
16935 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16936 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16937 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16938 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16940 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16941 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16942 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16943 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16945 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16946 if (logger_conv.free == LDKLogger_JCalls_free) {
16947 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16948 LDKLogger_JCalls_cloned(&logger_conv);
16950 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
16953 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) {
16954 LDKChannelMonitor this_arg_conv;
16955 this_arg_conv.inner = (void*)(this_arg & (~1));
16956 this_arg_conv.is_owned = false;
16957 unsigned char header_arr[80];
16958 CHECK((*env)->GetArrayLength(env, header) == 80);
16959 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16960 unsigned char (*header_ref)[80] = &header_arr;
16961 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16962 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16963 if (txdata_constr.datalen > 0)
16964 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16966 txdata_constr.data = NULL;
16967 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16968 for (size_t c = 0; c < txdata_constr.datalen; c++) {
16969 int64_t txdata_conv_28 = txdata_vals[c];
16970 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1);
16971 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_28) & ~1));
16972 txdata_constr.data[c] = txdata_conv_28_conv;
16974 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16975 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16976 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16977 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16978 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16980 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16981 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16982 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16983 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16985 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16986 if (logger_conv.free == LDKLogger_JCalls_free) {
16987 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16988 LDKLogger_JCalls_cloned(&logger_conv);
16990 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);
16991 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16992 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16993 for (size_t n = 0; n < ret_var.datalen; n++) {
16994 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16995 *ret_conv_39_conv = ret_var.data[n];
16996 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
16998 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16999 FREE(ret_var.data);
17003 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) {
17004 LDKChannelMonitor this_arg_conv;
17005 this_arg_conv.inner = (void*)(this_arg & (~1));
17006 this_arg_conv.is_owned = false;
17007 unsigned char txid_arr[32];
17008 CHECK((*env)->GetArrayLength(env, txid) == 32);
17009 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
17010 unsigned char (*txid_ref)[32] = &txid_arr;
17011 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17012 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17013 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17014 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17016 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17017 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17018 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17019 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17021 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17022 if (logger_conv.free == LDKLogger_JCalls_free) {
17023 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17024 LDKLogger_JCalls_cloned(&logger_conv);
17026 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
17029 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) {
17030 LDKChannelMonitor this_arg_conv;
17031 this_arg_conv.inner = (void*)(this_arg & (~1));
17032 this_arg_conv.is_owned = false;
17033 unsigned char header_arr[80];
17034 CHECK((*env)->GetArrayLength(env, header) == 80);
17035 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
17036 unsigned char (*header_ref)[80] = &header_arr;
17037 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
17038 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17039 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17040 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
17042 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17043 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17044 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17045 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17047 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17048 if (logger_conv.free == LDKLogger_JCalls_free) {
17049 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17050 LDKLogger_JCalls_cloned(&logger_conv);
17052 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
17053 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17054 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17055 for (size_t n = 0; n < ret_var.datalen; n++) {
17056 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
17057 *ret_conv_39_conv = ret_var.data[n];
17058 ret_arr_ptr[n] = ((uint64_t)ret_conv_39_conv);
17060 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17061 FREE(ret_var.data);
17065 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
17066 LDKChannelMonitor this_arg_conv;
17067 this_arg_conv.inner = (void*)(this_arg & (~1));
17068 this_arg_conv.is_owned = false;
17069 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
17070 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
17072 for (size_t i = 0; i < ret_var.datalen; i++) {
17073 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
17074 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
17075 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
17077 FREE(ret_var.data);
17081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
17082 LDKChannelMonitor this_arg_conv;
17083 this_arg_conv.inner = (void*)(this_arg & (~1));
17084 this_arg_conv.is_owned = false;
17085 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
17086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17088 uint64_t ret_ref = (uint64_t)ret_var.inner;
17089 if (ret_var.is_owned) {
17095 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
17096 LDKChannelMonitor this_arg_conv;
17097 this_arg_conv.inner = (void*)(this_arg & (~1));
17098 this_arg_conv.is_owned = false;
17099 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
17100 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17101 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17102 for (size_t j = 0; j < ret_var.datalen; j++) {
17103 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
17104 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
17105 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
17106 ret_arr_ptr[j] = ret_conv_9_ref;
17108 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17109 FREE(ret_var.data);
17113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17114 if ((this_ptr & 1) != 0) return;
17115 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
17116 FREE((void*)this_ptr);
17117 Persist_free(this_ptr_conv);
17120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
17121 LDKu8slice ser_ref;
17122 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17123 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17124 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
17125 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
17126 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
17127 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17128 return (uint64_t)ret_conv;
17131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17132 LDKOutPoint this_obj_conv;
17133 this_obj_conv.inner = (void*)(this_obj & (~1));
17134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17135 OutPoint_free(this_obj_conv);
17138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17139 LDKOutPoint this_ptr_conv;
17140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17141 this_ptr_conv.is_owned = false;
17142 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17143 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
17147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17148 LDKOutPoint this_ptr_conv;
17149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17150 this_ptr_conv.is_owned = false;
17151 LDKThirtyTwoBytes val_ref;
17152 CHECK((*env)->GetArrayLength(env, val) == 32);
17153 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17154 OutPoint_set_txid(&this_ptr_conv, val_ref);
17157 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17158 LDKOutPoint this_ptr_conv;
17159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17160 this_ptr_conv.is_owned = false;
17161 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
17165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17166 LDKOutPoint this_ptr_conv;
17167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17168 this_ptr_conv.is_owned = false;
17169 OutPoint_set_index(&this_ptr_conv, val);
17172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
17173 LDKThirtyTwoBytes txid_arg_ref;
17174 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
17175 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
17176 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
17177 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17178 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17179 uint64_t ret_ref = (uint64_t)ret_var.inner;
17180 if (ret_var.is_owned) {
17186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17187 LDKOutPoint orig_conv;
17188 orig_conv.inner = (void*)(orig & (~1));
17189 orig_conv.is_owned = false;
17190 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
17191 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17192 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17193 uint64_t ret_ref = (uint64_t)ret_var.inner;
17194 if (ret_var.is_owned) {
17200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17201 LDKOutPoint a_conv;
17202 a_conv.inner = (void*)(a & (~1));
17203 a_conv.is_owned = false;
17204 LDKOutPoint b_conv;
17205 b_conv.inner = (void*)(b & (~1));
17206 b_conv.is_owned = false;
17207 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
17211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
17212 LDKOutPoint o_conv;
17213 o_conv.inner = (void*)(o & (~1));
17214 o_conv.is_owned = false;
17215 int64_t ret_val = OutPoint_hash(&o_conv);
17219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17220 LDKOutPoint this_arg_conv;
17221 this_arg_conv.inner = (void*)(this_arg & (~1));
17222 this_arg_conv.is_owned = false;
17223 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17224 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
17228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
17229 LDKOutPoint obj_conv;
17230 obj_conv.inner = (void*)(obj & (~1));
17231 obj_conv.is_owned = false;
17232 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
17233 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17234 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17235 CVec_u8Z_free(ret_var);
17239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17240 LDKu8slice ser_ref;
17241 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17242 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17243 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17244 *ret_conv = OutPoint_read(ser_ref);
17245 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17246 return (uint64_t)ret_conv;
17249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17250 LDKDelayedPaymentOutputDescriptor this_obj_conv;
17251 this_obj_conv.inner = (void*)(this_obj & (~1));
17252 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17253 DelayedPaymentOutputDescriptor_free(this_obj_conv);
17256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17257 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17259 this_ptr_conv.is_owned = false;
17260 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
17261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17263 uint64_t ret_ref = (uint64_t)ret_var.inner;
17264 if (ret_var.is_owned) {
17270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17271 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17273 this_ptr_conv.is_owned = false;
17274 LDKOutPoint val_conv;
17275 val_conv.inner = (void*)(val & (~1));
17276 val_conv.is_owned = (val & 1) || (val == 0);
17277 val_conv = OutPoint_clone(&val_conv);
17278 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
17281 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17282 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17284 this_ptr_conv.is_owned = false;
17285 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17286 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
17290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17291 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17293 this_ptr_conv.is_owned = false;
17294 LDKPublicKey val_ref;
17295 CHECK((*env)->GetArrayLength(env, val) == 33);
17296 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17297 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
17300 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17301 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17303 this_ptr_conv.is_owned = false;
17304 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
17308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17309 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17311 this_ptr_conv.is_owned = false;
17312 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
17315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17316 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17318 this_ptr_conv.is_owned = false;
17319 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
17320 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
17321 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
17324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17325 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17327 this_ptr_conv.is_owned = false;
17328 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17329 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
17333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17334 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17336 this_ptr_conv.is_owned = false;
17337 LDKPublicKey val_ref;
17338 CHECK((*env)->GetArrayLength(env, val) == 33);
17339 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17340 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
17343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17344 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17346 this_ptr_conv.is_owned = false;
17347 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17348 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
17352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17353 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17355 this_ptr_conv.is_owned = false;
17356 LDKThirtyTwoBytes val_ref;
17357 CHECK((*env)->GetArrayLength(env, val) == 32);
17358 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17359 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
17362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17363 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17365 this_ptr_conv.is_owned = false;
17366 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
17370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17371 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17373 this_ptr_conv.is_owned = false;
17374 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
17377 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) {
17378 LDKOutPoint outpoint_arg_conv;
17379 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17380 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17381 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17382 LDKPublicKey per_commitment_point_arg_ref;
17383 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17384 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17385 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
17386 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
17387 LDKPublicKey revocation_pubkey_arg_ref;
17388 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
17389 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
17390 LDKThirtyTwoBytes channel_keys_id_arg_ref;
17391 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
17392 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
17393 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);
17394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17396 uint64_t ret_ref = (uint64_t)ret_var.inner;
17397 if (ret_var.is_owned) {
17403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17404 LDKDelayedPaymentOutputDescriptor orig_conv;
17405 orig_conv.inner = (void*)(orig & (~1));
17406 orig_conv.is_owned = false;
17407 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
17408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17410 uint64_t ret_ref = (uint64_t)ret_var.inner;
17411 if (ret_var.is_owned) {
17417 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17418 LDKDelayedPaymentOutputDescriptor obj_conv;
17419 obj_conv.inner = (void*)(obj & (~1));
17420 obj_conv.is_owned = false;
17421 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
17422 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17423 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17424 CVec_u8Z_free(ret_var);
17428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17429 LDKu8slice ser_ref;
17430 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17431 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17432 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17433 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
17434 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17435 return (uint64_t)ret_conv;
17438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17439 LDKStaticPaymentOutputDescriptor 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 StaticPaymentOutputDescriptor_free(this_obj_conv);
17445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17446 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17448 this_ptr_conv.is_owned = false;
17449 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
17450 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17451 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17452 uint64_t ret_ref = (uint64_t)ret_var.inner;
17453 if (ret_var.is_owned) {
17459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17460 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17462 this_ptr_conv.is_owned = false;
17463 LDKOutPoint val_conv;
17464 val_conv.inner = (void*)(val & (~1));
17465 val_conv.is_owned = (val & 1) || (val == 0);
17466 val_conv = OutPoint_clone(&val_conv);
17467 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
17470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17471 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17473 this_ptr_conv.is_owned = false;
17474 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
17475 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
17476 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
17479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17480 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17482 this_ptr_conv.is_owned = false;
17483 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17484 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
17488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17489 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17491 this_ptr_conv.is_owned = false;
17492 LDKThirtyTwoBytes val_ref;
17493 CHECK((*env)->GetArrayLength(env, val) == 32);
17494 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17495 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
17498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17499 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17501 this_ptr_conv.is_owned = false;
17502 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
17506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17507 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17509 this_ptr_conv.is_owned = false;
17510 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
17513 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) {
17514 LDKOutPoint outpoint_arg_conv;
17515 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17516 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17517 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17518 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
17519 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
17520 LDKThirtyTwoBytes channel_keys_id_arg_ref;
17521 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
17522 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
17523 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
17524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17526 uint64_t ret_ref = (uint64_t)ret_var.inner;
17527 if (ret_var.is_owned) {
17533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17534 LDKStaticPaymentOutputDescriptor orig_conv;
17535 orig_conv.inner = (void*)(orig & (~1));
17536 orig_conv.is_owned = false;
17537 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
17538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17540 uint64_t ret_ref = (uint64_t)ret_var.inner;
17541 if (ret_var.is_owned) {
17547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17548 LDKStaticPaymentOutputDescriptor obj_conv;
17549 obj_conv.inner = (void*)(obj & (~1));
17550 obj_conv.is_owned = false;
17551 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
17552 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17553 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17554 CVec_u8Z_free(ret_var);
17558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17559 LDKu8slice ser_ref;
17560 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17561 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17562 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17563 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
17564 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17565 return (uint64_t)ret_conv;
17568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17569 if ((this_ptr & 1) != 0) return;
17570 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
17571 FREE((void*)this_ptr);
17572 SpendableOutputDescriptor_free(this_ptr_conv);
17575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17576 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
17577 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17578 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
17579 uint64_t ret_ref = (uint64_t)ret_copy;
17583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
17584 LDKOutPoint outpoint_conv;
17585 outpoint_conv.inner = (void*)(outpoint & (~1));
17586 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
17587 outpoint_conv = OutPoint_clone(&outpoint_conv);
17588 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
17589 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
17590 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17591 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
17592 uint64_t ret_ref = (uint64_t)ret_copy;
17596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
17597 LDKDelayedPaymentOutputDescriptor a_conv;
17598 a_conv.inner = (void*)(a & (~1));
17599 a_conv.is_owned = (a & 1) || (a == 0);
17600 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
17601 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17602 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
17603 uint64_t ret_ref = (uint64_t)ret_copy;
17607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
17608 LDKStaticPaymentOutputDescriptor a_conv;
17609 a_conv.inner = (void*)(a & (~1));
17610 a_conv.is_owned = (a & 1) || (a == 0);
17611 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
17612 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17613 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
17614 uint64_t ret_ref = (uint64_t)ret_copy;
17618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17619 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
17620 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
17621 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17622 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17623 CVec_u8Z_free(ret_var);
17627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17628 LDKu8slice ser_ref;
17629 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17630 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17631 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17632 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
17633 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17634 return (uint64_t)ret_conv;
17637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17638 if ((this_ptr & 1) != 0) return;
17639 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
17640 FREE((void*)this_ptr);
17641 BaseSign_free(this_ptr_conv);
17644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17645 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
17646 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
17647 *ret_ret = Sign_clone(orig_conv);
17648 return (uint64_t)ret_ret;
17651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17652 if ((this_ptr & 1) != 0) return;
17653 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
17654 FREE((void*)this_ptr);
17655 Sign_free(this_ptr_conv);
17658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17659 if ((this_ptr & 1) != 0) return;
17660 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
17661 FREE((void*)this_ptr);
17662 KeysInterface_free(this_ptr_conv);
17665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17666 LDKInMemorySigner this_obj_conv;
17667 this_obj_conv.inner = (void*)(this_obj & (~1));
17668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17669 InMemorySigner_free(this_obj_conv);
17672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17673 LDKInMemorySigner this_ptr_conv;
17674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17675 this_ptr_conv.is_owned = false;
17676 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17677 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
17681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17682 LDKInMemorySigner this_ptr_conv;
17683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17684 this_ptr_conv.is_owned = false;
17685 LDKSecretKey val_ref;
17686 CHECK((*env)->GetArrayLength(env, val) == 32);
17687 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17688 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
17691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17692 LDKInMemorySigner this_ptr_conv;
17693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17694 this_ptr_conv.is_owned = false;
17695 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17696 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
17700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17701 LDKInMemorySigner this_ptr_conv;
17702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17703 this_ptr_conv.is_owned = false;
17704 LDKSecretKey val_ref;
17705 CHECK((*env)->GetArrayLength(env, val) == 32);
17706 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17707 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
17710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17711 LDKInMemorySigner this_ptr_conv;
17712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17713 this_ptr_conv.is_owned = false;
17714 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17715 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
17719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17720 LDKInMemorySigner this_ptr_conv;
17721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17722 this_ptr_conv.is_owned = false;
17723 LDKSecretKey val_ref;
17724 CHECK((*env)->GetArrayLength(env, val) == 32);
17725 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17726 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
17729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17730 LDKInMemorySigner this_ptr_conv;
17731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17732 this_ptr_conv.is_owned = false;
17733 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17734 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
17738 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) {
17739 LDKInMemorySigner this_ptr_conv;
17740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17741 this_ptr_conv.is_owned = false;
17742 LDKSecretKey val_ref;
17743 CHECK((*env)->GetArrayLength(env, val) == 32);
17744 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17745 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
17748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17749 LDKInMemorySigner this_ptr_conv;
17750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17751 this_ptr_conv.is_owned = false;
17752 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17753 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
17757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17758 LDKInMemorySigner this_ptr_conv;
17759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17760 this_ptr_conv.is_owned = false;
17761 LDKSecretKey val_ref;
17762 CHECK((*env)->GetArrayLength(env, val) == 32);
17763 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17764 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
17767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
17768 LDKInMemorySigner this_ptr_conv;
17769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17770 this_ptr_conv.is_owned = false;
17771 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17772 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
17776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17777 LDKInMemorySigner this_ptr_conv;
17778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17779 this_ptr_conv.is_owned = false;
17780 LDKThirtyTwoBytes val_ref;
17781 CHECK((*env)->GetArrayLength(env, val) == 32);
17782 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17783 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
17786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17787 LDKInMemorySigner orig_conv;
17788 orig_conv.inner = (void*)(orig & (~1));
17789 orig_conv.is_owned = false;
17790 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
17791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17793 uint64_t ret_ref = (uint64_t)ret_var.inner;
17794 if (ret_var.is_owned) {
17800 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) {
17801 LDKSecretKey funding_key_ref;
17802 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
17803 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
17804 LDKSecretKey revocation_base_key_ref;
17805 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
17806 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
17807 LDKSecretKey payment_key_ref;
17808 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
17809 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
17810 LDKSecretKey delayed_payment_base_key_ref;
17811 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
17812 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
17813 LDKSecretKey htlc_base_key_ref;
17814 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
17815 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
17816 LDKThirtyTwoBytes commitment_seed_ref;
17817 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
17818 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
17819 LDKThirtyTwoBytes channel_keys_id_ref;
17820 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
17821 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
17822 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);
17823 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17824 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17825 uint64_t ret_ref = (uint64_t)ret_var.inner;
17826 if (ret_var.is_owned) {
17832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
17833 LDKInMemorySigner this_arg_conv;
17834 this_arg_conv.inner = (void*)(this_arg & (~1));
17835 this_arg_conv.is_owned = false;
17836 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
17837 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17838 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17839 uint64_t ret_ref = (uint64_t)ret_var.inner;
17840 if (ret_var.is_owned) {
17846 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17847 LDKInMemorySigner this_arg_conv;
17848 this_arg_conv.inner = (void*)(this_arg & (~1));
17849 this_arg_conv.is_owned = false;
17850 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
17854 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17855 LDKInMemorySigner this_arg_conv;
17856 this_arg_conv.inner = (void*)(this_arg & (~1));
17857 this_arg_conv.is_owned = false;
17858 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
17862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
17863 LDKInMemorySigner this_arg_conv;
17864 this_arg_conv.inner = (void*)(this_arg & (~1));
17865 this_arg_conv.is_owned = false;
17866 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
17870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
17871 LDKInMemorySigner this_arg_conv;
17872 this_arg_conv.inner = (void*)(this_arg & (~1));
17873 this_arg_conv.is_owned = false;
17874 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
17875 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17876 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17877 uint64_t ret_ref = (uint64_t)ret_var.inner;
17878 if (ret_var.is_owned) {
17884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
17885 LDKInMemorySigner this_arg_conv;
17886 this_arg_conv.inner = (void*)(this_arg & (~1));
17887 this_arg_conv.is_owned = false;
17888 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
17889 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17890 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17891 uint64_t ret_ref = (uint64_t)ret_var.inner;
17892 if (ret_var.is_owned) {
17898 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) {
17899 LDKInMemorySigner this_arg_conv;
17900 this_arg_conv.inner = (void*)(this_arg & (~1));
17901 this_arg_conv.is_owned = false;
17902 LDKTransaction spend_tx_ref;
17903 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
17904 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17905 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
17906 spend_tx_ref.data_is_owned = true;
17907 LDKStaticPaymentOutputDescriptor descriptor_conv;
17908 descriptor_conv.inner = (void*)(descriptor & (~1));
17909 descriptor_conv.is_owned = false;
17910 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17911 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17912 return (uint64_t)ret_conv;
17915 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) {
17916 LDKInMemorySigner this_arg_conv;
17917 this_arg_conv.inner = (void*)(this_arg & (~1));
17918 this_arg_conv.is_owned = false;
17919 LDKTransaction spend_tx_ref;
17920 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
17921 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17922 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
17923 spend_tx_ref.data_is_owned = true;
17924 LDKDelayedPaymentOutputDescriptor descriptor_conv;
17925 descriptor_conv.inner = (void*)(descriptor & (~1));
17926 descriptor_conv.is_owned = false;
17927 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17928 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17929 return (uint64_t)ret_conv;
17932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
17933 LDKInMemorySigner this_arg_conv;
17934 this_arg_conv.inner = (void*)(this_arg & (~1));
17935 this_arg_conv.is_owned = false;
17936 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
17937 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
17938 return (uint64_t)ret_ret;
17941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
17942 LDKInMemorySigner this_arg_conv;
17943 this_arg_conv.inner = (void*)(this_arg & (~1));
17944 this_arg_conv.is_owned = false;
17945 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
17946 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
17947 return (uint64_t)ret_ret;
17950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
17951 LDKInMemorySigner obj_conv;
17952 obj_conv.inner = (void*)(obj & (~1));
17953 obj_conv.is_owned = false;
17954 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
17955 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17956 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17957 CVec_u8Z_free(ret_var);
17961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17962 LDKu8slice ser_ref;
17963 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17964 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17965 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17966 *ret_conv = InMemorySigner_read(ser_ref);
17967 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17968 return (uint64_t)ret_conv;
17971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17972 LDKKeysManager this_obj_conv;
17973 this_obj_conv.inner = (void*)(this_obj & (~1));
17974 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17975 KeysManager_free(this_obj_conv);
17978 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) {
17979 unsigned char seed_arr[32];
17980 CHECK((*env)->GetArrayLength(env, seed) == 32);
17981 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
17982 unsigned char (*seed_ref)[32] = &seed_arr;
17983 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
17984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17986 uint64_t ret_ref = (uint64_t)ret_var.inner;
17987 if (ret_var.is_owned) {
17993 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) {
17994 LDKKeysManager this_arg_conv;
17995 this_arg_conv.inner = (void*)(this_arg & (~1));
17996 this_arg_conv.is_owned = false;
17997 unsigned char params_arr[32];
17998 CHECK((*env)->GetArrayLength(env, params) == 32);
17999 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
18000 unsigned char (*params_ref)[32] = ¶ms_arr;
18001 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
18002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18004 uint64_t ret_ref = (uint64_t)ret_var.inner;
18005 if (ret_var.is_owned) {
18011 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) {
18012 LDKKeysManager this_arg_conv;
18013 this_arg_conv.inner = (void*)(this_arg & (~1));
18014 this_arg_conv.is_owned = false;
18015 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
18016 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
18017 if (descriptors_constr.datalen > 0)
18018 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
18020 descriptors_constr.data = NULL;
18021 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
18022 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
18023 int64_t descriptors_conv_27 = descriptors_vals[b];
18024 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
18025 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
18026 descriptors_constr.data[b] = descriptors_conv_27_conv;
18028 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
18029 LDKCVec_TxOutZ outputs_constr;
18030 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
18031 if (outputs_constr.datalen > 0)
18032 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
18034 outputs_constr.data = NULL;
18035 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
18036 for (size_t h = 0; h < outputs_constr.datalen; h++) {
18037 int64_t outputs_conv_7 = outputs_vals[h];
18038 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
18039 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
18040 outputs_constr.data[h] = outputs_conv_7_conv;
18042 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
18043 LDKCVec_u8Z change_destination_script_ref;
18044 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
18045 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
18046 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
18047 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
18048 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
18049 return (uint64_t)ret_conv;
18052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
18053 LDKKeysManager this_arg_conv;
18054 this_arg_conv.inner = (void*)(this_arg & (~1));
18055 this_arg_conv.is_owned = false;
18056 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
18057 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
18058 return (uint64_t)ret_ret;
18061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18062 LDKChannelManager this_obj_conv;
18063 this_obj_conv.inner = (void*)(this_obj & (~1));
18064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18065 ChannelManager_free(this_obj_conv);
18068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18069 LDKChainParameters this_obj_conv;
18070 this_obj_conv.inner = (void*)(this_obj & (~1));
18071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18072 ChainParameters_free(this_obj_conv);
18075 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
18076 LDKChainParameters this_ptr_conv;
18077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18078 this_ptr_conv.is_owned = false;
18079 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
18083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
18084 LDKChainParameters this_ptr_conv;
18085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18086 this_ptr_conv.is_owned = false;
18087 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
18088 ChainParameters_set_network(&this_ptr_conv, val_conv);
18091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
18092 LDKChainParameters this_ptr_conv;
18093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18094 this_ptr_conv.is_owned = false;
18095 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
18096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18098 uint64_t ret_ref = (uint64_t)ret_var.inner;
18099 if (ret_var.is_owned) {
18105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18106 LDKChainParameters this_ptr_conv;
18107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18108 this_ptr_conv.is_owned = false;
18109 LDKBestBlock val_conv;
18110 val_conv.inner = (void*)(val & (~1));
18111 val_conv.is_owned = (val & 1) || (val == 0);
18112 val_conv = BestBlock_clone(&val_conv);
18113 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
18116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
18117 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
18118 LDKBestBlock best_block_arg_conv;
18119 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
18120 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
18121 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
18122 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
18123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18125 uint64_t ret_ref = (uint64_t)ret_var.inner;
18126 if (ret_var.is_owned) {
18132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18133 LDKChainParameters orig_conv;
18134 orig_conv.inner = (void*)(orig & (~1));
18135 orig_conv.is_owned = false;
18136 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
18137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18139 uint64_t ret_ref = (uint64_t)ret_var.inner;
18140 if (ret_var.is_owned) {
18146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18147 LDKCounterpartyForwardingInfo this_obj_conv;
18148 this_obj_conv.inner = (void*)(this_obj & (~1));
18149 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18150 CounterpartyForwardingInfo_free(this_obj_conv);
18153 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18154 LDKCounterpartyForwardingInfo this_ptr_conv;
18155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18156 this_ptr_conv.is_owned = false;
18157 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
18161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18162 LDKCounterpartyForwardingInfo this_ptr_conv;
18163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18164 this_ptr_conv.is_owned = false;
18165 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
18168 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18169 LDKCounterpartyForwardingInfo this_ptr_conv;
18170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18171 this_ptr_conv.is_owned = false;
18172 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
18176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18177 LDKCounterpartyForwardingInfo this_ptr_conv;
18178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18179 this_ptr_conv.is_owned = false;
18180 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
18183 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18184 LDKCounterpartyForwardingInfo this_ptr_conv;
18185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18186 this_ptr_conv.is_owned = false;
18187 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
18191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18192 LDKCounterpartyForwardingInfo this_ptr_conv;
18193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18194 this_ptr_conv.is_owned = false;
18195 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
18198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
18199 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
18200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18202 uint64_t ret_ref = (uint64_t)ret_var.inner;
18203 if (ret_var.is_owned) {
18209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18210 LDKCounterpartyForwardingInfo orig_conv;
18211 orig_conv.inner = (void*)(orig & (~1));
18212 orig_conv.is_owned = false;
18213 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
18214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18216 uint64_t ret_ref = (uint64_t)ret_var.inner;
18217 if (ret_var.is_owned) {
18223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18224 LDKChannelCounterparty this_obj_conv;
18225 this_obj_conv.inner = (void*)(this_obj & (~1));
18226 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18227 ChannelCounterparty_free(this_obj_conv);
18230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18231 LDKChannelCounterparty this_ptr_conv;
18232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18233 this_ptr_conv.is_owned = false;
18234 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18235 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
18239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18240 LDKChannelCounterparty this_ptr_conv;
18241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18242 this_ptr_conv.is_owned = false;
18243 LDKPublicKey val_ref;
18244 CHECK((*env)->GetArrayLength(env, val) == 33);
18245 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18246 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
18249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18250 LDKChannelCounterparty this_ptr_conv;
18251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18252 this_ptr_conv.is_owned = false;
18253 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
18254 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18255 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18256 uint64_t ret_ref = (uint64_t)ret_var.inner;
18257 if (ret_var.is_owned) {
18263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18264 LDKChannelCounterparty this_ptr_conv;
18265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18266 this_ptr_conv.is_owned = false;
18267 LDKInitFeatures val_conv;
18268 val_conv.inner = (void*)(val & (~1));
18269 val_conv.is_owned = (val & 1) || (val == 0);
18270 val_conv = InitFeatures_clone(&val_conv);
18271 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
18274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
18275 LDKChannelCounterparty this_ptr_conv;
18276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18277 this_ptr_conv.is_owned = false;
18278 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
18282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18283 LDKChannelCounterparty this_ptr_conv;
18284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18285 this_ptr_conv.is_owned = false;
18286 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
18289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
18290 LDKChannelCounterparty this_ptr_conv;
18291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18292 this_ptr_conv.is_owned = false;
18293 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
18294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18296 uint64_t ret_ref = (uint64_t)ret_var.inner;
18297 if (ret_var.is_owned) {
18303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18304 LDKChannelCounterparty this_ptr_conv;
18305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18306 this_ptr_conv.is_owned = false;
18307 LDKCounterpartyForwardingInfo val_conv;
18308 val_conv.inner = (void*)(val & (~1));
18309 val_conv.is_owned = (val & 1) || (val == 0);
18310 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
18311 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
18314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg) {
18315 LDKPublicKey node_id_arg_ref;
18316 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
18317 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
18318 LDKInitFeatures features_arg_conv;
18319 features_arg_conv.inner = (void*)(features_arg & (~1));
18320 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18321 features_arg_conv = InitFeatures_clone(&features_arg_conv);
18322 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
18323 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
18324 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
18325 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
18326 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
18327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18329 uint64_t ret_ref = (uint64_t)ret_var.inner;
18330 if (ret_var.is_owned) {
18336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18337 LDKChannelCounterparty orig_conv;
18338 orig_conv.inner = (void*)(orig & (~1));
18339 orig_conv.is_owned = false;
18340 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
18341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18343 uint64_t ret_ref = (uint64_t)ret_var.inner;
18344 if (ret_var.is_owned) {
18350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18351 LDKChannelDetails this_obj_conv;
18352 this_obj_conv.inner = (void*)(this_obj & (~1));
18353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18354 ChannelDetails_free(this_obj_conv);
18357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18358 LDKChannelDetails this_ptr_conv;
18359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18360 this_ptr_conv.is_owned = false;
18361 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18362 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
18366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18367 LDKChannelDetails this_ptr_conv;
18368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18369 this_ptr_conv.is_owned = false;
18370 LDKThirtyTwoBytes val_ref;
18371 CHECK((*env)->GetArrayLength(env, val) == 32);
18372 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18373 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
18376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
18377 LDKChannelDetails this_ptr_conv;
18378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18379 this_ptr_conv.is_owned = false;
18380 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
18381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18383 uint64_t ret_ref = (uint64_t)ret_var.inner;
18384 if (ret_var.is_owned) {
18390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18391 LDKChannelDetails this_ptr_conv;
18392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18393 this_ptr_conv.is_owned = false;
18394 LDKChannelCounterparty val_conv;
18395 val_conv.inner = (void*)(val & (~1));
18396 val_conv.is_owned = (val & 1) || (val == 0);
18397 val_conv = ChannelCounterparty_clone(&val_conv);
18398 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
18401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
18402 LDKChannelDetails this_ptr_conv;
18403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18404 this_ptr_conv.is_owned = false;
18405 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
18406 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18407 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18408 uint64_t ret_ref = (uint64_t)ret_var.inner;
18409 if (ret_var.is_owned) {
18415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18416 LDKChannelDetails this_ptr_conv;
18417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18418 this_ptr_conv.is_owned = false;
18419 LDKOutPoint val_conv;
18420 val_conv.inner = (void*)(val & (~1));
18421 val_conv.is_owned = (val & 1) || (val == 0);
18422 val_conv = OutPoint_clone(&val_conv);
18423 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
18426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18427 LDKChannelDetails this_ptr_conv;
18428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18429 this_ptr_conv.is_owned = false;
18430 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18431 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
18432 uint64_t ret_ref = (uint64_t)ret_copy;
18436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18437 LDKChannelDetails this_ptr_conv;
18438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18439 this_ptr_conv.is_owned = false;
18440 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18441 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
18442 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
18445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18446 LDKChannelDetails this_ptr_conv;
18447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18448 this_ptr_conv.is_owned = false;
18449 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
18453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18454 LDKChannelDetails this_ptr_conv;
18455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18456 this_ptr_conv.is_owned = false;
18457 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
18460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
18461 LDKChannelDetails this_ptr_conv;
18462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18463 this_ptr_conv.is_owned = false;
18464 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18465 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
18466 uint64_t ret_ref = (uint64_t)ret_copy;
18470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18471 LDKChannelDetails this_ptr_conv;
18472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18473 this_ptr_conv.is_owned = false;
18474 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18475 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
18476 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
18479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18480 LDKChannelDetails this_ptr_conv;
18481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18482 this_ptr_conv.is_owned = false;
18483 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
18487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18488 LDKChannelDetails this_ptr_conv;
18489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18490 this_ptr_conv.is_owned = false;
18491 ChannelDetails_set_user_id(&this_ptr_conv, val);
18494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18495 LDKChannelDetails this_ptr_conv;
18496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18497 this_ptr_conv.is_owned = false;
18498 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
18502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18503 LDKChannelDetails this_ptr_conv;
18504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18505 this_ptr_conv.is_owned = false;
18506 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
18509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18510 LDKChannelDetails this_ptr_conv;
18511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18512 this_ptr_conv.is_owned = false;
18513 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
18517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18518 LDKChannelDetails this_ptr_conv;
18519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18520 this_ptr_conv.is_owned = false;
18521 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
18524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
18525 LDKChannelDetails this_ptr_conv;
18526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18527 this_ptr_conv.is_owned = false;
18528 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
18529 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
18530 uint64_t ret_ref = (uint64_t)ret_copy;
18534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18535 LDKChannelDetails this_ptr_conv;
18536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18537 this_ptr_conv.is_owned = false;
18538 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
18539 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
18540 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
18543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18544 LDKChannelDetails this_ptr_conv;
18545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18546 this_ptr_conv.is_owned = false;
18547 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18548 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
18549 uint64_t ret_ref = (uint64_t)ret_copy;
18553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18554 LDKChannelDetails this_ptr_conv;
18555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18556 this_ptr_conv.is_owned = false;
18557 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
18558 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
18559 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
18562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
18563 LDKChannelDetails this_ptr_conv;
18564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18565 this_ptr_conv.is_owned = false;
18566 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
18570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18571 LDKChannelDetails this_ptr_conv;
18572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18573 this_ptr_conv.is_owned = false;
18574 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
18577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
18578 LDKChannelDetails this_ptr_conv;
18579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18580 this_ptr_conv.is_owned = false;
18581 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
18585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18586 LDKChannelDetails this_ptr_conv;
18587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18588 this_ptr_conv.is_owned = false;
18589 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
18592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
18593 LDKChannelDetails this_ptr_conv;
18594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18595 this_ptr_conv.is_owned = false;
18596 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
18600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18601 LDKChannelDetails this_ptr_conv;
18602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18603 this_ptr_conv.is_owned = false;
18604 ChannelDetails_set_is_usable(&this_ptr_conv, val);
18607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
18608 LDKChannelDetails this_ptr_conv;
18609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18610 this_ptr_conv.is_owned = false;
18611 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
18615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18616 LDKChannelDetails this_ptr_conv;
18617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18618 this_ptr_conv.is_owned = false;
18619 ChannelDetails_set_is_public(&this_ptr_conv, val);
18622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
18623 LDKThirtyTwoBytes channel_id_arg_ref;
18624 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18625 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18626 LDKChannelCounterparty counterparty_arg_conv;
18627 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
18628 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
18629 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
18630 LDKOutPoint funding_txo_arg_conv;
18631 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
18632 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
18633 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
18634 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
18635 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
18636 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
18637 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
18638 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
18639 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
18640 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
18641 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
18642 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18643 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18644 uint64_t ret_ref = (uint64_t)ret_var.inner;
18645 if (ret_var.is_owned) {
18651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18652 LDKChannelDetails orig_conv;
18653 orig_conv.inner = (void*)(orig & (~1));
18654 orig_conv.is_owned = false;
18655 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
18656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18658 uint64_t ret_ref = (uint64_t)ret_var.inner;
18659 if (ret_var.is_owned) {
18665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18666 if ((this_ptr & 1) != 0) return;
18667 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
18668 FREE((void*)this_ptr);
18669 PaymentSendFailure_free(this_ptr_conv);
18672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18673 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
18674 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18675 *ret_copy = PaymentSendFailure_clone(orig_conv);
18676 uint64_t ret_ref = (uint64_t)ret_copy;
18680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
18681 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
18682 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
18683 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18684 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
18685 uint64_t ret_ref = (uint64_t)ret_copy;
18689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
18690 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
18691 a_constr.datalen = (*env)->GetArrayLength(env, a);
18692 if (a_constr.datalen > 0)
18693 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18695 a_constr.data = NULL;
18696 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18697 for (size_t w = 0; w < a_constr.datalen; w++) {
18698 int64_t a_conv_22 = a_vals[w];
18699 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
18700 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
18701 a_constr.data[w] = a_conv_22_conv;
18703 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18704 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18705 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
18706 uint64_t ret_ref = (uint64_t)ret_copy;
18710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
18711 LDKCVec_APIErrorZ a_constr;
18712 a_constr.datalen = (*env)->GetArrayLength(env, a);
18713 if (a_constr.datalen > 0)
18714 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18716 a_constr.data = NULL;
18717 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18718 for (size_t k = 0; k < a_constr.datalen; k++) {
18719 int64_t a_conv_10 = a_vals[k];
18720 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
18721 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
18722 a_constr.data[k] = a_conv_10_conv;
18724 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18725 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18726 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
18727 uint64_t ret_ref = (uint64_t)ret_copy;
18731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) {
18732 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
18733 a_constr.datalen = (*env)->GetArrayLength(env, a);
18734 if (a_constr.datalen > 0)
18735 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18737 a_constr.data = NULL;
18738 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18739 for (size_t w = 0; w < a_constr.datalen; w++) {
18740 int64_t a_conv_22 = a_vals[w];
18741 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
18742 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
18743 a_constr.data[w] = a_conv_22_conv;
18745 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18746 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18747 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
18748 uint64_t ret_ref = (uint64_t)ret_copy;
18752 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) {
18753 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
18754 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
18755 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18756 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
18758 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
18759 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
18760 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18761 LDKWatch_JCalls_cloned(&chain_monitor_conv);
18763 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
18764 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18765 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18766 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
18768 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18769 if (logger_conv.free == LDKLogger_JCalls_free) {
18770 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18771 LDKLogger_JCalls_cloned(&logger_conv);
18773 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
18774 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
18775 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18776 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
18778 LDKUserConfig config_conv;
18779 config_conv.inner = (void*)(config & (~1));
18780 config_conv.is_owned = (config & 1) || (config == 0);
18781 config_conv = UserConfig_clone(&config_conv);
18782 LDKChainParameters params_conv;
18783 params_conv.inner = (void*)(params & (~1));
18784 params_conv.is_owned = (params & 1) || (params == 0);
18785 params_conv = ChainParameters_clone(¶ms_conv);
18786 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
18787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18789 uint64_t ret_ref = (uint64_t)ret_var.inner;
18790 if (ret_var.is_owned) {
18796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
18797 LDKChannelManager this_arg_conv;
18798 this_arg_conv.inner = (void*)(this_arg & (~1));
18799 this_arg_conv.is_owned = false;
18800 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
18801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18803 uint64_t ret_ref = (uint64_t)ret_var.inner;
18804 if (ret_var.is_owned) {
18810 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) {
18811 LDKChannelManager this_arg_conv;
18812 this_arg_conv.inner = (void*)(this_arg & (~1));
18813 this_arg_conv.is_owned = false;
18814 LDKPublicKey their_network_key_ref;
18815 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
18816 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
18817 LDKUserConfig override_config_conv;
18818 override_config_conv.inner = (void*)(override_config & (~1));
18819 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
18820 override_config_conv = UserConfig_clone(&override_config_conv);
18821 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18822 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
18823 return (uint64_t)ret_conv;
18826 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18827 LDKChannelManager this_arg_conv;
18828 this_arg_conv.inner = (void*)(this_arg & (~1));
18829 this_arg_conv.is_owned = false;
18830 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
18831 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18832 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18833 for (size_t q = 0; q < ret_var.datalen; q++) {
18834 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18835 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18836 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18837 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18838 if (ret_conv_16_var.is_owned) {
18839 ret_conv_16_ref |= 1;
18841 ret_arr_ptr[q] = ret_conv_16_ref;
18843 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18844 FREE(ret_var.data);
18848 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18849 LDKChannelManager this_arg_conv;
18850 this_arg_conv.inner = (void*)(this_arg & (~1));
18851 this_arg_conv.is_owned = false;
18852 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
18853 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18854 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18855 for (size_t q = 0; q < ret_var.datalen; q++) {
18856 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18857 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18858 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18859 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18860 if (ret_conv_16_var.is_owned) {
18861 ret_conv_16_ref |= 1;
18863 ret_arr_ptr[q] = ret_conv_16_ref;
18865 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18866 FREE(ret_var.data);
18870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
18871 LDKChannelManager this_arg_conv;
18872 this_arg_conv.inner = (void*)(this_arg & (~1));
18873 this_arg_conv.is_owned = false;
18874 unsigned char channel_id_arr[32];
18875 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18876 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18877 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18878 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18879 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
18880 return (uint64_t)ret_conv;
18883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
18884 LDKChannelManager this_arg_conv;
18885 this_arg_conv.inner = (void*)(this_arg & (~1));
18886 this_arg_conv.is_owned = false;
18887 unsigned char channel_id_arr[32];
18888 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18889 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18890 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18891 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18892 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
18893 return (uint64_t)ret_conv;
18896 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) {
18897 LDKChannelManager this_arg_conv;
18898 this_arg_conv.inner = (void*)(this_arg & (~1));
18899 this_arg_conv.is_owned = false;
18900 unsigned char channel_id_arr[32];
18901 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18902 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18903 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18904 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18905 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
18906 return (uint64_t)ret_conv;
18909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18910 LDKChannelManager this_arg_conv;
18911 this_arg_conv.inner = (void*)(this_arg & (~1));
18912 this_arg_conv.is_owned = false;
18913 ChannelManager_force_close_all_channels(&this_arg_conv);
18916 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) {
18917 LDKChannelManager this_arg_conv;
18918 this_arg_conv.inner = (void*)(this_arg & (~1));
18919 this_arg_conv.is_owned = false;
18920 LDKRoute route_conv;
18921 route_conv.inner = (void*)(route & (~1));
18922 route_conv.is_owned = false;
18923 LDKThirtyTwoBytes payment_hash_ref;
18924 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
18925 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
18926 LDKThirtyTwoBytes payment_secret_ref;
18927 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
18928 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
18929 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18930 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
18931 return (uint64_t)ret_conv;
18934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
18935 LDKChannelManager this_arg_conv;
18936 this_arg_conv.inner = (void*)(this_arg & (~1));
18937 this_arg_conv.is_owned = false;
18938 LDKRoute route_conv;
18939 route_conv.inner = (void*)(route & (~1));
18940 route_conv.is_owned = false;
18941 LDKThirtyTwoBytes payment_preimage_ref;
18942 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
18943 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
18944 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
18945 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
18946 return (uint64_t)ret_conv;
18949 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) {
18950 LDKChannelManager this_arg_conv;
18951 this_arg_conv.inner = (void*)(this_arg & (~1));
18952 this_arg_conv.is_owned = false;
18953 unsigned char temporary_channel_id_arr[32];
18954 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
18955 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
18956 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
18957 LDKTransaction funding_transaction_ref;
18958 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
18959 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
18960 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
18961 funding_transaction_ref.data_is_owned = true;
18962 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18963 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
18964 return (uint64_t)ret_conv;
18967 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) {
18968 LDKChannelManager this_arg_conv;
18969 this_arg_conv.inner = (void*)(this_arg & (~1));
18970 this_arg_conv.is_owned = false;
18971 LDKThreeBytes rgb_ref;
18972 CHECK((*env)->GetArrayLength(env, rgb) == 3);
18973 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
18974 LDKThirtyTwoBytes alias_ref;
18975 CHECK((*env)->GetArrayLength(env, alias) == 32);
18976 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
18977 LDKCVec_NetAddressZ addresses_constr;
18978 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
18979 if (addresses_constr.datalen > 0)
18980 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18982 addresses_constr.data = NULL;
18983 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
18984 for (size_t m = 0; m < addresses_constr.datalen; m++) {
18985 int64_t addresses_conv_12 = addresses_vals[m];
18986 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
18987 addresses_constr.data[m] = addresses_conv_12_conv;
18989 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
18990 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
18993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
18994 LDKChannelManager this_arg_conv;
18995 this_arg_conv.inner = (void*)(this_arg & (~1));
18996 this_arg_conv.is_owned = false;
18997 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
19000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
19001 LDKChannelManager this_arg_conv;
19002 this_arg_conv.inner = (void*)(this_arg & (~1));
19003 this_arg_conv.is_owned = false;
19004 ChannelManager_timer_tick_occurred(&this_arg_conv);
19007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
19008 LDKChannelManager this_arg_conv;
19009 this_arg_conv.inner = (void*)(this_arg & (~1));
19010 this_arg_conv.is_owned = false;
19011 unsigned char payment_hash_arr[32];
19012 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
19013 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
19014 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
19015 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
19019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
19020 LDKChannelManager this_arg_conv;
19021 this_arg_conv.inner = (void*)(this_arg & (~1));
19022 this_arg_conv.is_owned = false;
19023 LDKThirtyTwoBytes payment_preimage_ref;
19024 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
19025 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
19026 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
19030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
19031 LDKChannelManager this_arg_conv;
19032 this_arg_conv.inner = (void*)(this_arg & (~1));
19033 this_arg_conv.is_owned = false;
19034 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19035 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
19039 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) {
19040 LDKChannelManager this_arg_conv;
19041 this_arg_conv.inner = (void*)(this_arg & (~1));
19042 this_arg_conv.is_owned = false;
19043 LDKOutPoint funding_txo_conv;
19044 funding_txo_conv.inner = (void*)(funding_txo & (~1));
19045 funding_txo_conv.is_owned = false;
19046 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
19049 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) {
19050 LDKChannelManager this_arg_conv;
19051 this_arg_conv.inner = (void*)(this_arg & (~1));
19052 this_arg_conv.is_owned = false;
19053 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
19054 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
19055 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
19056 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
19057 return ((uint64_t)ret_conv);
19060 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) {
19061 LDKChannelManager this_arg_conv;
19062 this_arg_conv.inner = (void*)(this_arg & (~1));
19063 this_arg_conv.is_owned = false;
19064 LDKThirtyTwoBytes payment_hash_ref;
19065 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
19066 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
19067 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
19068 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
19069 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
19070 *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);
19071 return (uint64_t)ret_conv;
19074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
19075 LDKChannelManager this_arg_conv;
19076 this_arg_conv.inner = (void*)(this_arg & (~1));
19077 this_arg_conv.is_owned = false;
19078 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
19079 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
19080 return (uint64_t)ret_ret;
19083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
19084 LDKChannelManager this_arg_conv;
19085 this_arg_conv.inner = (void*)(this_arg & (~1));
19086 this_arg_conv.is_owned = false;
19087 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
19088 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
19089 return (uint64_t)ret_ret;
19092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
19093 LDKChannelManager this_arg_conv;
19094 this_arg_conv.inner = (void*)(this_arg & (~1));
19095 this_arg_conv.is_owned = false;
19096 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
19097 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
19098 return (uint64_t)ret_ret;
19101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
19102 LDKChannelManager this_arg_conv;
19103 this_arg_conv.inner = (void*)(this_arg & (~1));
19104 this_arg_conv.is_owned = false;
19105 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
19106 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
19107 return (uint64_t)ret_ret;
19110 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) {
19111 LDKChannelManager this_arg_conv;
19112 this_arg_conv.inner = (void*)(this_arg & (~1));
19113 this_arg_conv.is_owned = false;
19114 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
19118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
19119 LDKChannelManager this_arg_conv;
19120 this_arg_conv.inner = (void*)(this_arg & (~1));
19121 this_arg_conv.is_owned = false;
19122 ChannelManager_await_persistable_update(&this_arg_conv);
19125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
19126 LDKChannelManager this_arg_conv;
19127 this_arg_conv.inner = (void*)(this_arg & (~1));
19128 this_arg_conv.is_owned = false;
19129 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
19130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19132 uint64_t ret_ref = (uint64_t)ret_var.inner;
19133 if (ret_var.is_owned) {
19139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
19140 LDKChannelManager this_arg_conv;
19141 this_arg_conv.inner = (void*)(this_arg & (~1));
19142 this_arg_conv.is_owned = false;
19143 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
19144 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
19145 return (uint64_t)ret_ret;
19148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
19149 LDKChannelManager obj_conv;
19150 obj_conv.inner = (void*)(obj & (~1));
19151 obj_conv.is_owned = false;
19152 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
19153 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19154 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19155 CVec_u8Z_free(ret_var);
19159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19160 LDKChannelManagerReadArgs this_obj_conv;
19161 this_obj_conv.inner = (void*)(this_obj & (~1));
19162 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19163 ChannelManagerReadArgs_free(this_obj_conv);
19166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
19167 LDKChannelManagerReadArgs this_ptr_conv;
19168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19169 this_ptr_conv.is_owned = false;
19170 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
19174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19175 LDKChannelManagerReadArgs this_ptr_conv;
19176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19177 this_ptr_conv.is_owned = false;
19178 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
19179 if (val_conv.free == LDKKeysInterface_JCalls_free) {
19180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19181 LDKKeysInterface_JCalls_cloned(&val_conv);
19183 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
19186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
19187 LDKChannelManagerReadArgs this_ptr_conv;
19188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19189 this_ptr_conv.is_owned = false;
19190 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
19194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19195 LDKChannelManagerReadArgs this_ptr_conv;
19196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19197 this_ptr_conv.is_owned = false;
19198 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
19199 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
19200 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19201 LDKFeeEstimator_JCalls_cloned(&val_conv);
19203 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
19206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
19207 LDKChannelManagerReadArgs this_ptr_conv;
19208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19209 this_ptr_conv.is_owned = false;
19210 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
19214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19215 LDKChannelManagerReadArgs this_ptr_conv;
19216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19217 this_ptr_conv.is_owned = false;
19218 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
19219 if (val_conv.free == LDKWatch_JCalls_free) {
19220 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19221 LDKWatch_JCalls_cloned(&val_conv);
19223 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
19226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
19227 LDKChannelManagerReadArgs this_ptr_conv;
19228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19229 this_ptr_conv.is_owned = false;
19230 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
19234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19235 LDKChannelManagerReadArgs this_ptr_conv;
19236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19237 this_ptr_conv.is_owned = false;
19238 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
19239 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
19240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19241 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
19243 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
19246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
19247 LDKChannelManagerReadArgs this_ptr_conv;
19248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19249 this_ptr_conv.is_owned = false;
19250 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
19254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19255 LDKChannelManagerReadArgs this_ptr_conv;
19256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19257 this_ptr_conv.is_owned = false;
19258 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
19259 if (val_conv.free == LDKLogger_JCalls_free) {
19260 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19261 LDKLogger_JCalls_cloned(&val_conv);
19263 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
19266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
19267 LDKChannelManagerReadArgs this_ptr_conv;
19268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19269 this_ptr_conv.is_owned = false;
19270 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
19271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19273 uint64_t ret_ref = (uint64_t)ret_var.inner;
19274 if (ret_var.is_owned) {
19280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19281 LDKChannelManagerReadArgs this_ptr_conv;
19282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19283 this_ptr_conv.is_owned = false;
19284 LDKUserConfig val_conv;
19285 val_conv.inner = (void*)(val & (~1));
19286 val_conv.is_owned = (val & 1) || (val == 0);
19287 val_conv = UserConfig_clone(&val_conv);
19288 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
19291 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) {
19292 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
19293 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
19294 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19295 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
19297 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
19298 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19299 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19300 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19302 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
19303 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
19304 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19305 LDKWatch_JCalls_cloned(&chain_monitor_conv);
19307 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
19308 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19309 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19310 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
19312 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19313 if (logger_conv.free == LDKLogger_JCalls_free) {
19314 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19315 LDKLogger_JCalls_cloned(&logger_conv);
19317 LDKUserConfig default_config_conv;
19318 default_config_conv.inner = (void*)(default_config & (~1));
19319 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
19320 default_config_conv = UserConfig_clone(&default_config_conv);
19321 LDKCVec_ChannelMonitorZ channel_monitors_constr;
19322 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
19323 if (channel_monitors_constr.datalen > 0)
19324 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19326 channel_monitors_constr.data = NULL;
19327 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
19328 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
19329 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
19330 LDKChannelMonitor channel_monitors_conv_16_conv;
19331 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
19332 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
19333 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
19335 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
19336 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);
19337 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19338 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19339 uint64_t ret_ref = (uint64_t)ret_var.inner;
19340 if (ret_var.is_owned) {
19346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
19347 LDKu8slice ser_ref;
19348 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19349 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19350 LDKChannelManagerReadArgs arg_conv;
19351 arg_conv.inner = (void*)(arg & (~1));
19352 arg_conv.is_owned = (arg & 1) || (arg == 0);
19353 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
19354 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19355 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
19356 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19357 return (uint64_t)ret_conv;
19360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19361 LDKDecodeError this_obj_conv;
19362 this_obj_conv.inner = (void*)(this_obj & (~1));
19363 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19364 DecodeError_free(this_obj_conv);
19367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19368 LDKDecodeError orig_conv;
19369 orig_conv.inner = (void*)(orig & (~1));
19370 orig_conv.is_owned = false;
19371 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
19372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19374 uint64_t ret_ref = (uint64_t)ret_var.inner;
19375 if (ret_var.is_owned) {
19381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19382 LDKInit this_obj_conv;
19383 this_obj_conv.inner = (void*)(this_obj & (~1));
19384 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19385 Init_free(this_obj_conv);
19388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19389 LDKInit this_ptr_conv;
19390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19391 this_ptr_conv.is_owned = false;
19392 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
19393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19395 uint64_t ret_ref = (uint64_t)ret_var.inner;
19396 if (ret_var.is_owned) {
19402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19403 LDKInit this_ptr_conv;
19404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19405 this_ptr_conv.is_owned = false;
19406 LDKInitFeatures val_conv;
19407 val_conv.inner = (void*)(val & (~1));
19408 val_conv.is_owned = (val & 1) || (val == 0);
19409 val_conv = InitFeatures_clone(&val_conv);
19410 Init_set_features(&this_ptr_conv, val_conv);
19413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
19414 LDKInitFeatures features_arg_conv;
19415 features_arg_conv.inner = (void*)(features_arg & (~1));
19416 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19417 features_arg_conv = InitFeatures_clone(&features_arg_conv);
19418 LDKInit ret_var = Init_new(features_arg_conv);
19419 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19420 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19421 uint64_t ret_ref = (uint64_t)ret_var.inner;
19422 if (ret_var.is_owned) {
19428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19430 orig_conv.inner = (void*)(orig & (~1));
19431 orig_conv.is_owned = false;
19432 LDKInit ret_var = Init_clone(&orig_conv);
19433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19435 uint64_t ret_ref = (uint64_t)ret_var.inner;
19436 if (ret_var.is_owned) {
19442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19443 LDKErrorMessage this_obj_conv;
19444 this_obj_conv.inner = (void*)(this_obj & (~1));
19445 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19446 ErrorMessage_free(this_obj_conv);
19449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19450 LDKErrorMessage this_ptr_conv;
19451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19452 this_ptr_conv.is_owned = false;
19453 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19454 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
19458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19459 LDKErrorMessage this_ptr_conv;
19460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19461 this_ptr_conv.is_owned = false;
19462 LDKThirtyTwoBytes val_ref;
19463 CHECK((*env)->GetArrayLength(env, val) == 32);
19464 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19465 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
19468 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
19469 LDKErrorMessage this_ptr_conv;
19470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19471 this_ptr_conv.is_owned = false;
19472 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
19473 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19479 LDKErrorMessage this_ptr_conv;
19480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19481 this_ptr_conv.is_owned = false;
19482 LDKStr val_conv = java_to_owned_str(env, val);
19483 ErrorMessage_set_data(&this_ptr_conv, val_conv);
19486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
19487 LDKThirtyTwoBytes channel_id_arg_ref;
19488 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19489 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19490 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
19491 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
19492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19494 uint64_t ret_ref = (uint64_t)ret_var.inner;
19495 if (ret_var.is_owned) {
19501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19502 LDKErrorMessage orig_conv;
19503 orig_conv.inner = (void*)(orig & (~1));
19504 orig_conv.is_owned = false;
19505 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
19506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19508 uint64_t ret_ref = (uint64_t)ret_var.inner;
19509 if (ret_var.is_owned) {
19515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19516 LDKPing this_obj_conv;
19517 this_obj_conv.inner = (void*)(this_obj & (~1));
19518 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19519 Ping_free(this_obj_conv);
19522 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19523 LDKPing this_ptr_conv;
19524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19525 this_ptr_conv.is_owned = false;
19526 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
19530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19531 LDKPing this_ptr_conv;
19532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19533 this_ptr_conv.is_owned = false;
19534 Ping_set_ponglen(&this_ptr_conv, val);
19537 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19538 LDKPing this_ptr_conv;
19539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19540 this_ptr_conv.is_owned = false;
19541 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
19545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19546 LDKPing this_ptr_conv;
19547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19548 this_ptr_conv.is_owned = false;
19549 Ping_set_byteslen(&this_ptr_conv, val);
19552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
19553 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
19554 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19555 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19556 uint64_t ret_ref = (uint64_t)ret_var.inner;
19557 if (ret_var.is_owned) {
19563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19565 orig_conv.inner = (void*)(orig & (~1));
19566 orig_conv.is_owned = false;
19567 LDKPing ret_var = Ping_clone(&orig_conv);
19568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19570 uint64_t ret_ref = (uint64_t)ret_var.inner;
19571 if (ret_var.is_owned) {
19577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19578 LDKPong this_obj_conv;
19579 this_obj_conv.inner = (void*)(this_obj & (~1));
19580 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19581 Pong_free(this_obj_conv);
19584 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19585 LDKPong this_ptr_conv;
19586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19587 this_ptr_conv.is_owned = false;
19588 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
19592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19593 LDKPong this_ptr_conv;
19594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19595 this_ptr_conv.is_owned = false;
19596 Pong_set_byteslen(&this_ptr_conv, val);
19599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
19600 LDKPong ret_var = Pong_new(byteslen_arg);
19601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19603 uint64_t ret_ref = (uint64_t)ret_var.inner;
19604 if (ret_var.is_owned) {
19610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19612 orig_conv.inner = (void*)(orig & (~1));
19613 orig_conv.is_owned = false;
19614 LDKPong ret_var = Pong_clone(&orig_conv);
19615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19617 uint64_t ret_ref = (uint64_t)ret_var.inner;
19618 if (ret_var.is_owned) {
19624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19625 LDKOpenChannel this_obj_conv;
19626 this_obj_conv.inner = (void*)(this_obj & (~1));
19627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19628 OpenChannel_free(this_obj_conv);
19631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19632 LDKOpenChannel this_ptr_conv;
19633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19634 this_ptr_conv.is_owned = false;
19635 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
19640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19641 LDKOpenChannel this_ptr_conv;
19642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19643 this_ptr_conv.is_owned = false;
19644 LDKThirtyTwoBytes val_ref;
19645 CHECK((*env)->GetArrayLength(env, val) == 32);
19646 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19647 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
19650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19651 LDKOpenChannel this_ptr_conv;
19652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19653 this_ptr_conv.is_owned = false;
19654 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19655 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
19659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19660 LDKOpenChannel this_ptr_conv;
19661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19662 this_ptr_conv.is_owned = false;
19663 LDKThirtyTwoBytes val_ref;
19664 CHECK((*env)->GetArrayLength(env, val) == 32);
19665 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19666 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
19669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19670 LDKOpenChannel this_ptr_conv;
19671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19672 this_ptr_conv.is_owned = false;
19673 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
19677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19678 LDKOpenChannel this_ptr_conv;
19679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19680 this_ptr_conv.is_owned = false;
19681 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
19684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19685 LDKOpenChannel this_ptr_conv;
19686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19687 this_ptr_conv.is_owned = false;
19688 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
19692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19693 LDKOpenChannel this_ptr_conv;
19694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19695 this_ptr_conv.is_owned = false;
19696 OpenChannel_set_push_msat(&this_ptr_conv, val);
19699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19700 LDKOpenChannel this_ptr_conv;
19701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19702 this_ptr_conv.is_owned = false;
19703 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
19707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19708 LDKOpenChannel this_ptr_conv;
19709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19710 this_ptr_conv.is_owned = false;
19711 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19714 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) {
19715 LDKOpenChannel this_ptr_conv;
19716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19717 this_ptr_conv.is_owned = false;
19718 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19722 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) {
19723 LDKOpenChannel this_ptr_conv;
19724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19725 this_ptr_conv.is_owned = false;
19726 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
19729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19730 LDKOpenChannel this_ptr_conv;
19731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19732 this_ptr_conv.is_owned = false;
19733 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
19737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19738 LDKOpenChannel this_ptr_conv;
19739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19740 this_ptr_conv.is_owned = false;
19741 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
19744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19745 LDKOpenChannel this_ptr_conv;
19746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19747 this_ptr_conv.is_owned = false;
19748 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
19752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19753 LDKOpenChannel this_ptr_conv;
19754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19755 this_ptr_conv.is_owned = false;
19756 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
19759 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
19760 LDKOpenChannel this_ptr_conv;
19761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19762 this_ptr_conv.is_owned = false;
19763 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
19767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19768 LDKOpenChannel this_ptr_conv;
19769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19770 this_ptr_conv.is_owned = false;
19771 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
19774 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19775 LDKOpenChannel this_ptr_conv;
19776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19777 this_ptr_conv.is_owned = false;
19778 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
19782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19783 LDKOpenChannel this_ptr_conv;
19784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19785 this_ptr_conv.is_owned = false;
19786 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
19789 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
19790 LDKOpenChannel this_ptr_conv;
19791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19792 this_ptr_conv.is_owned = false;
19793 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
19797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19798 LDKOpenChannel this_ptr_conv;
19799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19800 this_ptr_conv.is_owned = false;
19801 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
19804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19805 LDKOpenChannel this_ptr_conv;
19806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19807 this_ptr_conv.is_owned = false;
19808 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19809 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
19813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19814 LDKOpenChannel this_ptr_conv;
19815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19816 this_ptr_conv.is_owned = false;
19817 LDKPublicKey val_ref;
19818 CHECK((*env)->GetArrayLength(env, val) == 33);
19819 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19820 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
19823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19824 LDKOpenChannel this_ptr_conv;
19825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19826 this_ptr_conv.is_owned = false;
19827 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19828 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
19832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19833 LDKOpenChannel this_ptr_conv;
19834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19835 this_ptr_conv.is_owned = false;
19836 LDKPublicKey val_ref;
19837 CHECK((*env)->GetArrayLength(env, val) == 33);
19838 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19839 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
19842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19843 LDKOpenChannel this_ptr_conv;
19844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19845 this_ptr_conv.is_owned = false;
19846 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
19851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19852 LDKOpenChannel this_ptr_conv;
19853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19854 this_ptr_conv.is_owned = false;
19855 LDKPublicKey val_ref;
19856 CHECK((*env)->GetArrayLength(env, val) == 33);
19857 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19858 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
19861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19862 LDKOpenChannel this_ptr_conv;
19863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19864 this_ptr_conv.is_owned = false;
19865 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19866 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
19870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19871 LDKOpenChannel this_ptr_conv;
19872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19873 this_ptr_conv.is_owned = false;
19874 LDKPublicKey val_ref;
19875 CHECK((*env)->GetArrayLength(env, val) == 33);
19876 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19877 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19881 LDKOpenChannel this_ptr_conv;
19882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19883 this_ptr_conv.is_owned = false;
19884 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19885 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
19889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19890 LDKOpenChannel this_ptr_conv;
19891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19892 this_ptr_conv.is_owned = false;
19893 LDKPublicKey val_ref;
19894 CHECK((*env)->GetArrayLength(env, val) == 33);
19895 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19896 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
19899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19900 LDKOpenChannel this_ptr_conv;
19901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19902 this_ptr_conv.is_owned = false;
19903 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19904 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
19908 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) {
19909 LDKOpenChannel this_ptr_conv;
19910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19911 this_ptr_conv.is_owned = false;
19912 LDKPublicKey val_ref;
19913 CHECK((*env)->GetArrayLength(env, val) == 33);
19914 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19915 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
19918 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
19919 LDKOpenChannel this_ptr_conv;
19920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19921 this_ptr_conv.is_owned = false;
19922 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
19926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
19927 LDKOpenChannel this_ptr_conv;
19928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19929 this_ptr_conv.is_owned = false;
19930 OpenChannel_set_channel_flags(&this_ptr_conv, val);
19933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19934 LDKOpenChannel orig_conv;
19935 orig_conv.inner = (void*)(orig & (~1));
19936 orig_conv.is_owned = false;
19937 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
19938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19940 uint64_t ret_ref = (uint64_t)ret_var.inner;
19941 if (ret_var.is_owned) {
19947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19948 LDKAcceptChannel this_obj_conv;
19949 this_obj_conv.inner = (void*)(this_obj & (~1));
19950 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19951 AcceptChannel_free(this_obj_conv);
19954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19955 LDKAcceptChannel this_ptr_conv;
19956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19957 this_ptr_conv.is_owned = false;
19958 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19959 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
19963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19964 LDKAcceptChannel this_ptr_conv;
19965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19966 this_ptr_conv.is_owned = false;
19967 LDKThirtyTwoBytes val_ref;
19968 CHECK((*env)->GetArrayLength(env, val) == 32);
19969 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19970 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
19973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19974 LDKAcceptChannel this_ptr_conv;
19975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19976 this_ptr_conv.is_owned = false;
19977 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
19981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19982 LDKAcceptChannel this_ptr_conv;
19983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19984 this_ptr_conv.is_owned = false;
19985 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19988 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) {
19989 LDKAcceptChannel this_ptr_conv;
19990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19991 this_ptr_conv.is_owned = false;
19992 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19996 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) {
19997 LDKAcceptChannel this_ptr_conv;
19998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19999 this_ptr_conv.is_owned = false;
20000 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
20003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20004 LDKAcceptChannel this_ptr_conv;
20005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20006 this_ptr_conv.is_owned = false;
20007 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
20011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20012 LDKAcceptChannel this_ptr_conv;
20013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20014 this_ptr_conv.is_owned = false;
20015 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
20018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20019 LDKAcceptChannel this_ptr_conv;
20020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20021 this_ptr_conv.is_owned = false;
20022 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
20026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20027 LDKAcceptChannel this_ptr_conv;
20028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20029 this_ptr_conv.is_owned = false;
20030 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
20033 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
20034 LDKAcceptChannel this_ptr_conv;
20035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20036 this_ptr_conv.is_owned = false;
20037 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
20041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20042 LDKAcceptChannel this_ptr_conv;
20043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20044 this_ptr_conv.is_owned = false;
20045 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
20048 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
20049 LDKAcceptChannel this_ptr_conv;
20050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20051 this_ptr_conv.is_owned = false;
20052 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
20056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20057 LDKAcceptChannel this_ptr_conv;
20058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20059 this_ptr_conv.is_owned = false;
20060 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
20063 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
20064 LDKAcceptChannel this_ptr_conv;
20065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20066 this_ptr_conv.is_owned = false;
20067 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
20071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20072 LDKAcceptChannel this_ptr_conv;
20073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20074 this_ptr_conv.is_owned = false;
20075 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
20078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
20079 LDKAcceptChannel this_ptr_conv;
20080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20081 this_ptr_conv.is_owned = false;
20082 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
20087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20088 LDKAcceptChannel this_ptr_conv;
20089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20090 this_ptr_conv.is_owned = false;
20091 LDKPublicKey val_ref;
20092 CHECK((*env)->GetArrayLength(env, val) == 33);
20093 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20094 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
20097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20098 LDKAcceptChannel this_ptr_conv;
20099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20100 this_ptr_conv.is_owned = false;
20101 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20102 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
20106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20107 LDKAcceptChannel this_ptr_conv;
20108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20109 this_ptr_conv.is_owned = false;
20110 LDKPublicKey val_ref;
20111 CHECK((*env)->GetArrayLength(env, val) == 33);
20112 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20113 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
20116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20117 LDKAcceptChannel this_ptr_conv;
20118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20119 this_ptr_conv.is_owned = false;
20120 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20121 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
20125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20126 LDKAcceptChannel this_ptr_conv;
20127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20128 this_ptr_conv.is_owned = false;
20129 LDKPublicKey val_ref;
20130 CHECK((*env)->GetArrayLength(env, val) == 33);
20131 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20132 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
20135 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20136 LDKAcceptChannel this_ptr_conv;
20137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20138 this_ptr_conv.is_owned = false;
20139 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20140 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
20144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20145 LDKAcceptChannel this_ptr_conv;
20146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20147 this_ptr_conv.is_owned = false;
20148 LDKPublicKey val_ref;
20149 CHECK((*env)->GetArrayLength(env, val) == 33);
20150 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20151 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
20154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
20155 LDKAcceptChannel this_ptr_conv;
20156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20157 this_ptr_conv.is_owned = false;
20158 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20159 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
20163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20164 LDKAcceptChannel this_ptr_conv;
20165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20166 this_ptr_conv.is_owned = false;
20167 LDKPublicKey val_ref;
20168 CHECK((*env)->GetArrayLength(env, val) == 33);
20169 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20170 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
20173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20174 LDKAcceptChannel this_ptr_conv;
20175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20176 this_ptr_conv.is_owned = false;
20177 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20178 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
20182 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) {
20183 LDKAcceptChannel this_ptr_conv;
20184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20185 this_ptr_conv.is_owned = false;
20186 LDKPublicKey val_ref;
20187 CHECK((*env)->GetArrayLength(env, val) == 33);
20188 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20189 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
20192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20193 LDKAcceptChannel orig_conv;
20194 orig_conv.inner = (void*)(orig & (~1));
20195 orig_conv.is_owned = false;
20196 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
20197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20199 uint64_t ret_ref = (uint64_t)ret_var.inner;
20200 if (ret_var.is_owned) {
20206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20207 LDKFundingCreated this_obj_conv;
20208 this_obj_conv.inner = (void*)(this_obj & (~1));
20209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20210 FundingCreated_free(this_obj_conv);
20213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20214 LDKFundingCreated this_ptr_conv;
20215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20216 this_ptr_conv.is_owned = false;
20217 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
20222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20223 LDKFundingCreated this_ptr_conv;
20224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20225 this_ptr_conv.is_owned = false;
20226 LDKThirtyTwoBytes val_ref;
20227 CHECK((*env)->GetArrayLength(env, val) == 32);
20228 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20229 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
20232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
20233 LDKFundingCreated this_ptr_conv;
20234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20235 this_ptr_conv.is_owned = false;
20236 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20237 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
20241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20242 LDKFundingCreated this_ptr_conv;
20243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20244 this_ptr_conv.is_owned = false;
20245 LDKThirtyTwoBytes val_ref;
20246 CHECK((*env)->GetArrayLength(env, val) == 32);
20247 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20248 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
20251 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
20252 LDKFundingCreated this_ptr_conv;
20253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20254 this_ptr_conv.is_owned = false;
20255 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
20259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20260 LDKFundingCreated this_ptr_conv;
20261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20262 this_ptr_conv.is_owned = false;
20263 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
20266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20267 LDKFundingCreated this_ptr_conv;
20268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20269 this_ptr_conv.is_owned = false;
20270 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20271 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
20275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20276 LDKFundingCreated this_ptr_conv;
20277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20278 this_ptr_conv.is_owned = false;
20279 LDKSignature val_ref;
20280 CHECK((*env)->GetArrayLength(env, val) == 64);
20281 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20282 FundingCreated_set_signature(&this_ptr_conv, val_ref);
20285 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) {
20286 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
20287 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
20288 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
20289 LDKThirtyTwoBytes funding_txid_arg_ref;
20290 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
20291 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
20292 LDKSignature signature_arg_ref;
20293 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20294 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20295 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
20296 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20297 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20298 uint64_t ret_ref = (uint64_t)ret_var.inner;
20299 if (ret_var.is_owned) {
20305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20306 LDKFundingCreated orig_conv;
20307 orig_conv.inner = (void*)(orig & (~1));
20308 orig_conv.is_owned = false;
20309 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
20310 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20311 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20312 uint64_t ret_ref = (uint64_t)ret_var.inner;
20313 if (ret_var.is_owned) {
20319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20320 LDKFundingSigned this_obj_conv;
20321 this_obj_conv.inner = (void*)(this_obj & (~1));
20322 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20323 FundingSigned_free(this_obj_conv);
20326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20327 LDKFundingSigned this_ptr_conv;
20328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20329 this_ptr_conv.is_owned = false;
20330 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20331 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
20335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20336 LDKFundingSigned this_ptr_conv;
20337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20338 this_ptr_conv.is_owned = false;
20339 LDKThirtyTwoBytes val_ref;
20340 CHECK((*env)->GetArrayLength(env, val) == 32);
20341 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20342 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
20345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20346 LDKFundingSigned this_ptr_conv;
20347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20348 this_ptr_conv.is_owned = false;
20349 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20350 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
20354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20355 LDKFundingSigned this_ptr_conv;
20356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20357 this_ptr_conv.is_owned = false;
20358 LDKSignature val_ref;
20359 CHECK((*env)->GetArrayLength(env, val) == 64);
20360 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20361 FundingSigned_set_signature(&this_ptr_conv, val_ref);
20364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
20365 LDKThirtyTwoBytes channel_id_arg_ref;
20366 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20367 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20368 LDKSignature signature_arg_ref;
20369 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20370 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20371 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
20372 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20373 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20374 uint64_t ret_ref = (uint64_t)ret_var.inner;
20375 if (ret_var.is_owned) {
20381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20382 LDKFundingSigned orig_conv;
20383 orig_conv.inner = (void*)(orig & (~1));
20384 orig_conv.is_owned = false;
20385 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
20386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20388 uint64_t ret_ref = (uint64_t)ret_var.inner;
20389 if (ret_var.is_owned) {
20395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20396 LDKFundingLocked this_obj_conv;
20397 this_obj_conv.inner = (void*)(this_obj & (~1));
20398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20399 FundingLocked_free(this_obj_conv);
20402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20403 LDKFundingLocked this_ptr_conv;
20404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20405 this_ptr_conv.is_owned = false;
20406 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20407 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
20411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20412 LDKFundingLocked this_ptr_conv;
20413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20414 this_ptr_conv.is_owned = false;
20415 LDKThirtyTwoBytes val_ref;
20416 CHECK((*env)->GetArrayLength(env, val) == 32);
20417 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20418 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
20421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20422 LDKFundingLocked this_ptr_conv;
20423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20424 this_ptr_conv.is_owned = false;
20425 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20426 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
20430 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) {
20431 LDKFundingLocked this_ptr_conv;
20432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20433 this_ptr_conv.is_owned = false;
20434 LDKPublicKey val_ref;
20435 CHECK((*env)->GetArrayLength(env, val) == 33);
20436 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20437 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
20440 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) {
20441 LDKThirtyTwoBytes channel_id_arg_ref;
20442 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20443 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20444 LDKPublicKey next_per_commitment_point_arg_ref;
20445 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
20446 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
20447 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
20448 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20449 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20450 uint64_t ret_ref = (uint64_t)ret_var.inner;
20451 if (ret_var.is_owned) {
20457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20458 LDKFundingLocked orig_conv;
20459 orig_conv.inner = (void*)(orig & (~1));
20460 orig_conv.is_owned = false;
20461 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
20462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20464 uint64_t ret_ref = (uint64_t)ret_var.inner;
20465 if (ret_var.is_owned) {
20471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20472 LDKShutdown this_obj_conv;
20473 this_obj_conv.inner = (void*)(this_obj & (~1));
20474 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20475 Shutdown_free(this_obj_conv);
20478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20479 LDKShutdown this_ptr_conv;
20480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20481 this_ptr_conv.is_owned = false;
20482 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20483 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
20487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20488 LDKShutdown this_ptr_conv;
20489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20490 this_ptr_conv.is_owned = false;
20491 LDKThirtyTwoBytes val_ref;
20492 CHECK((*env)->GetArrayLength(env, val) == 32);
20493 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20494 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
20497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
20498 LDKShutdown this_ptr_conv;
20499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20500 this_ptr_conv.is_owned = false;
20501 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
20502 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20503 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20508 LDKShutdown this_ptr_conv;
20509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20510 this_ptr_conv.is_owned = false;
20511 LDKCVec_u8Z val_ref;
20512 val_ref.datalen = (*env)->GetArrayLength(env, val);
20513 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
20514 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
20515 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
20518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
20519 LDKThirtyTwoBytes channel_id_arg_ref;
20520 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20521 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20522 LDKCVec_u8Z scriptpubkey_arg_ref;
20523 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
20524 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
20525 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
20526 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
20527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20529 uint64_t ret_ref = (uint64_t)ret_var.inner;
20530 if (ret_var.is_owned) {
20536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20537 LDKShutdown orig_conv;
20538 orig_conv.inner = (void*)(orig & (~1));
20539 orig_conv.is_owned = false;
20540 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
20541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20543 uint64_t ret_ref = (uint64_t)ret_var.inner;
20544 if (ret_var.is_owned) {
20550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20551 LDKClosingSignedFeeRange this_obj_conv;
20552 this_obj_conv.inner = (void*)(this_obj & (~1));
20553 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20554 ClosingSignedFeeRange_free(this_obj_conv);
20557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20558 LDKClosingSignedFeeRange this_ptr_conv;
20559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20560 this_ptr_conv.is_owned = false;
20561 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
20565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20566 LDKClosingSignedFeeRange this_ptr_conv;
20567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20568 this_ptr_conv.is_owned = false;
20569 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
20572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20573 LDKClosingSignedFeeRange this_ptr_conv;
20574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20575 this_ptr_conv.is_owned = false;
20576 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
20580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20581 LDKClosingSignedFeeRange this_ptr_conv;
20582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20583 this_ptr_conv.is_owned = false;
20584 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
20587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
20588 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
20589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20591 uint64_t ret_ref = (uint64_t)ret_var.inner;
20592 if (ret_var.is_owned) {
20598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20599 LDKClosingSignedFeeRange orig_conv;
20600 orig_conv.inner = (void*)(orig & (~1));
20601 orig_conv.is_owned = false;
20602 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
20603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20605 uint64_t ret_ref = (uint64_t)ret_var.inner;
20606 if (ret_var.is_owned) {
20612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20613 LDKClosingSigned this_obj_conv;
20614 this_obj_conv.inner = (void*)(this_obj & (~1));
20615 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20616 ClosingSigned_free(this_obj_conv);
20619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20620 LDKClosingSigned this_ptr_conv;
20621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20622 this_ptr_conv.is_owned = false;
20623 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20624 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
20628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20629 LDKClosingSigned this_ptr_conv;
20630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20631 this_ptr_conv.is_owned = false;
20632 LDKThirtyTwoBytes val_ref;
20633 CHECK((*env)->GetArrayLength(env, val) == 32);
20634 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20635 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
20638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20639 LDKClosingSigned this_ptr_conv;
20640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20641 this_ptr_conv.is_owned = false;
20642 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
20646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20647 LDKClosingSigned this_ptr_conv;
20648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20649 this_ptr_conv.is_owned = false;
20650 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
20653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20654 LDKClosingSigned this_ptr_conv;
20655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20656 this_ptr_conv.is_owned = false;
20657 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20658 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
20662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20663 LDKClosingSigned this_ptr_conv;
20664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20665 this_ptr_conv.is_owned = false;
20666 LDKSignature val_ref;
20667 CHECK((*env)->GetArrayLength(env, val) == 64);
20668 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20669 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
20672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
20673 LDKClosingSigned this_ptr_conv;
20674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20675 this_ptr_conv.is_owned = false;
20676 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
20677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20679 uint64_t ret_ref = (uint64_t)ret_var.inner;
20680 if (ret_var.is_owned) {
20686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20687 LDKClosingSigned this_ptr_conv;
20688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20689 this_ptr_conv.is_owned = false;
20690 LDKClosingSignedFeeRange val_conv;
20691 val_conv.inner = (void*)(val & (~1));
20692 val_conv.is_owned = (val & 1) || (val == 0);
20693 val_conv = ClosingSignedFeeRange_clone(&val_conv);
20694 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
20697 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, int64_t fee_range_arg) {
20698 LDKThirtyTwoBytes channel_id_arg_ref;
20699 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20700 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20701 LDKSignature signature_arg_ref;
20702 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20703 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20704 LDKClosingSignedFeeRange fee_range_arg_conv;
20705 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
20706 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
20707 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
20708 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
20709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20711 uint64_t ret_ref = (uint64_t)ret_var.inner;
20712 if (ret_var.is_owned) {
20718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20719 LDKClosingSigned orig_conv;
20720 orig_conv.inner = (void*)(orig & (~1));
20721 orig_conv.is_owned = false;
20722 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
20723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20725 uint64_t ret_ref = (uint64_t)ret_var.inner;
20726 if (ret_var.is_owned) {
20732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20733 LDKUpdateAddHTLC this_obj_conv;
20734 this_obj_conv.inner = (void*)(this_obj & (~1));
20735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20736 UpdateAddHTLC_free(this_obj_conv);
20739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20740 LDKUpdateAddHTLC this_ptr_conv;
20741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20742 this_ptr_conv.is_owned = false;
20743 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20744 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
20748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20749 LDKUpdateAddHTLC this_ptr_conv;
20750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20751 this_ptr_conv.is_owned = false;
20752 LDKThirtyTwoBytes val_ref;
20753 CHECK((*env)->GetArrayLength(env, val) == 32);
20754 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20755 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
20758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20759 LDKUpdateAddHTLC this_ptr_conv;
20760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20761 this_ptr_conv.is_owned = false;
20762 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
20766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20767 LDKUpdateAddHTLC this_ptr_conv;
20768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20769 this_ptr_conv.is_owned = false;
20770 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
20773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20774 LDKUpdateAddHTLC this_ptr_conv;
20775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20776 this_ptr_conv.is_owned = false;
20777 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
20781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20782 LDKUpdateAddHTLC this_ptr_conv;
20783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20784 this_ptr_conv.is_owned = false;
20785 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
20788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20789 LDKUpdateAddHTLC this_ptr_conv;
20790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20791 this_ptr_conv.is_owned = false;
20792 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20793 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
20797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20798 LDKUpdateAddHTLC this_ptr_conv;
20799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20800 this_ptr_conv.is_owned = false;
20801 LDKThirtyTwoBytes val_ref;
20802 CHECK((*env)->GetArrayLength(env, val) == 32);
20803 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20804 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
20807 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
20808 LDKUpdateAddHTLC this_ptr_conv;
20809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20810 this_ptr_conv.is_owned = false;
20811 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
20815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20816 LDKUpdateAddHTLC this_ptr_conv;
20817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20818 this_ptr_conv.is_owned = false;
20819 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
20822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20823 LDKUpdateAddHTLC orig_conv;
20824 orig_conv.inner = (void*)(orig & (~1));
20825 orig_conv.is_owned = false;
20826 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
20827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20829 uint64_t ret_ref = (uint64_t)ret_var.inner;
20830 if (ret_var.is_owned) {
20836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20837 LDKUpdateFulfillHTLC this_obj_conv;
20838 this_obj_conv.inner = (void*)(this_obj & (~1));
20839 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20840 UpdateFulfillHTLC_free(this_obj_conv);
20843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20844 LDKUpdateFulfillHTLC this_ptr_conv;
20845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20846 this_ptr_conv.is_owned = false;
20847 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
20852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20853 LDKUpdateFulfillHTLC this_ptr_conv;
20854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20855 this_ptr_conv.is_owned = false;
20856 LDKThirtyTwoBytes val_ref;
20857 CHECK((*env)->GetArrayLength(env, val) == 32);
20858 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20859 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
20862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20863 LDKUpdateFulfillHTLC this_ptr_conv;
20864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20865 this_ptr_conv.is_owned = false;
20866 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
20870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20871 LDKUpdateFulfillHTLC this_ptr_conv;
20872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20873 this_ptr_conv.is_owned = false;
20874 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
20877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
20878 LDKUpdateFulfillHTLC this_ptr_conv;
20879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20880 this_ptr_conv.is_owned = false;
20881 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20882 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
20886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20887 LDKUpdateFulfillHTLC this_ptr_conv;
20888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20889 this_ptr_conv.is_owned = false;
20890 LDKThirtyTwoBytes val_ref;
20891 CHECK((*env)->GetArrayLength(env, val) == 32);
20892 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20893 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
20896 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) {
20897 LDKThirtyTwoBytes channel_id_arg_ref;
20898 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20899 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20900 LDKThirtyTwoBytes payment_preimage_arg_ref;
20901 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
20902 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
20903 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
20904 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20905 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20906 uint64_t ret_ref = (uint64_t)ret_var.inner;
20907 if (ret_var.is_owned) {
20913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20914 LDKUpdateFulfillHTLC orig_conv;
20915 orig_conv.inner = (void*)(orig & (~1));
20916 orig_conv.is_owned = false;
20917 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
20918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20920 uint64_t ret_ref = (uint64_t)ret_var.inner;
20921 if (ret_var.is_owned) {
20927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20928 LDKUpdateFailHTLC this_obj_conv;
20929 this_obj_conv.inner = (void*)(this_obj & (~1));
20930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20931 UpdateFailHTLC_free(this_obj_conv);
20934 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20935 LDKUpdateFailHTLC this_ptr_conv;
20936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20937 this_ptr_conv.is_owned = false;
20938 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20939 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
20943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20944 LDKUpdateFailHTLC this_ptr_conv;
20945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20946 this_ptr_conv.is_owned = false;
20947 LDKThirtyTwoBytes val_ref;
20948 CHECK((*env)->GetArrayLength(env, val) == 32);
20949 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20950 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
20953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20954 LDKUpdateFailHTLC this_ptr_conv;
20955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20956 this_ptr_conv.is_owned = false;
20957 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
20961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20962 LDKUpdateFailHTLC this_ptr_conv;
20963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20964 this_ptr_conv.is_owned = false;
20965 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
20968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20969 LDKUpdateFailHTLC orig_conv;
20970 orig_conv.inner = (void*)(orig & (~1));
20971 orig_conv.is_owned = false;
20972 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
20973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20975 uint64_t ret_ref = (uint64_t)ret_var.inner;
20976 if (ret_var.is_owned) {
20982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20983 LDKUpdateFailMalformedHTLC this_obj_conv;
20984 this_obj_conv.inner = (void*)(this_obj & (~1));
20985 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20986 UpdateFailMalformedHTLC_free(this_obj_conv);
20989 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20990 LDKUpdateFailMalformedHTLC this_ptr_conv;
20991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20992 this_ptr_conv.is_owned = false;
20993 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20994 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
20998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20999 LDKUpdateFailMalformedHTLC this_ptr_conv;
21000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21001 this_ptr_conv.is_owned = false;
21002 LDKThirtyTwoBytes val_ref;
21003 CHECK((*env)->GetArrayLength(env, val) == 32);
21004 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21005 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
21008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21009 LDKUpdateFailMalformedHTLC this_ptr_conv;
21010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21011 this_ptr_conv.is_owned = false;
21012 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
21016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21017 LDKUpdateFailMalformedHTLC this_ptr_conv;
21018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21019 this_ptr_conv.is_owned = false;
21020 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
21023 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
21024 LDKUpdateFailMalformedHTLC this_ptr_conv;
21025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21026 this_ptr_conv.is_owned = false;
21027 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
21031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21032 LDKUpdateFailMalformedHTLC this_ptr_conv;
21033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21034 this_ptr_conv.is_owned = false;
21035 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
21038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21039 LDKUpdateFailMalformedHTLC orig_conv;
21040 orig_conv.inner = (void*)(orig & (~1));
21041 orig_conv.is_owned = false;
21042 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
21043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21045 uint64_t ret_ref = (uint64_t)ret_var.inner;
21046 if (ret_var.is_owned) {
21052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21053 LDKCommitmentSigned this_obj_conv;
21054 this_obj_conv.inner = (void*)(this_obj & (~1));
21055 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21056 CommitmentSigned_free(this_obj_conv);
21059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21060 LDKCommitmentSigned this_ptr_conv;
21061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21062 this_ptr_conv.is_owned = false;
21063 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21064 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
21068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21069 LDKCommitmentSigned this_ptr_conv;
21070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21071 this_ptr_conv.is_owned = false;
21072 LDKThirtyTwoBytes val_ref;
21073 CHECK((*env)->GetArrayLength(env, val) == 32);
21074 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21075 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
21078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21079 LDKCommitmentSigned this_ptr_conv;
21080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21081 this_ptr_conv.is_owned = false;
21082 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
21087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21088 LDKCommitmentSigned this_ptr_conv;
21089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21090 this_ptr_conv.is_owned = false;
21091 LDKSignature val_ref;
21092 CHECK((*env)->GetArrayLength(env, val) == 64);
21093 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21094 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
21097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
21098 LDKCommitmentSigned this_ptr_conv;
21099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21100 this_ptr_conv.is_owned = false;
21101 LDKCVec_SignatureZ val_constr;
21102 val_constr.datalen = (*env)->GetArrayLength(env, val);
21103 if (val_constr.datalen > 0)
21104 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21106 val_constr.data = NULL;
21107 for (size_t i = 0; i < val_constr.datalen; i++) {
21108 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
21109 LDKSignature val_conv_8_ref;
21110 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
21111 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
21112 val_constr.data[i] = val_conv_8_ref;
21114 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
21117 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) {
21118 LDKThirtyTwoBytes channel_id_arg_ref;
21119 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21120 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21121 LDKSignature signature_arg_ref;
21122 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21123 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21124 LDKCVec_SignatureZ htlc_signatures_arg_constr;
21125 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
21126 if (htlc_signatures_arg_constr.datalen > 0)
21127 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21129 htlc_signatures_arg_constr.data = NULL;
21130 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
21131 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
21132 LDKSignature htlc_signatures_arg_conv_8_ref;
21133 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
21134 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
21135 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
21137 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
21138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21140 uint64_t ret_ref = (uint64_t)ret_var.inner;
21141 if (ret_var.is_owned) {
21147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21148 LDKCommitmentSigned orig_conv;
21149 orig_conv.inner = (void*)(orig & (~1));
21150 orig_conv.is_owned = false;
21151 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
21152 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21153 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21154 uint64_t ret_ref = (uint64_t)ret_var.inner;
21155 if (ret_var.is_owned) {
21161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21162 LDKRevokeAndACK this_obj_conv;
21163 this_obj_conv.inner = (void*)(this_obj & (~1));
21164 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21165 RevokeAndACK_free(this_obj_conv);
21168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21169 LDKRevokeAndACK this_ptr_conv;
21170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21171 this_ptr_conv.is_owned = false;
21172 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21173 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
21177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21178 LDKRevokeAndACK this_ptr_conv;
21179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21180 this_ptr_conv.is_owned = false;
21181 LDKThirtyTwoBytes val_ref;
21182 CHECK((*env)->GetArrayLength(env, val) == 32);
21183 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21184 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
21187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
21188 LDKRevokeAndACK this_ptr_conv;
21189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21190 this_ptr_conv.is_owned = false;
21191 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21192 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
21196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21197 LDKRevokeAndACK this_ptr_conv;
21198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21199 this_ptr_conv.is_owned = false;
21200 LDKThirtyTwoBytes val_ref;
21201 CHECK((*env)->GetArrayLength(env, val) == 32);
21202 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21203 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
21206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21207 LDKRevokeAndACK this_ptr_conv;
21208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21209 this_ptr_conv.is_owned = false;
21210 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21211 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
21215 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) {
21216 LDKRevokeAndACK this_ptr_conv;
21217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21218 this_ptr_conv.is_owned = false;
21219 LDKPublicKey val_ref;
21220 CHECK((*env)->GetArrayLength(env, val) == 33);
21221 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21222 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
21225 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) {
21226 LDKThirtyTwoBytes channel_id_arg_ref;
21227 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21228 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21229 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
21230 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
21231 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
21232 LDKPublicKey next_per_commitment_point_arg_ref;
21233 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
21234 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
21235 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
21236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21238 uint64_t ret_ref = (uint64_t)ret_var.inner;
21239 if (ret_var.is_owned) {
21245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21246 LDKRevokeAndACK orig_conv;
21247 orig_conv.inner = (void*)(orig & (~1));
21248 orig_conv.is_owned = false;
21249 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
21250 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21251 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21252 uint64_t ret_ref = (uint64_t)ret_var.inner;
21253 if (ret_var.is_owned) {
21259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21260 LDKUpdateFee this_obj_conv;
21261 this_obj_conv.inner = (void*)(this_obj & (~1));
21262 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21263 UpdateFee_free(this_obj_conv);
21266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21267 LDKUpdateFee this_ptr_conv;
21268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21269 this_ptr_conv.is_owned = false;
21270 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21271 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
21275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21276 LDKUpdateFee this_ptr_conv;
21277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21278 this_ptr_conv.is_owned = false;
21279 LDKThirtyTwoBytes val_ref;
21280 CHECK((*env)->GetArrayLength(env, val) == 32);
21281 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21282 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
21285 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
21286 LDKUpdateFee this_ptr_conv;
21287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21288 this_ptr_conv.is_owned = false;
21289 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
21293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21294 LDKUpdateFee this_ptr_conv;
21295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21296 this_ptr_conv.is_owned = false;
21297 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
21300 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) {
21301 LDKThirtyTwoBytes channel_id_arg_ref;
21302 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21303 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21304 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
21305 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21306 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21307 uint64_t ret_ref = (uint64_t)ret_var.inner;
21308 if (ret_var.is_owned) {
21314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21315 LDKUpdateFee orig_conv;
21316 orig_conv.inner = (void*)(orig & (~1));
21317 orig_conv.is_owned = false;
21318 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
21319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21321 uint64_t ret_ref = (uint64_t)ret_var.inner;
21322 if (ret_var.is_owned) {
21328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21329 LDKDataLossProtect this_obj_conv;
21330 this_obj_conv.inner = (void*)(this_obj & (~1));
21331 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21332 DataLossProtect_free(this_obj_conv);
21335 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
21336 LDKDataLossProtect this_ptr_conv;
21337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21338 this_ptr_conv.is_owned = false;
21339 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21340 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
21344 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) {
21345 LDKDataLossProtect this_ptr_conv;
21346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21347 this_ptr_conv.is_owned = false;
21348 LDKThirtyTwoBytes val_ref;
21349 CHECK((*env)->GetArrayLength(env, val) == 32);
21350 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21351 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
21354 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21355 LDKDataLossProtect this_ptr_conv;
21356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21357 this_ptr_conv.is_owned = false;
21358 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21359 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
21363 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) {
21364 LDKDataLossProtect this_ptr_conv;
21365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21366 this_ptr_conv.is_owned = false;
21367 LDKPublicKey val_ref;
21368 CHECK((*env)->GetArrayLength(env, val) == 33);
21369 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21370 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
21373 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) {
21374 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
21375 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
21376 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
21377 LDKPublicKey my_current_per_commitment_point_arg_ref;
21378 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
21379 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
21380 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
21381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21383 uint64_t ret_ref = (uint64_t)ret_var.inner;
21384 if (ret_var.is_owned) {
21390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21391 LDKDataLossProtect orig_conv;
21392 orig_conv.inner = (void*)(orig & (~1));
21393 orig_conv.is_owned = false;
21394 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
21395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21397 uint64_t ret_ref = (uint64_t)ret_var.inner;
21398 if (ret_var.is_owned) {
21404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21405 LDKChannelReestablish this_obj_conv;
21406 this_obj_conv.inner = (void*)(this_obj & (~1));
21407 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21408 ChannelReestablish_free(this_obj_conv);
21411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21412 LDKChannelReestablish this_ptr_conv;
21413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21414 this_ptr_conv.is_owned = false;
21415 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21416 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
21420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21421 LDKChannelReestablish this_ptr_conv;
21422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21423 this_ptr_conv.is_owned = false;
21424 LDKThirtyTwoBytes val_ref;
21425 CHECK((*env)->GetArrayLength(env, val) == 32);
21426 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21427 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
21430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
21431 LDKChannelReestablish this_ptr_conv;
21432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21433 this_ptr_conv.is_owned = false;
21434 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
21438 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) {
21439 LDKChannelReestablish this_ptr_conv;
21440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21441 this_ptr_conv.is_owned = false;
21442 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
21445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
21446 LDKChannelReestablish this_ptr_conv;
21447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21448 this_ptr_conv.is_owned = false;
21449 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
21453 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) {
21454 LDKChannelReestablish this_ptr_conv;
21455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21456 this_ptr_conv.is_owned = false;
21457 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
21460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21461 LDKChannelReestablish orig_conv;
21462 orig_conv.inner = (void*)(orig & (~1));
21463 orig_conv.is_owned = false;
21464 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
21465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21467 uint64_t ret_ref = (uint64_t)ret_var.inner;
21468 if (ret_var.is_owned) {
21474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21475 LDKAnnouncementSignatures this_obj_conv;
21476 this_obj_conv.inner = (void*)(this_obj & (~1));
21477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21478 AnnouncementSignatures_free(this_obj_conv);
21481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21482 LDKAnnouncementSignatures this_ptr_conv;
21483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21484 this_ptr_conv.is_owned = false;
21485 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21486 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
21490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21491 LDKAnnouncementSignatures this_ptr_conv;
21492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21493 this_ptr_conv.is_owned = false;
21494 LDKThirtyTwoBytes val_ref;
21495 CHECK((*env)->GetArrayLength(env, val) == 32);
21496 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21497 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
21500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21501 LDKAnnouncementSignatures this_ptr_conv;
21502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21503 this_ptr_conv.is_owned = false;
21504 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
21508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21509 LDKAnnouncementSignatures this_ptr_conv;
21510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21511 this_ptr_conv.is_owned = false;
21512 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
21515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21516 LDKAnnouncementSignatures this_ptr_conv;
21517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21518 this_ptr_conv.is_owned = false;
21519 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21520 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
21524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21525 LDKAnnouncementSignatures this_ptr_conv;
21526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21527 this_ptr_conv.is_owned = false;
21528 LDKSignature val_ref;
21529 CHECK((*env)->GetArrayLength(env, val) == 64);
21530 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21531 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
21534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21535 LDKAnnouncementSignatures this_ptr_conv;
21536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21537 this_ptr_conv.is_owned = false;
21538 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21539 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
21543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21544 LDKAnnouncementSignatures this_ptr_conv;
21545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21546 this_ptr_conv.is_owned = false;
21547 LDKSignature val_ref;
21548 CHECK((*env)->GetArrayLength(env, val) == 64);
21549 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21550 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
21553 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) {
21554 LDKThirtyTwoBytes channel_id_arg_ref;
21555 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21556 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21557 LDKSignature node_signature_arg_ref;
21558 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
21559 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
21560 LDKSignature bitcoin_signature_arg_ref;
21561 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
21562 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
21563 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
21564 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21565 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21566 uint64_t ret_ref = (uint64_t)ret_var.inner;
21567 if (ret_var.is_owned) {
21573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21574 LDKAnnouncementSignatures orig_conv;
21575 orig_conv.inner = (void*)(orig & (~1));
21576 orig_conv.is_owned = false;
21577 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
21578 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21579 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21580 uint64_t ret_ref = (uint64_t)ret_var.inner;
21581 if (ret_var.is_owned) {
21587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21588 if ((this_ptr & 1) != 0) return;
21589 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
21590 FREE((void*)this_ptr);
21591 NetAddress_free(this_ptr_conv);
21594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21595 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
21596 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21597 *ret_copy = NetAddress_clone(orig_conv);
21598 uint64_t ret_ref = (uint64_t)ret_copy;
21602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21603 LDKFourBytes addr_ref;
21604 CHECK((*env)->GetArrayLength(env, addr) == 4);
21605 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
21606 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21607 *ret_copy = NetAddress_ipv4(addr_ref, port);
21608 uint64_t ret_ref = (uint64_t)ret_copy;
21612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21613 LDKSixteenBytes addr_ref;
21614 CHECK((*env)->GetArrayLength(env, addr) == 16);
21615 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
21616 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21617 *ret_copy = NetAddress_ipv6(addr_ref, port);
21618 uint64_t ret_ref = (uint64_t)ret_copy;
21622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21623 LDKTenBytes addr_ref;
21624 CHECK((*env)->GetArrayLength(env, addr) == 10);
21625 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
21626 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21627 *ret_copy = NetAddress_onion_v2(addr_ref, port);
21628 uint64_t ret_ref = (uint64_t)ret_copy;
21632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
21633 LDKThirtyTwoBytes ed25519_pubkey_ref;
21634 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
21635 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
21636 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21637 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
21638 uint64_t ret_ref = (uint64_t)ret_copy;
21642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
21643 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
21644 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
21645 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21646 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21647 CVec_u8Z_free(ret_var);
21651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21652 LDKu8slice ser_ref;
21653 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21654 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21655 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
21656 *ret_conv = Result_read(ser_ref);
21657 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21658 return (uint64_t)ret_conv;
21661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21662 LDKu8slice ser_ref;
21663 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21664 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21665 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21666 *ret_conv = NetAddress_read(ser_ref);
21667 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21668 return (uint64_t)ret_conv;
21671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21672 LDKUnsignedNodeAnnouncement this_obj_conv;
21673 this_obj_conv.inner = (void*)(this_obj & (~1));
21674 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21675 UnsignedNodeAnnouncement_free(this_obj_conv);
21678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
21679 LDKUnsignedNodeAnnouncement this_ptr_conv;
21680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21681 this_ptr_conv.is_owned = false;
21682 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
21683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21685 uint64_t ret_ref = (uint64_t)ret_var.inner;
21686 if (ret_var.is_owned) {
21692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21693 LDKUnsignedNodeAnnouncement this_ptr_conv;
21694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21695 this_ptr_conv.is_owned = false;
21696 LDKNodeFeatures val_conv;
21697 val_conv.inner = (void*)(val & (~1));
21698 val_conv.is_owned = (val & 1) || (val == 0);
21699 val_conv = NodeFeatures_clone(&val_conv);
21700 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
21703 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
21704 LDKUnsignedNodeAnnouncement this_ptr_conv;
21705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21706 this_ptr_conv.is_owned = false;
21707 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
21711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21712 LDKUnsignedNodeAnnouncement this_ptr_conv;
21713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21714 this_ptr_conv.is_owned = false;
21715 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
21718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21719 LDKUnsignedNodeAnnouncement this_ptr_conv;
21720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21721 this_ptr_conv.is_owned = false;
21722 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21723 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
21727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21728 LDKUnsignedNodeAnnouncement this_ptr_conv;
21729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21730 this_ptr_conv.is_owned = false;
21731 LDKPublicKey val_ref;
21732 CHECK((*env)->GetArrayLength(env, val) == 33);
21733 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21734 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
21737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
21738 LDKUnsignedNodeAnnouncement this_ptr_conv;
21739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21740 this_ptr_conv.is_owned = false;
21741 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
21742 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
21746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21747 LDKUnsignedNodeAnnouncement this_ptr_conv;
21748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21749 this_ptr_conv.is_owned = false;
21750 LDKThreeBytes val_ref;
21751 CHECK((*env)->GetArrayLength(env, val) == 3);
21752 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
21753 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
21756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
21757 LDKUnsignedNodeAnnouncement this_ptr_conv;
21758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21759 this_ptr_conv.is_owned = false;
21760 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21761 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
21765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21766 LDKUnsignedNodeAnnouncement this_ptr_conv;
21767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21768 this_ptr_conv.is_owned = false;
21769 LDKThirtyTwoBytes val_ref;
21770 CHECK((*env)->GetArrayLength(env, val) == 32);
21771 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21772 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
21775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21776 LDKUnsignedNodeAnnouncement this_ptr_conv;
21777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21778 this_ptr_conv.is_owned = false;
21779 LDKCVec_NetAddressZ val_constr;
21780 val_constr.datalen = (*env)->GetArrayLength(env, val);
21781 if (val_constr.datalen > 0)
21782 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21784 val_constr.data = NULL;
21785 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21786 for (size_t m = 0; m < val_constr.datalen; m++) {
21787 int64_t val_conv_12 = val_vals[m];
21788 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
21789 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
21790 val_constr.data[m] = val_conv_12_conv;
21792 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21793 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
21796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21797 LDKUnsignedNodeAnnouncement orig_conv;
21798 orig_conv.inner = (void*)(orig & (~1));
21799 orig_conv.is_owned = false;
21800 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
21801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21803 uint64_t ret_ref = (uint64_t)ret_var.inner;
21804 if (ret_var.is_owned) {
21810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21811 LDKNodeAnnouncement this_obj_conv;
21812 this_obj_conv.inner = (void*)(this_obj & (~1));
21813 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21814 NodeAnnouncement_free(this_obj_conv);
21817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21818 LDKNodeAnnouncement this_ptr_conv;
21819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21820 this_ptr_conv.is_owned = false;
21821 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21822 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
21826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21827 LDKNodeAnnouncement this_ptr_conv;
21828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21829 this_ptr_conv.is_owned = false;
21830 LDKSignature val_ref;
21831 CHECK((*env)->GetArrayLength(env, val) == 64);
21832 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21833 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
21836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
21837 LDKNodeAnnouncement this_ptr_conv;
21838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21839 this_ptr_conv.is_owned = false;
21840 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
21841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21843 uint64_t ret_ref = (uint64_t)ret_var.inner;
21844 if (ret_var.is_owned) {
21850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21851 LDKNodeAnnouncement this_ptr_conv;
21852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21853 this_ptr_conv.is_owned = false;
21854 LDKUnsignedNodeAnnouncement val_conv;
21855 val_conv.inner = (void*)(val & (~1));
21856 val_conv.is_owned = (val & 1) || (val == 0);
21857 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
21858 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
21861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
21862 LDKSignature signature_arg_ref;
21863 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21864 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21865 LDKUnsignedNodeAnnouncement contents_arg_conv;
21866 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21867 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21868 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
21869 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
21870 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21871 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21872 uint64_t ret_ref = (uint64_t)ret_var.inner;
21873 if (ret_var.is_owned) {
21879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21880 LDKNodeAnnouncement orig_conv;
21881 orig_conv.inner = (void*)(orig & (~1));
21882 orig_conv.is_owned = false;
21883 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_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_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21894 LDKUnsignedChannelAnnouncement 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 UnsignedChannelAnnouncement_free(this_obj_conv);
21900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
21901 LDKUnsignedChannelAnnouncement this_ptr_conv;
21902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21903 this_ptr_conv.is_owned = false;
21904 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
21905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21907 uint64_t ret_ref = (uint64_t)ret_var.inner;
21908 if (ret_var.is_owned) {
21914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21915 LDKUnsignedChannelAnnouncement this_ptr_conv;
21916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21917 this_ptr_conv.is_owned = false;
21918 LDKChannelFeatures val_conv;
21919 val_conv.inner = (void*)(val & (~1));
21920 val_conv.is_owned = (val & 1) || (val == 0);
21921 val_conv = ChannelFeatures_clone(&val_conv);
21922 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
21925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21926 LDKUnsignedChannelAnnouncement this_ptr_conv;
21927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21928 this_ptr_conv.is_owned = false;
21929 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21930 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
21934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21935 LDKUnsignedChannelAnnouncement this_ptr_conv;
21936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21937 this_ptr_conv.is_owned = false;
21938 LDKThirtyTwoBytes val_ref;
21939 CHECK((*env)->GetArrayLength(env, val) == 32);
21940 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21941 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
21944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21945 LDKUnsignedChannelAnnouncement this_ptr_conv;
21946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21947 this_ptr_conv.is_owned = false;
21948 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
21952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21953 LDKUnsignedChannelAnnouncement this_ptr_conv;
21954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21955 this_ptr_conv.is_owned = false;
21956 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
21959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21960 LDKUnsignedChannelAnnouncement this_ptr_conv;
21961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21962 this_ptr_conv.is_owned = false;
21963 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21964 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
21968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21969 LDKUnsignedChannelAnnouncement this_ptr_conv;
21970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21971 this_ptr_conv.is_owned = false;
21972 LDKPublicKey val_ref;
21973 CHECK((*env)->GetArrayLength(env, val) == 33);
21974 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21975 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
21978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21979 LDKUnsignedChannelAnnouncement this_ptr_conv;
21980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21981 this_ptr_conv.is_owned = false;
21982 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21983 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
21987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21988 LDKUnsignedChannelAnnouncement this_ptr_conv;
21989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21990 this_ptr_conv.is_owned = false;
21991 LDKPublicKey val_ref;
21992 CHECK((*env)->GetArrayLength(env, val) == 33);
21993 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21994 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
21997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21998 LDKUnsignedChannelAnnouncement this_ptr_conv;
21999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22000 this_ptr_conv.is_owned = false;
22001 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22002 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
22006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22007 LDKUnsignedChannelAnnouncement this_ptr_conv;
22008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22009 this_ptr_conv.is_owned = false;
22010 LDKPublicKey val_ref;
22011 CHECK((*env)->GetArrayLength(env, val) == 33);
22012 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22013 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
22016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
22017 LDKUnsignedChannelAnnouncement this_ptr_conv;
22018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22019 this_ptr_conv.is_owned = false;
22020 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22021 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
22025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22026 LDKUnsignedChannelAnnouncement this_ptr_conv;
22027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22028 this_ptr_conv.is_owned = false;
22029 LDKPublicKey val_ref;
22030 CHECK((*env)->GetArrayLength(env, val) == 33);
22031 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22032 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
22035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22036 LDKUnsignedChannelAnnouncement orig_conv;
22037 orig_conv.inner = (void*)(orig & (~1));
22038 orig_conv.is_owned = false;
22039 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
22040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22042 uint64_t ret_ref = (uint64_t)ret_var.inner;
22043 if (ret_var.is_owned) {
22049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22050 LDKChannelAnnouncement this_obj_conv;
22051 this_obj_conv.inner = (void*)(this_obj & (~1));
22052 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22053 ChannelAnnouncement_free(this_obj_conv);
22056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
22057 LDKChannelAnnouncement this_ptr_conv;
22058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22059 this_ptr_conv.is_owned = false;
22060 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22061 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
22065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22066 LDKChannelAnnouncement this_ptr_conv;
22067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22068 this_ptr_conv.is_owned = false;
22069 LDKSignature val_ref;
22070 CHECK((*env)->GetArrayLength(env, val) == 64);
22071 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22072 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
22075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
22076 LDKChannelAnnouncement this_ptr_conv;
22077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22078 this_ptr_conv.is_owned = false;
22079 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22080 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
22084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22085 LDKChannelAnnouncement this_ptr_conv;
22086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22087 this_ptr_conv.is_owned = false;
22088 LDKSignature val_ref;
22089 CHECK((*env)->GetArrayLength(env, val) == 64);
22090 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22091 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
22094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
22095 LDKChannelAnnouncement this_ptr_conv;
22096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22097 this_ptr_conv.is_owned = false;
22098 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22099 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
22103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22104 LDKChannelAnnouncement this_ptr_conv;
22105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22106 this_ptr_conv.is_owned = false;
22107 LDKSignature val_ref;
22108 CHECK((*env)->GetArrayLength(env, val) == 64);
22109 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22110 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
22113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
22114 LDKChannelAnnouncement this_ptr_conv;
22115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22116 this_ptr_conv.is_owned = false;
22117 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22118 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
22122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22123 LDKChannelAnnouncement this_ptr_conv;
22124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22125 this_ptr_conv.is_owned = false;
22126 LDKSignature val_ref;
22127 CHECK((*env)->GetArrayLength(env, val) == 64);
22128 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22129 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
22132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
22133 LDKChannelAnnouncement this_ptr_conv;
22134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22135 this_ptr_conv.is_owned = false;
22136 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
22137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22139 uint64_t ret_ref = (uint64_t)ret_var.inner;
22140 if (ret_var.is_owned) {
22146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22147 LDKChannelAnnouncement this_ptr_conv;
22148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22149 this_ptr_conv.is_owned = false;
22150 LDKUnsignedChannelAnnouncement val_conv;
22151 val_conv.inner = (void*)(val & (~1));
22152 val_conv.is_owned = (val & 1) || (val == 0);
22153 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
22154 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
22157 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) {
22158 LDKSignature node_signature_1_arg_ref;
22159 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
22160 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
22161 LDKSignature node_signature_2_arg_ref;
22162 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
22163 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
22164 LDKSignature bitcoin_signature_1_arg_ref;
22165 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
22166 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
22167 LDKSignature bitcoin_signature_2_arg_ref;
22168 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
22169 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
22170 LDKUnsignedChannelAnnouncement contents_arg_conv;
22171 contents_arg_conv.inner = (void*)(contents_arg & (~1));
22172 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
22173 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
22174 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);
22175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22177 uint64_t ret_ref = (uint64_t)ret_var.inner;
22178 if (ret_var.is_owned) {
22184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22185 LDKChannelAnnouncement orig_conv;
22186 orig_conv.inner = (void*)(orig & (~1));
22187 orig_conv.is_owned = false;
22188 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
22189 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22190 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22191 uint64_t ret_ref = (uint64_t)ret_var.inner;
22192 if (ret_var.is_owned) {
22198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22199 LDKUnsignedChannelUpdate this_obj_conv;
22200 this_obj_conv.inner = (void*)(this_obj & (~1));
22201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22202 UnsignedChannelUpdate_free(this_obj_conv);
22205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22206 LDKUnsignedChannelUpdate this_ptr_conv;
22207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22208 this_ptr_conv.is_owned = false;
22209 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22210 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
22214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22215 LDKUnsignedChannelUpdate this_ptr_conv;
22216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22217 this_ptr_conv.is_owned = false;
22218 LDKThirtyTwoBytes val_ref;
22219 CHECK((*env)->GetArrayLength(env, val) == 32);
22220 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22221 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
22224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22225 LDKUnsignedChannelUpdate this_ptr_conv;
22226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22227 this_ptr_conv.is_owned = false;
22228 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
22232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22233 LDKUnsignedChannelUpdate this_ptr_conv;
22234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22235 this_ptr_conv.is_owned = false;
22236 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
22239 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22240 LDKUnsignedChannelUpdate this_ptr_conv;
22241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22242 this_ptr_conv.is_owned = false;
22243 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
22247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22248 LDKUnsignedChannelUpdate this_ptr_conv;
22249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22250 this_ptr_conv.is_owned = false;
22251 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
22254 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
22255 LDKUnsignedChannelUpdate this_ptr_conv;
22256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22257 this_ptr_conv.is_owned = false;
22258 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
22262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
22263 LDKUnsignedChannelUpdate this_ptr_conv;
22264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22265 this_ptr_conv.is_owned = false;
22266 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
22269 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22270 LDKUnsignedChannelUpdate this_ptr_conv;
22271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22272 this_ptr_conv.is_owned = false;
22273 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
22277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22278 LDKUnsignedChannelUpdate this_ptr_conv;
22279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22280 this_ptr_conv.is_owned = false;
22281 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
22284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22285 LDKUnsignedChannelUpdate this_ptr_conv;
22286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22287 this_ptr_conv.is_owned = false;
22288 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
22292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22293 LDKUnsignedChannelUpdate this_ptr_conv;
22294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22295 this_ptr_conv.is_owned = false;
22296 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
22299 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22300 LDKUnsignedChannelUpdate this_ptr_conv;
22301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22302 this_ptr_conv.is_owned = false;
22303 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
22307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22308 LDKUnsignedChannelUpdate this_ptr_conv;
22309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22310 this_ptr_conv.is_owned = false;
22311 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
22314 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
22315 LDKUnsignedChannelUpdate this_ptr_conv;
22316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22317 this_ptr_conv.is_owned = false;
22318 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
22322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22323 LDKUnsignedChannelUpdate this_ptr_conv;
22324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22325 this_ptr_conv.is_owned = false;
22326 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
22329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22330 LDKUnsignedChannelUpdate orig_conv;
22331 orig_conv.inner = (void*)(orig & (~1));
22332 orig_conv.is_owned = false;
22333 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
22334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22336 uint64_t ret_ref = (uint64_t)ret_var.inner;
22337 if (ret_var.is_owned) {
22343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22344 LDKChannelUpdate this_obj_conv;
22345 this_obj_conv.inner = (void*)(this_obj & (~1));
22346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22347 ChannelUpdate_free(this_obj_conv);
22350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22351 LDKChannelUpdate this_ptr_conv;
22352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22353 this_ptr_conv.is_owned = false;
22354 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22355 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
22359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22360 LDKChannelUpdate this_ptr_conv;
22361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22362 this_ptr_conv.is_owned = false;
22363 LDKSignature val_ref;
22364 CHECK((*env)->GetArrayLength(env, val) == 64);
22365 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22366 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
22369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
22370 LDKChannelUpdate this_ptr_conv;
22371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22372 this_ptr_conv.is_owned = false;
22373 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
22374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22376 uint64_t ret_ref = (uint64_t)ret_var.inner;
22377 if (ret_var.is_owned) {
22383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22384 LDKChannelUpdate this_ptr_conv;
22385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22386 this_ptr_conv.is_owned = false;
22387 LDKUnsignedChannelUpdate val_conv;
22388 val_conv.inner = (void*)(val & (~1));
22389 val_conv.is_owned = (val & 1) || (val == 0);
22390 val_conv = UnsignedChannelUpdate_clone(&val_conv);
22391 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
22394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
22395 LDKSignature signature_arg_ref;
22396 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
22397 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
22398 LDKUnsignedChannelUpdate contents_arg_conv;
22399 contents_arg_conv.inner = (void*)(contents_arg & (~1));
22400 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
22401 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
22402 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
22403 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22404 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22405 uint64_t ret_ref = (uint64_t)ret_var.inner;
22406 if (ret_var.is_owned) {
22412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22413 LDKChannelUpdate orig_conv;
22414 orig_conv.inner = (void*)(orig & (~1));
22415 orig_conv.is_owned = false;
22416 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
22417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22419 uint64_t ret_ref = (uint64_t)ret_var.inner;
22420 if (ret_var.is_owned) {
22426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22427 LDKQueryChannelRange this_obj_conv;
22428 this_obj_conv.inner = (void*)(this_obj & (~1));
22429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22430 QueryChannelRange_free(this_obj_conv);
22433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22434 LDKQueryChannelRange this_ptr_conv;
22435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22436 this_ptr_conv.is_owned = false;
22437 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22438 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
22442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22443 LDKQueryChannelRange this_ptr_conv;
22444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22445 this_ptr_conv.is_owned = false;
22446 LDKThirtyTwoBytes val_ref;
22447 CHECK((*env)->GetArrayLength(env, val) == 32);
22448 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22449 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
22452 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
22453 LDKQueryChannelRange this_ptr_conv;
22454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22455 this_ptr_conv.is_owned = false;
22456 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
22460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22461 LDKQueryChannelRange this_ptr_conv;
22462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22463 this_ptr_conv.is_owned = false;
22464 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
22467 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
22468 LDKQueryChannelRange this_ptr_conv;
22469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22470 this_ptr_conv.is_owned = false;
22471 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
22475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22476 LDKQueryChannelRange this_ptr_conv;
22477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22478 this_ptr_conv.is_owned = false;
22479 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
22482 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) {
22483 LDKThirtyTwoBytes chain_hash_arg_ref;
22484 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22485 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22486 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
22487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22489 uint64_t ret_ref = (uint64_t)ret_var.inner;
22490 if (ret_var.is_owned) {
22496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22497 LDKQueryChannelRange orig_conv;
22498 orig_conv.inner = (void*)(orig & (~1));
22499 orig_conv.is_owned = false;
22500 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
22501 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22502 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22503 uint64_t ret_ref = (uint64_t)ret_var.inner;
22504 if (ret_var.is_owned) {
22510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22511 LDKReplyChannelRange this_obj_conv;
22512 this_obj_conv.inner = (void*)(this_obj & (~1));
22513 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22514 ReplyChannelRange_free(this_obj_conv);
22517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22518 LDKReplyChannelRange this_ptr_conv;
22519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22520 this_ptr_conv.is_owned = false;
22521 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22522 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
22526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22527 LDKReplyChannelRange this_ptr_conv;
22528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22529 this_ptr_conv.is_owned = false;
22530 LDKThirtyTwoBytes val_ref;
22531 CHECK((*env)->GetArrayLength(env, val) == 32);
22532 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22533 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
22536 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
22537 LDKReplyChannelRange this_ptr_conv;
22538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22539 this_ptr_conv.is_owned = false;
22540 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
22544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22545 LDKReplyChannelRange this_ptr_conv;
22546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22547 this_ptr_conv.is_owned = false;
22548 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
22551 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
22552 LDKReplyChannelRange this_ptr_conv;
22553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22554 this_ptr_conv.is_owned = false;
22555 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
22559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22560 LDKReplyChannelRange this_ptr_conv;
22561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22562 this_ptr_conv.is_owned = false;
22563 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
22566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
22567 LDKReplyChannelRange this_ptr_conv;
22568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22569 this_ptr_conv.is_owned = false;
22570 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
22574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22575 LDKReplyChannelRange this_ptr_conv;
22576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22577 this_ptr_conv.is_owned = false;
22578 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
22581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22582 LDKReplyChannelRange this_ptr_conv;
22583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22584 this_ptr_conv.is_owned = false;
22585 LDKCVec_u64Z val_constr;
22586 val_constr.datalen = (*env)->GetArrayLength(env, val);
22587 if (val_constr.datalen > 0)
22588 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22590 val_constr.data = NULL;
22591 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22592 for (size_t g = 0; g < val_constr.datalen; g++) {
22593 int64_t val_conv_6 = val_vals[g];
22594 val_constr.data[g] = val_conv_6;
22596 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22597 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
22600 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) {
22601 LDKThirtyTwoBytes chain_hash_arg_ref;
22602 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22603 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22604 LDKCVec_u64Z short_channel_ids_arg_constr;
22605 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
22606 if (short_channel_ids_arg_constr.datalen > 0)
22607 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22609 short_channel_ids_arg_constr.data = NULL;
22610 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
22611 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
22612 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
22613 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
22615 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
22616 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
22617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22619 uint64_t ret_ref = (uint64_t)ret_var.inner;
22620 if (ret_var.is_owned) {
22626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22627 LDKReplyChannelRange orig_conv;
22628 orig_conv.inner = (void*)(orig & (~1));
22629 orig_conv.is_owned = false;
22630 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
22631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22633 uint64_t ret_ref = (uint64_t)ret_var.inner;
22634 if (ret_var.is_owned) {
22640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22641 LDKQueryShortChannelIds this_obj_conv;
22642 this_obj_conv.inner = (void*)(this_obj & (~1));
22643 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22644 QueryShortChannelIds_free(this_obj_conv);
22647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22648 LDKQueryShortChannelIds this_ptr_conv;
22649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22650 this_ptr_conv.is_owned = false;
22651 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22652 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
22656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22657 LDKQueryShortChannelIds this_ptr_conv;
22658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22659 this_ptr_conv.is_owned = false;
22660 LDKThirtyTwoBytes val_ref;
22661 CHECK((*env)->GetArrayLength(env, val) == 32);
22662 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22663 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
22666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22667 LDKQueryShortChannelIds this_ptr_conv;
22668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22669 this_ptr_conv.is_owned = false;
22670 LDKCVec_u64Z val_constr;
22671 val_constr.datalen = (*env)->GetArrayLength(env, val);
22672 if (val_constr.datalen > 0)
22673 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22675 val_constr.data = NULL;
22676 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22677 for (size_t g = 0; g < val_constr.datalen; g++) {
22678 int64_t val_conv_6 = val_vals[g];
22679 val_constr.data[g] = val_conv_6;
22681 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22682 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
22685 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) {
22686 LDKThirtyTwoBytes chain_hash_arg_ref;
22687 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22688 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22689 LDKCVec_u64Z short_channel_ids_arg_constr;
22690 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
22691 if (short_channel_ids_arg_constr.datalen > 0)
22692 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22694 short_channel_ids_arg_constr.data = NULL;
22695 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
22696 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
22697 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
22698 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
22700 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
22701 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
22702 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22703 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22704 uint64_t ret_ref = (uint64_t)ret_var.inner;
22705 if (ret_var.is_owned) {
22711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22712 LDKQueryShortChannelIds orig_conv;
22713 orig_conv.inner = (void*)(orig & (~1));
22714 orig_conv.is_owned = false;
22715 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_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_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22726 LDKReplyShortChannelIdsEnd this_obj_conv;
22727 this_obj_conv.inner = (void*)(this_obj & (~1));
22728 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22729 ReplyShortChannelIdsEnd_free(this_obj_conv);
22732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22733 LDKReplyShortChannelIdsEnd this_ptr_conv;
22734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22735 this_ptr_conv.is_owned = false;
22736 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22737 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
22741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22742 LDKReplyShortChannelIdsEnd this_ptr_conv;
22743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22744 this_ptr_conv.is_owned = false;
22745 LDKThirtyTwoBytes val_ref;
22746 CHECK((*env)->GetArrayLength(env, val) == 32);
22747 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22748 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
22751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
22752 LDKReplyShortChannelIdsEnd this_ptr_conv;
22753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22754 this_ptr_conv.is_owned = false;
22755 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
22759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22760 LDKReplyShortChannelIdsEnd this_ptr_conv;
22761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22762 this_ptr_conv.is_owned = false;
22763 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
22766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
22767 LDKThirtyTwoBytes chain_hash_arg_ref;
22768 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22769 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22770 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
22771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22773 uint64_t ret_ref = (uint64_t)ret_var.inner;
22774 if (ret_var.is_owned) {
22780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22781 LDKReplyShortChannelIdsEnd orig_conv;
22782 orig_conv.inner = (void*)(orig & (~1));
22783 orig_conv.is_owned = false;
22784 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
22785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22787 uint64_t ret_ref = (uint64_t)ret_var.inner;
22788 if (ret_var.is_owned) {
22794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22795 LDKGossipTimestampFilter this_obj_conv;
22796 this_obj_conv.inner = (void*)(this_obj & (~1));
22797 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22798 GossipTimestampFilter_free(this_obj_conv);
22801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22802 LDKGossipTimestampFilter this_ptr_conv;
22803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22804 this_ptr_conv.is_owned = false;
22805 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22806 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
22810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22811 LDKGossipTimestampFilter this_ptr_conv;
22812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22813 this_ptr_conv.is_owned = false;
22814 LDKThirtyTwoBytes val_ref;
22815 CHECK((*env)->GetArrayLength(env, val) == 32);
22816 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22817 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
22820 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22821 LDKGossipTimestampFilter this_ptr_conv;
22822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22823 this_ptr_conv.is_owned = false;
22824 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
22828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22829 LDKGossipTimestampFilter this_ptr_conv;
22830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22831 this_ptr_conv.is_owned = false;
22832 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
22835 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
22836 LDKGossipTimestampFilter this_ptr_conv;
22837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22838 this_ptr_conv.is_owned = false;
22839 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
22843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22844 LDKGossipTimestampFilter this_ptr_conv;
22845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22846 this_ptr_conv.is_owned = false;
22847 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
22850 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) {
22851 LDKThirtyTwoBytes chain_hash_arg_ref;
22852 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22853 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22854 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
22855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22857 uint64_t ret_ref = (uint64_t)ret_var.inner;
22858 if (ret_var.is_owned) {
22864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22865 LDKGossipTimestampFilter orig_conv;
22866 orig_conv.inner = (void*)(orig & (~1));
22867 orig_conv.is_owned = false;
22868 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
22869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22871 uint64_t ret_ref = (uint64_t)ret_var.inner;
22872 if (ret_var.is_owned) {
22878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22879 if ((this_ptr & 1) != 0) return;
22880 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
22881 FREE((void*)this_ptr);
22882 ErrorAction_free(this_ptr_conv);
22885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22886 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
22887 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22888 *ret_copy = ErrorAction_clone(orig_conv);
22889 uint64_t ret_ref = (uint64_t)ret_copy;
22893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
22894 LDKErrorMessage msg_conv;
22895 msg_conv.inner = (void*)(msg & (~1));
22896 msg_conv.is_owned = (msg & 1) || (msg == 0);
22897 msg_conv = ErrorMessage_clone(&msg_conv);
22898 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22899 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
22900 uint64_t ret_ref = (uint64_t)ret_copy;
22904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
22905 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22906 *ret_copy = ErrorAction_ignore_error();
22907 uint64_t ret_ref = (uint64_t)ret_copy;
22911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
22912 LDKLevel a_conv = LDKLevel_from_java(env, a);
22913 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22914 *ret_copy = ErrorAction_ignore_and_log(a_conv);
22915 uint64_t ret_ref = (uint64_t)ret_copy;
22919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
22920 LDKErrorMessage msg_conv;
22921 msg_conv.inner = (void*)(msg & (~1));
22922 msg_conv.is_owned = (msg & 1) || (msg == 0);
22923 msg_conv = ErrorMessage_clone(&msg_conv);
22924 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22925 *ret_copy = ErrorAction_send_error_message(msg_conv);
22926 uint64_t ret_ref = (uint64_t)ret_copy;
22930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22931 LDKLightningError this_obj_conv;
22932 this_obj_conv.inner = (void*)(this_obj & (~1));
22933 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22934 LightningError_free(this_obj_conv);
22937 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
22938 LDKLightningError this_ptr_conv;
22939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22940 this_ptr_conv.is_owned = false;
22941 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
22942 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
22947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
22948 LDKLightningError this_ptr_conv;
22949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22950 this_ptr_conv.is_owned = false;
22951 LDKStr val_conv = java_to_owned_str(env, val);
22952 LightningError_set_err(&this_ptr_conv, val_conv);
22955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
22956 LDKLightningError this_ptr_conv;
22957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22958 this_ptr_conv.is_owned = false;
22959 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22960 *ret_copy = LightningError_get_action(&this_ptr_conv);
22961 uint64_t ret_ref = (uint64_t)ret_copy;
22965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22966 LDKLightningError this_ptr_conv;
22967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22968 this_ptr_conv.is_owned = false;
22969 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
22970 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
22971 LightningError_set_action(&this_ptr_conv, val_conv);
22974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
22975 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
22976 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
22977 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
22978 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
22979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22981 uint64_t ret_ref = (uint64_t)ret_var.inner;
22982 if (ret_var.is_owned) {
22988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22989 LDKLightningError orig_conv;
22990 orig_conv.inner = (void*)(orig & (~1));
22991 orig_conv.is_owned = false;
22992 LDKLightningError ret_var = LightningError_clone(&orig_conv);
22993 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22994 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22995 uint64_t ret_ref = (uint64_t)ret_var.inner;
22996 if (ret_var.is_owned) {
23002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23003 LDKCommitmentUpdate this_obj_conv;
23004 this_obj_conv.inner = (void*)(this_obj & (~1));
23005 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23006 CommitmentUpdate_free(this_obj_conv);
23009 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23010 LDKCommitmentUpdate this_ptr_conv;
23011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23012 this_ptr_conv.is_owned = false;
23013 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
23014 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23015 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23016 for (size_t p = 0; p < ret_var.datalen; p++) {
23017 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
23018 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23019 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23020 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
23021 if (ret_conv_15_var.is_owned) {
23022 ret_conv_15_ref |= 1;
23024 ret_arr_ptr[p] = ret_conv_15_ref;
23026 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23027 FREE(ret_var.data);
23031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23032 LDKCommitmentUpdate this_ptr_conv;
23033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23034 this_ptr_conv.is_owned = false;
23035 LDKCVec_UpdateAddHTLCZ val_constr;
23036 val_constr.datalen = (*env)->GetArrayLength(env, val);
23037 if (val_constr.datalen > 0)
23038 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23040 val_constr.data = NULL;
23041 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23042 for (size_t p = 0; p < val_constr.datalen; p++) {
23043 int64_t val_conv_15 = val_vals[p];
23044 LDKUpdateAddHTLC val_conv_15_conv;
23045 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
23046 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
23047 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
23048 val_constr.data[p] = val_conv_15_conv;
23050 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23051 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
23054 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23055 LDKCommitmentUpdate this_ptr_conv;
23056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23057 this_ptr_conv.is_owned = false;
23058 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
23059 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23060 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23061 for (size_t t = 0; t < ret_var.datalen; t++) {
23062 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
23063 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23064 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23065 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
23066 if (ret_conv_19_var.is_owned) {
23067 ret_conv_19_ref |= 1;
23069 ret_arr_ptr[t] = ret_conv_19_ref;
23071 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23072 FREE(ret_var.data);
23076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23077 LDKCommitmentUpdate this_ptr_conv;
23078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23079 this_ptr_conv.is_owned = false;
23080 LDKCVec_UpdateFulfillHTLCZ val_constr;
23081 val_constr.datalen = (*env)->GetArrayLength(env, val);
23082 if (val_constr.datalen > 0)
23083 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23085 val_constr.data = NULL;
23086 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23087 for (size_t t = 0; t < val_constr.datalen; t++) {
23088 int64_t val_conv_19 = val_vals[t];
23089 LDKUpdateFulfillHTLC val_conv_19_conv;
23090 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
23091 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
23092 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
23093 val_constr.data[t] = val_conv_19_conv;
23095 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23096 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
23099 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23100 LDKCommitmentUpdate this_ptr_conv;
23101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23102 this_ptr_conv.is_owned = false;
23103 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
23104 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23105 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23106 for (size_t q = 0; q < ret_var.datalen; q++) {
23107 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
23108 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23109 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23110 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
23111 if (ret_conv_16_var.is_owned) {
23112 ret_conv_16_ref |= 1;
23114 ret_arr_ptr[q] = ret_conv_16_ref;
23116 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23117 FREE(ret_var.data);
23121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23122 LDKCommitmentUpdate this_ptr_conv;
23123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23124 this_ptr_conv.is_owned = false;
23125 LDKCVec_UpdateFailHTLCZ val_constr;
23126 val_constr.datalen = (*env)->GetArrayLength(env, val);
23127 if (val_constr.datalen > 0)
23128 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23130 val_constr.data = NULL;
23131 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23132 for (size_t q = 0; q < val_constr.datalen; q++) {
23133 int64_t val_conv_16 = val_vals[q];
23134 LDKUpdateFailHTLC val_conv_16_conv;
23135 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
23136 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
23137 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
23138 val_constr.data[q] = val_conv_16_conv;
23140 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23141 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
23144 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
23145 LDKCommitmentUpdate this_ptr_conv;
23146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23147 this_ptr_conv.is_owned = false;
23148 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
23149 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23150 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23151 for (size_t z = 0; z < ret_var.datalen; z++) {
23152 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
23153 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23154 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23155 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
23156 if (ret_conv_25_var.is_owned) {
23157 ret_conv_25_ref |= 1;
23159 ret_arr_ptr[z] = ret_conv_25_ref;
23161 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23162 FREE(ret_var.data);
23166 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) {
23167 LDKCommitmentUpdate this_ptr_conv;
23168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23169 this_ptr_conv.is_owned = false;
23170 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
23171 val_constr.datalen = (*env)->GetArrayLength(env, val);
23172 if (val_constr.datalen > 0)
23173 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23175 val_constr.data = NULL;
23176 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23177 for (size_t z = 0; z < val_constr.datalen; z++) {
23178 int64_t val_conv_25 = val_vals[z];
23179 LDKUpdateFailMalformedHTLC val_conv_25_conv;
23180 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
23181 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
23182 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
23183 val_constr.data[z] = val_conv_25_conv;
23185 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23186 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
23189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
23190 LDKCommitmentUpdate this_ptr_conv;
23191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23192 this_ptr_conv.is_owned = false;
23193 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
23194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23196 uint64_t ret_ref = (uint64_t)ret_var.inner;
23197 if (ret_var.is_owned) {
23203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23204 LDKCommitmentUpdate this_ptr_conv;
23205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23206 this_ptr_conv.is_owned = false;
23207 LDKUpdateFee val_conv;
23208 val_conv.inner = (void*)(val & (~1));
23209 val_conv.is_owned = (val & 1) || (val == 0);
23210 val_conv = UpdateFee_clone(&val_conv);
23211 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
23214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
23215 LDKCommitmentUpdate this_ptr_conv;
23216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23217 this_ptr_conv.is_owned = false;
23218 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
23219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23221 uint64_t ret_ref = (uint64_t)ret_var.inner;
23222 if (ret_var.is_owned) {
23228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23229 LDKCommitmentUpdate this_ptr_conv;
23230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23231 this_ptr_conv.is_owned = false;
23232 LDKCommitmentSigned val_conv;
23233 val_conv.inner = (void*)(val & (~1));
23234 val_conv.is_owned = (val & 1) || (val == 0);
23235 val_conv = CommitmentSigned_clone(&val_conv);
23236 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
23239 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) {
23240 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
23241 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
23242 if (update_add_htlcs_arg_constr.datalen > 0)
23243 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23245 update_add_htlcs_arg_constr.data = NULL;
23246 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
23247 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
23248 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
23249 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
23250 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
23251 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
23252 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
23253 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
23255 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
23256 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
23257 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
23258 if (update_fulfill_htlcs_arg_constr.datalen > 0)
23259 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23261 update_fulfill_htlcs_arg_constr.data = NULL;
23262 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
23263 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
23264 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
23265 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
23266 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
23267 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
23268 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
23269 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
23271 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
23272 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
23273 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
23274 if (update_fail_htlcs_arg_constr.datalen > 0)
23275 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23277 update_fail_htlcs_arg_constr.data = NULL;
23278 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
23279 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
23280 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
23281 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
23282 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
23283 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
23284 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
23285 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
23287 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
23288 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
23289 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
23290 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
23291 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23293 update_fail_malformed_htlcs_arg_constr.data = NULL;
23294 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
23295 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
23296 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
23297 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
23298 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
23299 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);
23300 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
23301 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
23303 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
23304 LDKUpdateFee update_fee_arg_conv;
23305 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
23306 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
23307 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
23308 LDKCommitmentSigned commitment_signed_arg_conv;
23309 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
23310 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
23311 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
23312 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);
23313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23315 uint64_t ret_ref = (uint64_t)ret_var.inner;
23316 if (ret_var.is_owned) {
23322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23323 LDKCommitmentUpdate orig_conv;
23324 orig_conv.inner = (void*)(orig & (~1));
23325 orig_conv.is_owned = false;
23326 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
23327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23329 uint64_t ret_ref = (uint64_t)ret_var.inner;
23330 if (ret_var.is_owned) {
23336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23337 if ((this_ptr & 1) != 0) return;
23338 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
23339 FREE((void*)this_ptr);
23340 ChannelMessageHandler_free(this_ptr_conv);
23343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23344 if ((this_ptr & 1) != 0) return;
23345 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
23346 FREE((void*)this_ptr);
23347 RoutingMessageHandler_free(this_ptr_conv);
23350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
23351 LDKAcceptChannel obj_conv;
23352 obj_conv.inner = (void*)(obj & (~1));
23353 obj_conv.is_owned = false;
23354 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
23355 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23356 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23357 CVec_u8Z_free(ret_var);
23361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23362 LDKu8slice ser_ref;
23363 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23364 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23365 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23366 *ret_conv = AcceptChannel_read(ser_ref);
23367 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23368 return (uint64_t)ret_conv;
23371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
23372 LDKAnnouncementSignatures obj_conv;
23373 obj_conv.inner = (void*)(obj & (~1));
23374 obj_conv.is_owned = false;
23375 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
23376 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23377 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23378 CVec_u8Z_free(ret_var);
23382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23383 LDKu8slice ser_ref;
23384 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23385 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23386 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23387 *ret_conv = AnnouncementSignatures_read(ser_ref);
23388 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23389 return (uint64_t)ret_conv;
23392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
23393 LDKChannelReestablish obj_conv;
23394 obj_conv.inner = (void*)(obj & (~1));
23395 obj_conv.is_owned = false;
23396 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
23397 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23398 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23399 CVec_u8Z_free(ret_var);
23403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23404 LDKu8slice ser_ref;
23405 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23406 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23407 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23408 *ret_conv = ChannelReestablish_read(ser_ref);
23409 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23410 return (uint64_t)ret_conv;
23413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23414 LDKClosingSigned obj_conv;
23415 obj_conv.inner = (void*)(obj & (~1));
23416 obj_conv.is_owned = false;
23417 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
23418 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23419 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23420 CVec_u8Z_free(ret_var);
23424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23425 LDKu8slice ser_ref;
23426 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23427 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23428 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23429 *ret_conv = ClosingSigned_read(ser_ref);
23430 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23431 return (uint64_t)ret_conv;
23434 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23435 LDKClosingSignedFeeRange obj_conv;
23436 obj_conv.inner = (void*)(obj & (~1));
23437 obj_conv.is_owned = false;
23438 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
23439 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23440 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23441 CVec_u8Z_free(ret_var);
23445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23446 LDKu8slice ser_ref;
23447 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23448 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23449 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23450 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
23451 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23452 return (uint64_t)ret_conv;
23455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23456 LDKCommitmentSigned obj_conv;
23457 obj_conv.inner = (void*)(obj & (~1));
23458 obj_conv.is_owned = false;
23459 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
23460 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23461 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23462 CVec_u8Z_free(ret_var);
23466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23467 LDKu8slice ser_ref;
23468 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23469 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23470 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23471 *ret_conv = CommitmentSigned_read(ser_ref);
23472 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23473 return (uint64_t)ret_conv;
23476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
23477 LDKFundingCreated obj_conv;
23478 obj_conv.inner = (void*)(obj & (~1));
23479 obj_conv.is_owned = false;
23480 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
23481 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23482 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23483 CVec_u8Z_free(ret_var);
23487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23488 LDKu8slice ser_ref;
23489 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23490 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23491 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
23492 *ret_conv = FundingCreated_read(ser_ref);
23493 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23494 return (uint64_t)ret_conv;
23497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23498 LDKFundingSigned obj_conv;
23499 obj_conv.inner = (void*)(obj & (~1));
23500 obj_conv.is_owned = false;
23501 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
23502 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23503 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23504 CVec_u8Z_free(ret_var);
23508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23509 LDKu8slice ser_ref;
23510 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23511 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23512 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
23513 *ret_conv = FundingSigned_read(ser_ref);
23514 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23515 return (uint64_t)ret_conv;
23518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
23519 LDKFundingLocked obj_conv;
23520 obj_conv.inner = (void*)(obj & (~1));
23521 obj_conv.is_owned = false;
23522 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
23523 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23524 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23525 CVec_u8Z_free(ret_var);
23529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23530 LDKu8slice ser_ref;
23531 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23532 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23533 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
23534 *ret_conv = FundingLocked_read(ser_ref);
23535 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23536 return (uint64_t)ret_conv;
23539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
23541 obj_conv.inner = (void*)(obj & (~1));
23542 obj_conv.is_owned = false;
23543 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
23544 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23545 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23546 CVec_u8Z_free(ret_var);
23550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23551 LDKu8slice ser_ref;
23552 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23553 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23554 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
23555 *ret_conv = Init_read(ser_ref);
23556 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23557 return (uint64_t)ret_conv;
23560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
23561 LDKOpenChannel obj_conv;
23562 obj_conv.inner = (void*)(obj & (~1));
23563 obj_conv.is_owned = false;
23564 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
23565 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23566 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23567 CVec_u8Z_free(ret_var);
23571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23572 LDKu8slice ser_ref;
23573 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23574 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23575 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
23576 *ret_conv = OpenChannel_read(ser_ref);
23577 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23578 return (uint64_t)ret_conv;
23581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
23582 LDKRevokeAndACK obj_conv;
23583 obj_conv.inner = (void*)(obj & (~1));
23584 obj_conv.is_owned = false;
23585 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
23586 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23587 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23588 CVec_u8Z_free(ret_var);
23592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23593 LDKu8slice ser_ref;
23594 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23595 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23596 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
23597 *ret_conv = RevokeAndACK_read(ser_ref);
23598 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23599 return (uint64_t)ret_conv;
23602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
23603 LDKShutdown obj_conv;
23604 obj_conv.inner = (void*)(obj & (~1));
23605 obj_conv.is_owned = false;
23606 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
23607 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23608 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23609 CVec_u8Z_free(ret_var);
23613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23614 LDKu8slice ser_ref;
23615 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23616 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23617 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23618 *ret_conv = Shutdown_read(ser_ref);
23619 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23620 return (uint64_t)ret_conv;
23623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23624 LDKUpdateFailHTLC obj_conv;
23625 obj_conv.inner = (void*)(obj & (~1));
23626 obj_conv.is_owned = false;
23627 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
23628 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23629 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23630 CVec_u8Z_free(ret_var);
23634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23635 LDKu8slice ser_ref;
23636 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23637 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23638 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23639 *ret_conv = UpdateFailHTLC_read(ser_ref);
23640 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23641 return (uint64_t)ret_conv;
23644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23645 LDKUpdateFailMalformedHTLC obj_conv;
23646 obj_conv.inner = (void*)(obj & (~1));
23647 obj_conv.is_owned = false;
23648 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
23649 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23650 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23651 CVec_u8Z_free(ret_var);
23655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23656 LDKu8slice ser_ref;
23657 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23658 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23659 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23660 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
23661 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23662 return (uint64_t)ret_conv;
23665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
23666 LDKUpdateFee obj_conv;
23667 obj_conv.inner = (void*)(obj & (~1));
23668 obj_conv.is_owned = false;
23669 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
23670 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23671 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23672 CVec_u8Z_free(ret_var);
23676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23677 LDKu8slice ser_ref;
23678 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23679 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23680 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23681 *ret_conv = UpdateFee_read(ser_ref);
23682 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23683 return (uint64_t)ret_conv;
23686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23687 LDKUpdateFulfillHTLC obj_conv;
23688 obj_conv.inner = (void*)(obj & (~1));
23689 obj_conv.is_owned = false;
23690 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
23691 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23692 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23693 CVec_u8Z_free(ret_var);
23697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23698 LDKu8slice ser_ref;
23699 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23700 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23701 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23702 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
23703 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23704 return (uint64_t)ret_conv;
23707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23708 LDKUpdateAddHTLC obj_conv;
23709 obj_conv.inner = (void*)(obj & (~1));
23710 obj_conv.is_owned = false;
23711 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
23712 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23713 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23714 CVec_u8Z_free(ret_var);
23718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23719 LDKu8slice ser_ref;
23720 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23721 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23722 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23723 *ret_conv = UpdateAddHTLC_read(ser_ref);
23724 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23725 return (uint64_t)ret_conv;
23728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
23730 obj_conv.inner = (void*)(obj & (~1));
23731 obj_conv.is_owned = false;
23732 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
23733 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23734 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23735 CVec_u8Z_free(ret_var);
23739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23740 LDKu8slice ser_ref;
23741 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23742 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23743 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23744 *ret_conv = Ping_read(ser_ref);
23745 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23746 return (uint64_t)ret_conv;
23749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
23751 obj_conv.inner = (void*)(obj & (~1));
23752 obj_conv.is_owned = false;
23753 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
23754 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23755 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23756 CVec_u8Z_free(ret_var);
23760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23761 LDKu8slice ser_ref;
23762 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23763 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23764 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23765 *ret_conv = Pong_read(ser_ref);
23766 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23767 return (uint64_t)ret_conv;
23770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23771 LDKUnsignedChannelAnnouncement obj_conv;
23772 obj_conv.inner = (void*)(obj & (~1));
23773 obj_conv.is_owned = false;
23774 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
23775 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23776 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23777 CVec_u8Z_free(ret_var);
23781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23782 LDKu8slice ser_ref;
23783 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23784 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23785 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23786 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
23787 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23788 return (uint64_t)ret_conv;
23791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23792 LDKChannelAnnouncement obj_conv;
23793 obj_conv.inner = (void*)(obj & (~1));
23794 obj_conv.is_owned = false;
23795 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
23796 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23797 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23798 CVec_u8Z_free(ret_var);
23802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23803 LDKu8slice ser_ref;
23804 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23805 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23806 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23807 *ret_conv = ChannelAnnouncement_read(ser_ref);
23808 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23809 return (uint64_t)ret_conv;
23812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
23813 LDKUnsignedChannelUpdate obj_conv;
23814 obj_conv.inner = (void*)(obj & (~1));
23815 obj_conv.is_owned = false;
23816 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
23817 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23818 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23819 CVec_u8Z_free(ret_var);
23823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23824 LDKu8slice ser_ref;
23825 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23826 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23827 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23828 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
23829 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23830 return (uint64_t)ret_conv;
23833 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
23834 LDKChannelUpdate obj_conv;
23835 obj_conv.inner = (void*)(obj & (~1));
23836 obj_conv.is_owned = false;
23837 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
23838 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23839 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23840 CVec_u8Z_free(ret_var);
23844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23845 LDKu8slice ser_ref;
23846 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23847 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23848 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23849 *ret_conv = ChannelUpdate_read(ser_ref);
23850 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23851 return (uint64_t)ret_conv;
23854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
23855 LDKErrorMessage obj_conv;
23856 obj_conv.inner = (void*)(obj & (~1));
23857 obj_conv.is_owned = false;
23858 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
23859 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23860 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23861 CVec_u8Z_free(ret_var);
23865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23866 LDKu8slice ser_ref;
23867 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23868 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23869 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23870 *ret_conv = ErrorMessage_read(ser_ref);
23871 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23872 return (uint64_t)ret_conv;
23875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23876 LDKUnsignedNodeAnnouncement obj_conv;
23877 obj_conv.inner = (void*)(obj & (~1));
23878 obj_conv.is_owned = false;
23879 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
23880 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23881 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23882 CVec_u8Z_free(ret_var);
23886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23887 LDKu8slice ser_ref;
23888 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23889 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23890 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23891 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
23892 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23893 return (uint64_t)ret_conv;
23896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23897 LDKNodeAnnouncement obj_conv;
23898 obj_conv.inner = (void*)(obj & (~1));
23899 obj_conv.is_owned = false;
23900 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
23901 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23902 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23903 CVec_u8Z_free(ret_var);
23907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23908 LDKu8slice ser_ref;
23909 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23910 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23911 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23912 *ret_conv = NodeAnnouncement_read(ser_ref);
23913 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23914 return (uint64_t)ret_conv;
23917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23918 LDKu8slice ser_ref;
23919 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23920 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23921 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23922 *ret_conv = QueryShortChannelIds_read(ser_ref);
23923 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23924 return (uint64_t)ret_conv;
23927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
23928 LDKQueryShortChannelIds obj_conv;
23929 obj_conv.inner = (void*)(obj & (~1));
23930 obj_conv.is_owned = false;
23931 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
23932 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23933 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23934 CVec_u8Z_free(ret_var);
23938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
23939 LDKReplyShortChannelIdsEnd obj_conv;
23940 obj_conv.inner = (void*)(obj & (~1));
23941 obj_conv.is_owned = false;
23942 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
23943 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23944 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23945 CVec_u8Z_free(ret_var);
23949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23950 LDKu8slice ser_ref;
23951 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23952 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23953 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23954 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
23955 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23956 return (uint64_t)ret_conv;
23959 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
23960 LDKQueryChannelRange this_arg_conv;
23961 this_arg_conv.inner = (void*)(this_arg & (~1));
23962 this_arg_conv.is_owned = false;
23963 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
23967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23968 LDKQueryChannelRange obj_conv;
23969 obj_conv.inner = (void*)(obj & (~1));
23970 obj_conv.is_owned = false;
23971 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
23972 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23973 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23974 CVec_u8Z_free(ret_var);
23978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23979 LDKu8slice ser_ref;
23980 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23981 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23982 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23983 *ret_conv = QueryChannelRange_read(ser_ref);
23984 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23985 return (uint64_t)ret_conv;
23988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23989 LDKu8slice ser_ref;
23990 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23991 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23992 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23993 *ret_conv = ReplyChannelRange_read(ser_ref);
23994 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23995 return (uint64_t)ret_conv;
23998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23999 LDKReplyChannelRange obj_conv;
24000 obj_conv.inner = (void*)(obj & (~1));
24001 obj_conv.is_owned = false;
24002 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
24003 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24004 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24005 CVec_u8Z_free(ret_var);
24009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
24010 LDKGossipTimestampFilter obj_conv;
24011 obj_conv.inner = (void*)(obj & (~1));
24012 obj_conv.is_owned = false;
24013 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
24014 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24015 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24016 CVec_u8Z_free(ret_var);
24020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24021 LDKu8slice ser_ref;
24022 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24023 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24024 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
24025 *ret_conv = GossipTimestampFilter_read(ser_ref);
24026 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24027 return (uint64_t)ret_conv;
24030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24031 if ((this_ptr & 1) != 0) return;
24032 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
24033 FREE((void*)this_ptr);
24034 CustomMessageHandler_free(this_ptr_conv);
24037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24038 LDKIgnoringMessageHandler this_obj_conv;
24039 this_obj_conv.inner = (void*)(this_obj & (~1));
24040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24041 IgnoringMessageHandler_free(this_obj_conv);
24044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
24045 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
24046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24048 uint64_t ret_ref = (uint64_t)ret_var.inner;
24049 if (ret_var.is_owned) {
24055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
24056 LDKIgnoringMessageHandler this_arg_conv;
24057 this_arg_conv.inner = (void*)(this_arg & (~1));
24058 this_arg_conv.is_owned = false;
24059 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24060 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
24061 return (uint64_t)ret_ret;
24064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
24065 LDKIgnoringMessageHandler this_arg_conv;
24066 this_arg_conv.inner = (void*)(this_arg & (~1));
24067 this_arg_conv.is_owned = false;
24068 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
24069 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
24070 return (uint64_t)ret_ret;
24073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
24074 LDKIgnoringMessageHandler this_arg_conv;
24075 this_arg_conv.inner = (void*)(this_arg & (~1));
24076 this_arg_conv.is_owned = false;
24077 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
24078 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
24079 return (uint64_t)ret_ret;
24082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
24083 LDKIgnoringMessageHandler this_arg_conv;
24084 this_arg_conv.inner = (void*)(this_arg & (~1));
24085 this_arg_conv.is_owned = false;
24086 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
24087 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
24088 return (uint64_t)ret_ret;
24091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24092 LDKErroringMessageHandler this_obj_conv;
24093 this_obj_conv.inner = (void*)(this_obj & (~1));
24094 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24095 ErroringMessageHandler_free(this_obj_conv);
24098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
24099 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
24100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24102 uint64_t ret_ref = (uint64_t)ret_var.inner;
24103 if (ret_var.is_owned) {
24109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
24110 LDKErroringMessageHandler this_arg_conv;
24111 this_arg_conv.inner = (void*)(this_arg & (~1));
24112 this_arg_conv.is_owned = false;
24113 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24114 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
24115 return (uint64_t)ret_ret;
24118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
24119 LDKErroringMessageHandler this_arg_conv;
24120 this_arg_conv.inner = (void*)(this_arg & (~1));
24121 this_arg_conv.is_owned = false;
24122 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
24123 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
24124 return (uint64_t)ret_ret;
24127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24128 LDKMessageHandler this_obj_conv;
24129 this_obj_conv.inner = (void*)(this_obj & (~1));
24130 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24131 MessageHandler_free(this_obj_conv);
24134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
24135 LDKMessageHandler this_ptr_conv;
24136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24137 this_ptr_conv.is_owned = false;
24138 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
24142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24143 LDKMessageHandler this_ptr_conv;
24144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24145 this_ptr_conv.is_owned = false;
24146 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
24147 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
24148 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24149 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
24151 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
24154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
24155 LDKMessageHandler this_ptr_conv;
24156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24157 this_ptr_conv.is_owned = false;
24158 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
24162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24163 LDKMessageHandler this_ptr_conv;
24164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24165 this_ptr_conv.is_owned = false;
24166 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
24167 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
24168 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24169 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
24171 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
24174 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) {
24175 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
24176 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
24177 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24178 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
24180 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
24181 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
24182 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24183 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
24185 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
24186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24188 uint64_t ret_ref = (uint64_t)ret_var.inner;
24189 if (ret_var.is_owned) {
24195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24196 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
24197 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
24198 *ret_ret = SocketDescriptor_clone(orig_conv);
24199 return (uint64_t)ret_ret;
24202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24203 if ((this_ptr & 1) != 0) return;
24204 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
24205 FREE((void*)this_ptr);
24206 SocketDescriptor_free(this_ptr_conv);
24209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24210 LDKPeerHandleError this_obj_conv;
24211 this_obj_conv.inner = (void*)(this_obj & (~1));
24212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24213 PeerHandleError_free(this_obj_conv);
24216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
24217 LDKPeerHandleError this_ptr_conv;
24218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24219 this_ptr_conv.is_owned = false;
24220 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
24224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24225 LDKPeerHandleError this_ptr_conv;
24226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24227 this_ptr_conv.is_owned = false;
24228 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
24231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
24232 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
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_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24243 LDKPeerHandleError orig_conv;
24244 orig_conv.inner = (void*)(orig & (~1));
24245 orig_conv.is_owned = false;
24246 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
24247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24249 uint64_t ret_ref = (uint64_t)ret_var.inner;
24250 if (ret_var.is_owned) {
24256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24257 LDKPeerManager this_obj_conv;
24258 this_obj_conv.inner = (void*)(this_obj & (~1));
24259 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24260 PeerManager_free(this_obj_conv);
24263 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, int64_t custom_message_handler) {
24264 LDKMessageHandler message_handler_conv;
24265 message_handler_conv.inner = (void*)(message_handler & (~1));
24266 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
24267 // Warning: we need a move here but no clone is available for LDKMessageHandler
24268 LDKSecretKey our_node_secret_ref;
24269 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
24270 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
24271 unsigned char ephemeral_random_data_arr[32];
24272 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
24273 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
24274 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
24275 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24276 if (logger_conv.free == LDKLogger_JCalls_free) {
24277 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24278 LDKLogger_JCalls_cloned(&logger_conv);
24280 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
24281 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
24282 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24283 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
24285 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
24286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24288 uint64_t ret_ref = (uint64_t)ret_var.inner;
24289 if (ret_var.is_owned) {
24295 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
24296 LDKPeerManager this_arg_conv;
24297 this_arg_conv.inner = (void*)(this_arg & (~1));
24298 this_arg_conv.is_owned = false;
24299 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
24300 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
24302 for (size_t i = 0; i < ret_var.datalen; i++) {
24303 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
24304 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
24305 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
24307 FREE(ret_var.data);
24311 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) {
24312 LDKPeerManager this_arg_conv;
24313 this_arg_conv.inner = (void*)(this_arg & (~1));
24314 this_arg_conv.is_owned = false;
24315 LDKPublicKey their_node_id_ref;
24316 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
24317 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
24318 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24319 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
24320 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24321 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
24323 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24324 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
24325 return (uint64_t)ret_conv;
24328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
24329 LDKPeerManager this_arg_conv;
24330 this_arg_conv.inner = (void*)(this_arg & (~1));
24331 this_arg_conv.is_owned = false;
24332 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24333 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
24334 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24335 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
24337 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24338 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
24339 return (uint64_t)ret_conv;
24342 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) {
24343 LDKPeerManager this_arg_conv;
24344 this_arg_conv.inner = (void*)(this_arg & (~1));
24345 this_arg_conv.is_owned = false;
24346 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24347 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24348 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
24349 return (uint64_t)ret_conv;
24352 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) {
24353 LDKPeerManager this_arg_conv;
24354 this_arg_conv.inner = (void*)(this_arg & (~1));
24355 this_arg_conv.is_owned = false;
24356 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
24357 LDKu8slice data_ref;
24358 data_ref.datalen = (*env)->GetArrayLength(env, data);
24359 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
24360 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24361 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
24362 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
24363 return (uint64_t)ret_conv;
24366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
24367 LDKPeerManager this_arg_conv;
24368 this_arg_conv.inner = (void*)(this_arg & (~1));
24369 this_arg_conv.is_owned = false;
24370 PeerManager_process_events(&this_arg_conv);
24373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
24374 LDKPeerManager this_arg_conv;
24375 this_arg_conv.inner = (void*)(this_arg & (~1));
24376 this_arg_conv.is_owned = false;
24377 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24378 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
24381 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) {
24382 LDKPeerManager this_arg_conv;
24383 this_arg_conv.inner = (void*)(this_arg & (~1));
24384 this_arg_conv.is_owned = false;
24385 LDKPublicKey node_id_ref;
24386 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24387 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24388 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
24391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
24392 LDKPeerManager this_arg_conv;
24393 this_arg_conv.inner = (void*)(this_arg & (~1));
24394 this_arg_conv.is_owned = false;
24395 PeerManager_timer_tick_occurred(&this_arg_conv);
24398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
24399 unsigned char commitment_seed_arr[32];
24400 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
24401 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
24402 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
24403 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24404 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
24408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
24409 LDKCVec_u8Z to_holder_script_ref;
24410 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
24411 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
24412 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
24413 LDKCVec_u8Z to_counterparty_script_ref;
24414 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
24415 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
24416 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
24417 LDKOutPoint funding_outpoint_conv;
24418 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
24419 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
24420 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
24421 LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
24422 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24423 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24424 Transaction_free(ret_var);
24428 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) {
24429 LDKPublicKey per_commitment_point_ref;
24430 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24431 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24432 unsigned char base_secret_arr[32];
24433 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
24434 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
24435 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
24436 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
24437 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
24438 return (uint64_t)ret_conv;
24441 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) {
24442 LDKPublicKey per_commitment_point_ref;
24443 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24444 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24445 LDKPublicKey base_point_ref;
24446 CHECK((*env)->GetArrayLength(env, base_point) == 33);
24447 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
24448 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24449 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
24450 return (uint64_t)ret_conv;
24453 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) {
24454 unsigned char per_commitment_secret_arr[32];
24455 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
24456 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
24457 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
24458 unsigned char countersignatory_revocation_base_secret_arr[32];
24459 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
24460 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
24461 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
24462 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
24463 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
24464 return (uint64_t)ret_conv;
24467 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) {
24468 LDKPublicKey per_commitment_point_ref;
24469 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24470 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24471 LDKPublicKey countersignatory_revocation_base_point_ref;
24472 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
24473 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
24474 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24475 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
24476 return (uint64_t)ret_conv;
24479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24480 LDKTxCreationKeys this_obj_conv;
24481 this_obj_conv.inner = (void*)(this_obj & (~1));
24482 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24483 TxCreationKeys_free(this_obj_conv);
24486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24487 LDKTxCreationKeys this_ptr_conv;
24488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24489 this_ptr_conv.is_owned = false;
24490 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24491 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
24495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24496 LDKTxCreationKeys this_ptr_conv;
24497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24498 this_ptr_conv.is_owned = false;
24499 LDKPublicKey val_ref;
24500 CHECK((*env)->GetArrayLength(env, val) == 33);
24501 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24502 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
24505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24506 LDKTxCreationKeys this_ptr_conv;
24507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24508 this_ptr_conv.is_owned = false;
24509 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
24514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24515 LDKTxCreationKeys this_ptr_conv;
24516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24517 this_ptr_conv.is_owned = false;
24518 LDKPublicKey val_ref;
24519 CHECK((*env)->GetArrayLength(env, val) == 33);
24520 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24521 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
24524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24525 LDKTxCreationKeys this_ptr_conv;
24526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24527 this_ptr_conv.is_owned = false;
24528 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24529 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
24533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24534 LDKTxCreationKeys this_ptr_conv;
24535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24536 this_ptr_conv.is_owned = false;
24537 LDKPublicKey val_ref;
24538 CHECK((*env)->GetArrayLength(env, val) == 33);
24539 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24540 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
24543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24544 LDKTxCreationKeys this_ptr_conv;
24545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24546 this_ptr_conv.is_owned = false;
24547 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24548 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
24552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24553 LDKTxCreationKeys this_ptr_conv;
24554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24555 this_ptr_conv.is_owned = false;
24556 LDKPublicKey val_ref;
24557 CHECK((*env)->GetArrayLength(env, val) == 33);
24558 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24559 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
24562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24563 LDKTxCreationKeys this_ptr_conv;
24564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24565 this_ptr_conv.is_owned = false;
24566 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24567 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
24571 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) {
24572 LDKTxCreationKeys this_ptr_conv;
24573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24574 this_ptr_conv.is_owned = false;
24575 LDKPublicKey val_ref;
24576 CHECK((*env)->GetArrayLength(env, val) == 33);
24577 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24578 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
24581 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) {
24582 LDKPublicKey per_commitment_point_arg_ref;
24583 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
24584 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
24585 LDKPublicKey revocation_key_arg_ref;
24586 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
24587 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
24588 LDKPublicKey broadcaster_htlc_key_arg_ref;
24589 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
24590 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
24591 LDKPublicKey countersignatory_htlc_key_arg_ref;
24592 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
24593 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
24594 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
24595 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
24596 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
24597 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);
24598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24600 uint64_t ret_ref = (uint64_t)ret_var.inner;
24601 if (ret_var.is_owned) {
24607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24608 LDKTxCreationKeys orig_conv;
24609 orig_conv.inner = (void*)(orig & (~1));
24610 orig_conv.is_owned = false;
24611 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
24612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24614 uint64_t ret_ref = (uint64_t)ret_var.inner;
24615 if (ret_var.is_owned) {
24621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
24622 LDKTxCreationKeys obj_conv;
24623 obj_conv.inner = (void*)(obj & (~1));
24624 obj_conv.is_owned = false;
24625 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
24626 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24627 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24628 CVec_u8Z_free(ret_var);
24632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24633 LDKu8slice ser_ref;
24634 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24635 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24636 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
24637 *ret_conv = TxCreationKeys_read(ser_ref);
24638 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24639 return (uint64_t)ret_conv;
24642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24643 LDKChannelPublicKeys this_obj_conv;
24644 this_obj_conv.inner = (void*)(this_obj & (~1));
24645 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24646 ChannelPublicKeys_free(this_obj_conv);
24649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24650 LDKChannelPublicKeys this_ptr_conv;
24651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24652 this_ptr_conv.is_owned = false;
24653 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24654 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
24658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24659 LDKChannelPublicKeys this_ptr_conv;
24660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24661 this_ptr_conv.is_owned = false;
24662 LDKPublicKey val_ref;
24663 CHECK((*env)->GetArrayLength(env, val) == 33);
24664 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24665 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
24668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24669 LDKChannelPublicKeys this_ptr_conv;
24670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24671 this_ptr_conv.is_owned = false;
24672 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24673 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
24677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24678 LDKChannelPublicKeys this_ptr_conv;
24679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24680 this_ptr_conv.is_owned = false;
24681 LDKPublicKey val_ref;
24682 CHECK((*env)->GetArrayLength(env, val) == 33);
24683 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24684 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
24687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24688 LDKChannelPublicKeys this_ptr_conv;
24689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24690 this_ptr_conv.is_owned = false;
24691 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24692 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
24696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24697 LDKChannelPublicKeys this_ptr_conv;
24698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24699 this_ptr_conv.is_owned = false;
24700 LDKPublicKey val_ref;
24701 CHECK((*env)->GetArrayLength(env, val) == 33);
24702 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24703 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
24706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24707 LDKChannelPublicKeys this_ptr_conv;
24708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24709 this_ptr_conv.is_owned = false;
24710 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24711 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
24715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24716 LDKChannelPublicKeys this_ptr_conv;
24717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24718 this_ptr_conv.is_owned = false;
24719 LDKPublicKey val_ref;
24720 CHECK((*env)->GetArrayLength(env, val) == 33);
24721 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24722 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
24725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24726 LDKChannelPublicKeys this_ptr_conv;
24727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24728 this_ptr_conv.is_owned = false;
24729 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24730 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
24734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24735 LDKChannelPublicKeys this_ptr_conv;
24736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24737 this_ptr_conv.is_owned = false;
24738 LDKPublicKey val_ref;
24739 CHECK((*env)->GetArrayLength(env, val) == 33);
24740 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24741 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
24744 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) {
24745 LDKPublicKey funding_pubkey_arg_ref;
24746 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
24747 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
24748 LDKPublicKey revocation_basepoint_arg_ref;
24749 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
24750 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
24751 LDKPublicKey payment_point_arg_ref;
24752 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
24753 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
24754 LDKPublicKey delayed_payment_basepoint_arg_ref;
24755 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
24756 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
24757 LDKPublicKey htlc_basepoint_arg_ref;
24758 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
24759 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
24760 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);
24761 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24762 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24763 uint64_t ret_ref = (uint64_t)ret_var.inner;
24764 if (ret_var.is_owned) {
24770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24771 LDKChannelPublicKeys orig_conv;
24772 orig_conv.inner = (void*)(orig & (~1));
24773 orig_conv.is_owned = false;
24774 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
24775 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24776 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24777 uint64_t ret_ref = (uint64_t)ret_var.inner;
24778 if (ret_var.is_owned) {
24784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
24785 LDKChannelPublicKeys obj_conv;
24786 obj_conv.inner = (void*)(obj & (~1));
24787 obj_conv.is_owned = false;
24788 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
24789 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24790 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24791 CVec_u8Z_free(ret_var);
24795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24796 LDKu8slice ser_ref;
24797 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24798 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24799 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
24800 *ret_conv = ChannelPublicKeys_read(ser_ref);
24801 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24802 return (uint64_t)ret_conv;
24805 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) {
24806 LDKPublicKey per_commitment_point_ref;
24807 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24808 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24809 LDKPublicKey broadcaster_delayed_payment_base_ref;
24810 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
24811 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
24812 LDKPublicKey broadcaster_htlc_base_ref;
24813 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
24814 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
24815 LDKPublicKey countersignatory_revocation_base_ref;
24816 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
24817 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
24818 LDKPublicKey countersignatory_htlc_base_ref;
24819 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
24820 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
24821 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24822 *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);
24823 return (uint64_t)ret_conv;
24826 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) {
24827 LDKPublicKey per_commitment_point_ref;
24828 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24829 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24830 LDKChannelPublicKeys broadcaster_keys_conv;
24831 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
24832 broadcaster_keys_conv.is_owned = false;
24833 LDKChannelPublicKeys countersignatory_keys_conv;
24834 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
24835 countersignatory_keys_conv.is_owned = false;
24836 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24837 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
24838 return (uint64_t)ret_conv;
24841 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) {
24842 LDKPublicKey revocation_key_ref;
24843 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
24844 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
24845 LDKPublicKey broadcaster_delayed_payment_key_ref;
24846 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
24847 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
24848 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
24849 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24850 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24851 CVec_u8Z_free(ret_var);
24855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24856 LDKHTLCOutputInCommitment this_obj_conv;
24857 this_obj_conv.inner = (void*)(this_obj & (~1));
24858 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24859 HTLCOutputInCommitment_free(this_obj_conv);
24862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
24863 LDKHTLCOutputInCommitment this_ptr_conv;
24864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24865 this_ptr_conv.is_owned = false;
24866 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
24870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24871 LDKHTLCOutputInCommitment this_ptr_conv;
24872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24873 this_ptr_conv.is_owned = false;
24874 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
24877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24878 LDKHTLCOutputInCommitment this_ptr_conv;
24879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24880 this_ptr_conv.is_owned = false;
24881 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
24885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24886 LDKHTLCOutputInCommitment this_ptr_conv;
24887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24888 this_ptr_conv.is_owned = false;
24889 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
24892 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
24893 LDKHTLCOutputInCommitment this_ptr_conv;
24894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24895 this_ptr_conv.is_owned = false;
24896 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
24900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24901 LDKHTLCOutputInCommitment this_ptr_conv;
24902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24903 this_ptr_conv.is_owned = false;
24904 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
24907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24908 LDKHTLCOutputInCommitment this_ptr_conv;
24909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24910 this_ptr_conv.is_owned = false;
24911 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24912 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
24916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24917 LDKHTLCOutputInCommitment this_ptr_conv;
24918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24919 this_ptr_conv.is_owned = false;
24920 LDKThirtyTwoBytes val_ref;
24921 CHECK((*env)->GetArrayLength(env, val) == 32);
24922 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24923 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
24926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
24927 LDKHTLCOutputInCommitment this_ptr_conv;
24928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24929 this_ptr_conv.is_owned = false;
24930 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
24931 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
24932 uint64_t ret_ref = (uint64_t)ret_copy;
24936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24937 LDKHTLCOutputInCommitment this_ptr_conv;
24938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24939 this_ptr_conv.is_owned = false;
24940 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
24941 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
24942 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
24945 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) {
24946 LDKThirtyTwoBytes payment_hash_arg_ref;
24947 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
24948 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
24949 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
24950 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
24951 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
24952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24954 uint64_t ret_ref = (uint64_t)ret_var.inner;
24955 if (ret_var.is_owned) {
24961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24962 LDKHTLCOutputInCommitment orig_conv;
24963 orig_conv.inner = (void*)(orig & (~1));
24964 orig_conv.is_owned = false;
24965 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
24966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24968 uint64_t ret_ref = (uint64_t)ret_var.inner;
24969 if (ret_var.is_owned) {
24975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
24976 LDKHTLCOutputInCommitment obj_conv;
24977 obj_conv.inner = (void*)(obj & (~1));
24978 obj_conv.is_owned = false;
24979 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
24980 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24981 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24982 CVec_u8Z_free(ret_var);
24986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24987 LDKu8slice ser_ref;
24988 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24989 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24990 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
24991 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
24992 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24993 return (uint64_t)ret_conv;
24996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
24997 LDKHTLCOutputInCommitment htlc_conv;
24998 htlc_conv.inner = (void*)(htlc & (~1));
24999 htlc_conv.is_owned = false;
25000 LDKTxCreationKeys keys_conv;
25001 keys_conv.inner = (void*)(keys & (~1));
25002 keys_conv.is_owned = false;
25003 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
25004 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25005 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25006 CVec_u8Z_free(ret_var);
25010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
25011 LDKPublicKey broadcaster_ref;
25012 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
25013 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
25014 LDKPublicKey countersignatory_ref;
25015 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
25016 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
25017 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
25018 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25019 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25020 CVec_u8Z_free(ret_var);
25024 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) {
25025 unsigned char commitment_txid_arr[32];
25026 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
25027 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
25028 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
25029 LDKHTLCOutputInCommitment htlc_conv;
25030 htlc_conv.inner = (void*)(htlc & (~1));
25031 htlc_conv.is_owned = false;
25032 LDKPublicKey broadcaster_delayed_payment_key_ref;
25033 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
25034 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
25035 LDKPublicKey revocation_key_ref;
25036 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
25037 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
25038 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
25039 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25040 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25041 Transaction_free(ret_var);
25045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25046 LDKChannelTransactionParameters this_obj_conv;
25047 this_obj_conv.inner = (void*)(this_obj & (~1));
25048 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25049 ChannelTransactionParameters_free(this_obj_conv);
25052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
25053 LDKChannelTransactionParameters this_ptr_conv;
25054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25055 this_ptr_conv.is_owned = false;
25056 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
25057 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25058 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25059 uint64_t ret_ref = (uint64_t)ret_var.inner;
25060 if (ret_var.is_owned) {
25066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25067 LDKChannelTransactionParameters this_ptr_conv;
25068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25069 this_ptr_conv.is_owned = false;
25070 LDKChannelPublicKeys val_conv;
25071 val_conv.inner = (void*)(val & (~1));
25072 val_conv.is_owned = (val & 1) || (val == 0);
25073 val_conv = ChannelPublicKeys_clone(&val_conv);
25074 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
25077 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25078 LDKChannelTransactionParameters this_ptr_conv;
25079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25080 this_ptr_conv.is_owned = false;
25081 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
25085 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) {
25086 LDKChannelTransactionParameters this_ptr_conv;
25087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25088 this_ptr_conv.is_owned = false;
25089 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
25092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
25093 LDKChannelTransactionParameters this_ptr_conv;
25094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25095 this_ptr_conv.is_owned = false;
25096 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
25100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25101 LDKChannelTransactionParameters this_ptr_conv;
25102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25103 this_ptr_conv.is_owned = false;
25104 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
25107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
25108 LDKChannelTransactionParameters this_ptr_conv;
25109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25110 this_ptr_conv.is_owned = false;
25111 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
25112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25114 uint64_t ret_ref = (uint64_t)ret_var.inner;
25115 if (ret_var.is_owned) {
25121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25122 LDKChannelTransactionParameters this_ptr_conv;
25123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25124 this_ptr_conv.is_owned = false;
25125 LDKCounterpartyChannelTransactionParameters val_conv;
25126 val_conv.inner = (void*)(val & (~1));
25127 val_conv.is_owned = (val & 1) || (val == 0);
25128 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
25129 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
25132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25133 LDKChannelTransactionParameters this_ptr_conv;
25134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25135 this_ptr_conv.is_owned = false;
25136 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
25137 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25138 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25139 uint64_t ret_ref = (uint64_t)ret_var.inner;
25140 if (ret_var.is_owned) {
25146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25147 LDKChannelTransactionParameters this_ptr_conv;
25148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25149 this_ptr_conv.is_owned = false;
25150 LDKOutPoint val_conv;
25151 val_conv.inner = (void*)(val & (~1));
25152 val_conv.is_owned = (val & 1) || (val == 0);
25153 val_conv = OutPoint_clone(&val_conv);
25154 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
25157 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) {
25158 LDKChannelPublicKeys holder_pubkeys_arg_conv;
25159 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
25160 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
25161 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
25162 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
25163 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
25164 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
25165 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
25166 LDKOutPoint funding_outpoint_arg_conv;
25167 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
25168 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
25169 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
25170 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);
25171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25173 uint64_t ret_ref = (uint64_t)ret_var.inner;
25174 if (ret_var.is_owned) {
25180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25181 LDKChannelTransactionParameters orig_conv;
25182 orig_conv.inner = (void*)(orig & (~1));
25183 orig_conv.is_owned = false;
25184 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
25185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25187 uint64_t ret_ref = (uint64_t)ret_var.inner;
25188 if (ret_var.is_owned) {
25194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25195 LDKCounterpartyChannelTransactionParameters this_obj_conv;
25196 this_obj_conv.inner = (void*)(this_obj & (~1));
25197 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25198 CounterpartyChannelTransactionParameters_free(this_obj_conv);
25201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
25202 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25204 this_ptr_conv.is_owned = false;
25205 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
25206 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25207 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25208 uint64_t ret_ref = (uint64_t)ret_var.inner;
25209 if (ret_var.is_owned) {
25215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25216 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25218 this_ptr_conv.is_owned = false;
25219 LDKChannelPublicKeys val_conv;
25220 val_conv.inner = (void*)(val & (~1));
25221 val_conv.is_owned = (val & 1) || (val == 0);
25222 val_conv = ChannelPublicKeys_clone(&val_conv);
25223 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
25226 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25227 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25229 this_ptr_conv.is_owned = false;
25230 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
25234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25235 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25237 this_ptr_conv.is_owned = false;
25238 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
25241 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) {
25242 LDKChannelPublicKeys pubkeys_arg_conv;
25243 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
25244 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
25245 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
25246 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
25247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25249 uint64_t ret_ref = (uint64_t)ret_var.inner;
25250 if (ret_var.is_owned) {
25256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25257 LDKCounterpartyChannelTransactionParameters orig_conv;
25258 orig_conv.inner = (void*)(orig & (~1));
25259 orig_conv.is_owned = false;
25260 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
25261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25263 uint64_t ret_ref = (uint64_t)ret_var.inner;
25264 if (ret_var.is_owned) {
25270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
25271 LDKChannelTransactionParameters this_arg_conv;
25272 this_arg_conv.inner = (void*)(this_arg & (~1));
25273 this_arg_conv.is_owned = false;
25274 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
25278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25279 LDKChannelTransactionParameters this_arg_conv;
25280 this_arg_conv.inner = (void*)(this_arg & (~1));
25281 this_arg_conv.is_owned = false;
25282 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
25283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25285 uint64_t ret_ref = (uint64_t)ret_var.inner;
25286 if (ret_var.is_owned) {
25292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25293 LDKChannelTransactionParameters this_arg_conv;
25294 this_arg_conv.inner = (void*)(this_arg & (~1));
25295 this_arg_conv.is_owned = false;
25296 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
25297 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25298 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25299 uint64_t ret_ref = (uint64_t)ret_var.inner;
25300 if (ret_var.is_owned) {
25306 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25307 LDKCounterpartyChannelTransactionParameters obj_conv;
25308 obj_conv.inner = (void*)(obj & (~1));
25309 obj_conv.is_owned = false;
25310 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
25311 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25312 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25313 CVec_u8Z_free(ret_var);
25317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25318 LDKu8slice ser_ref;
25319 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25320 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25321 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25322 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
25323 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25324 return (uint64_t)ret_conv;
25327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25328 LDKChannelTransactionParameters obj_conv;
25329 obj_conv.inner = (void*)(obj & (~1));
25330 obj_conv.is_owned = false;
25331 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
25332 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25333 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25334 CVec_u8Z_free(ret_var);
25338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25339 LDKu8slice ser_ref;
25340 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25341 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25342 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
25343 *ret_conv = ChannelTransactionParameters_read(ser_ref);
25344 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25345 return (uint64_t)ret_conv;
25348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25349 LDKDirectedChannelTransactionParameters this_obj_conv;
25350 this_obj_conv.inner = (void*)(this_obj & (~1));
25351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25352 DirectedChannelTransactionParameters_free(this_obj_conv);
25355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
25356 LDKDirectedChannelTransactionParameters this_arg_conv;
25357 this_arg_conv.inner = (void*)(this_arg & (~1));
25358 this_arg_conv.is_owned = false;
25359 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
25360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25362 uint64_t ret_ref = (uint64_t)ret_var.inner;
25363 if (ret_var.is_owned) {
25369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
25370 LDKDirectedChannelTransactionParameters this_arg_conv;
25371 this_arg_conv.inner = (void*)(this_arg & (~1));
25372 this_arg_conv.is_owned = false;
25373 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
25374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25376 uint64_t ret_ref = (uint64_t)ret_var.inner;
25377 if (ret_var.is_owned) {
25383 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
25384 LDKDirectedChannelTransactionParameters this_arg_conv;
25385 this_arg_conv.inner = (void*)(this_arg & (~1));
25386 this_arg_conv.is_owned = false;
25387 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
25391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
25392 LDKDirectedChannelTransactionParameters this_arg_conv;
25393 this_arg_conv.inner = (void*)(this_arg & (~1));
25394 this_arg_conv.is_owned = false;
25395 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
25399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
25400 LDKDirectedChannelTransactionParameters this_arg_conv;
25401 this_arg_conv.inner = (void*)(this_arg & (~1));
25402 this_arg_conv.is_owned = false;
25403 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
25404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25406 uint64_t ret_ref = (uint64_t)ret_var.inner;
25407 if (ret_var.is_owned) {
25413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25414 LDKHolderCommitmentTransaction this_obj_conv;
25415 this_obj_conv.inner = (void*)(this_obj & (~1));
25416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25417 HolderCommitmentTransaction_free(this_obj_conv);
25420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
25421 LDKHolderCommitmentTransaction this_ptr_conv;
25422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25423 this_ptr_conv.is_owned = false;
25424 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25425 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
25429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25430 LDKHolderCommitmentTransaction this_ptr_conv;
25431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25432 this_ptr_conv.is_owned = false;
25433 LDKSignature val_ref;
25434 CHECK((*env)->GetArrayLength(env, val) == 64);
25435 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
25436 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
25439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
25440 LDKHolderCommitmentTransaction this_ptr_conv;
25441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25442 this_ptr_conv.is_owned = false;
25443 LDKCVec_SignatureZ val_constr;
25444 val_constr.datalen = (*env)->GetArrayLength(env, val);
25445 if (val_constr.datalen > 0)
25446 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
25448 val_constr.data = NULL;
25449 for (size_t i = 0; i < val_constr.datalen; i++) {
25450 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
25451 LDKSignature val_conv_8_ref;
25452 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
25453 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
25454 val_constr.data[i] = val_conv_8_ref;
25456 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
25459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25460 LDKHolderCommitmentTransaction orig_conv;
25461 orig_conv.inner = (void*)(orig & (~1));
25462 orig_conv.is_owned = false;
25463 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
25464 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25465 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25466 uint64_t ret_ref = (uint64_t)ret_var.inner;
25467 if (ret_var.is_owned) {
25473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25474 LDKHolderCommitmentTransaction obj_conv;
25475 obj_conv.inner = (void*)(obj & (~1));
25476 obj_conv.is_owned = false;
25477 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
25478 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25479 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25480 CVec_u8Z_free(ret_var);
25484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25485 LDKu8slice ser_ref;
25486 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25487 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25488 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
25489 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
25490 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25491 return (uint64_t)ret_conv;
25494 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) {
25495 LDKCommitmentTransaction commitment_tx_conv;
25496 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
25497 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
25498 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
25499 LDKSignature counterparty_sig_ref;
25500 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
25501 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
25502 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
25503 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
25504 if (counterparty_htlc_sigs_constr.datalen > 0)
25505 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
25507 counterparty_htlc_sigs_constr.data = NULL;
25508 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
25509 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
25510 LDKSignature counterparty_htlc_sigs_conv_8_ref;
25511 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
25512 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
25513 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
25515 LDKPublicKey holder_funding_key_ref;
25516 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
25517 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
25518 LDKPublicKey counterparty_funding_key_ref;
25519 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
25520 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
25521 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
25522 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25523 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25524 uint64_t ret_ref = (uint64_t)ret_var.inner;
25525 if (ret_var.is_owned) {
25531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25532 LDKBuiltCommitmentTransaction this_obj_conv;
25533 this_obj_conv.inner = (void*)(this_obj & (~1));
25534 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25535 BuiltCommitmentTransaction_free(this_obj_conv);
25538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
25539 LDKBuiltCommitmentTransaction this_ptr_conv;
25540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25541 this_ptr_conv.is_owned = false;
25542 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
25543 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25544 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25545 Transaction_free(ret_var);
25549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25550 LDKBuiltCommitmentTransaction this_ptr_conv;
25551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25552 this_ptr_conv.is_owned = false;
25553 LDKTransaction val_ref;
25554 val_ref.datalen = (*env)->GetArrayLength(env, val);
25555 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
25556 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25557 val_ref.data_is_owned = true;
25558 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
25561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
25562 LDKBuiltCommitmentTransaction this_ptr_conv;
25563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25564 this_ptr_conv.is_owned = false;
25565 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25566 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
25570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25571 LDKBuiltCommitmentTransaction this_ptr_conv;
25572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25573 this_ptr_conv.is_owned = false;
25574 LDKThirtyTwoBytes val_ref;
25575 CHECK((*env)->GetArrayLength(env, val) == 32);
25576 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25577 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
25580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
25581 LDKTransaction transaction_arg_ref;
25582 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
25583 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
25584 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
25585 transaction_arg_ref.data_is_owned = true;
25586 LDKThirtyTwoBytes txid_arg_ref;
25587 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
25588 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
25589 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
25590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25592 uint64_t ret_ref = (uint64_t)ret_var.inner;
25593 if (ret_var.is_owned) {
25599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25600 LDKBuiltCommitmentTransaction orig_conv;
25601 orig_conv.inner = (void*)(orig & (~1));
25602 orig_conv.is_owned = false;
25603 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
25604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25606 uint64_t ret_ref = (uint64_t)ret_var.inner;
25607 if (ret_var.is_owned) {
25613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25614 LDKBuiltCommitmentTransaction obj_conv;
25615 obj_conv.inner = (void*)(obj & (~1));
25616 obj_conv.is_owned = false;
25617 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
25618 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25619 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25620 CVec_u8Z_free(ret_var);
25624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25625 LDKu8slice ser_ref;
25626 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25627 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25628 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
25629 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
25630 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25631 return (uint64_t)ret_conv;
25634 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) {
25635 LDKBuiltCommitmentTransaction this_arg_conv;
25636 this_arg_conv.inner = (void*)(this_arg & (~1));
25637 this_arg_conv.is_owned = false;
25638 LDKu8slice funding_redeemscript_ref;
25639 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25640 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25641 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25642 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
25643 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25647 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) {
25648 LDKBuiltCommitmentTransaction this_arg_conv;
25649 this_arg_conv.inner = (void*)(this_arg & (~1));
25650 this_arg_conv.is_owned = false;
25651 unsigned char funding_key_arr[32];
25652 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
25653 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
25654 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25655 LDKu8slice funding_redeemscript_ref;
25656 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25657 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25658 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25659 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
25660 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25665 LDKClosingTransaction this_obj_conv;
25666 this_obj_conv.inner = (void*)(this_obj & (~1));
25667 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25668 ClosingTransaction_free(this_obj_conv);
25671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
25672 LDKCVec_u8Z to_holder_script_ref;
25673 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
25674 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
25675 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
25676 LDKCVec_u8Z to_counterparty_script_ref;
25677 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
25678 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
25679 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
25680 LDKOutPoint funding_outpoint_conv;
25681 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25682 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25683 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25684 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
25685 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25686 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25687 uint64_t ret_ref = (uint64_t)ret_var.inner;
25688 if (ret_var.is_owned) {
25694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
25695 LDKClosingTransaction this_arg_conv;
25696 this_arg_conv.inner = (void*)(this_arg & (~1));
25697 this_arg_conv.is_owned = false;
25698 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
25699 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25700 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25701 uint64_t ret_ref = (uint64_t)ret_var.inner;
25702 if (ret_var.is_owned) {
25708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
25709 LDKClosingTransaction this_arg_conv;
25710 this_arg_conv.inner = (void*)(this_arg & (~1));
25711 this_arg_conv.is_owned = false;
25712 LDKOutPoint funding_outpoint_conv;
25713 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25714 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25715 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25716 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
25717 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
25718 return (uint64_t)ret_conv;
25721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25722 LDKClosingTransaction this_arg_conv;
25723 this_arg_conv.inner = (void*)(this_arg & (~1));
25724 this_arg_conv.is_owned = false;
25725 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
25729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25730 LDKClosingTransaction this_arg_conv;
25731 this_arg_conv.inner = (void*)(this_arg & (~1));
25732 this_arg_conv.is_owned = false;
25733 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
25737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
25738 LDKClosingTransaction this_arg_conv;
25739 this_arg_conv.inner = (void*)(this_arg & (~1));
25740 this_arg_conv.is_owned = false;
25741 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
25742 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25743 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
25748 LDKClosingTransaction this_arg_conv;
25749 this_arg_conv.inner = (void*)(this_arg & (~1));
25750 this_arg_conv.is_owned = false;
25751 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
25752 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25753 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25758 LDKTrustedClosingTransaction this_obj_conv;
25759 this_obj_conv.inner = (void*)(this_obj & (~1));
25760 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25761 TrustedClosingTransaction_free(this_obj_conv);
25764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
25765 LDKTrustedClosingTransaction this_arg_conv;
25766 this_arg_conv.inner = (void*)(this_arg & (~1));
25767 this_arg_conv.is_owned = false;
25768 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
25769 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25770 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25771 Transaction_free(ret_var);
25775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
25776 LDKTrustedClosingTransaction this_arg_conv;
25777 this_arg_conv.inner = (void*)(this_arg & (~1));
25778 this_arg_conv.is_owned = false;
25779 LDKu8slice funding_redeemscript_ref;
25780 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25781 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25782 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25783 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
25784 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
25789 LDKTrustedClosingTransaction this_arg_conv;
25790 this_arg_conv.inner = (void*)(this_arg & (~1));
25791 this_arg_conv.is_owned = false;
25792 unsigned char funding_key_arr[32];
25793 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
25794 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
25795 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25796 LDKu8slice funding_redeemscript_ref;
25797 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25798 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25799 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25800 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
25801 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25806 LDKCommitmentTransaction this_obj_conv;
25807 this_obj_conv.inner = (void*)(this_obj & (~1));
25808 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25809 CommitmentTransaction_free(this_obj_conv);
25812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25813 LDKCommitmentTransaction orig_conv;
25814 orig_conv.inner = (void*)(orig & (~1));
25815 orig_conv.is_owned = false;
25816 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
25817 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25818 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25819 uint64_t ret_ref = (uint64_t)ret_var.inner;
25820 if (ret_var.is_owned) {
25826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25827 LDKCommitmentTransaction obj_conv;
25828 obj_conv.inner = (void*)(obj & (~1));
25829 obj_conv.is_owned = false;
25830 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
25831 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25832 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25833 CVec_u8Z_free(ret_var);
25837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25838 LDKu8slice ser_ref;
25839 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25840 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25841 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
25842 *ret_conv = CommitmentTransaction_read(ser_ref);
25843 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25844 return (uint64_t)ret_conv;
25847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
25848 LDKCommitmentTransaction this_arg_conv;
25849 this_arg_conv.inner = (void*)(this_arg & (~1));
25850 this_arg_conv.is_owned = false;
25851 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
25855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25856 LDKCommitmentTransaction this_arg_conv;
25857 this_arg_conv.inner = (void*)(this_arg & (~1));
25858 this_arg_conv.is_owned = false;
25859 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
25863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25864 LDKCommitmentTransaction this_arg_conv;
25865 this_arg_conv.inner = (void*)(this_arg & (~1));
25866 this_arg_conv.is_owned = false;
25867 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
25871 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
25872 LDKCommitmentTransaction this_arg_conv;
25873 this_arg_conv.inner = (void*)(this_arg & (~1));
25874 this_arg_conv.is_owned = false;
25875 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
25879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
25880 LDKCommitmentTransaction this_arg_conv;
25881 this_arg_conv.inner = (void*)(this_arg & (~1));
25882 this_arg_conv.is_owned = false;
25883 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
25884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25886 uint64_t ret_ref = (uint64_t)ret_var.inner;
25887 if (ret_var.is_owned) {
25893 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) {
25894 LDKCommitmentTransaction this_arg_conv;
25895 this_arg_conv.inner = (void*)(this_arg & (~1));
25896 this_arg_conv.is_owned = false;
25897 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25898 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25899 channel_parameters_conv.is_owned = false;
25900 LDKChannelPublicKeys broadcaster_keys_conv;
25901 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
25902 broadcaster_keys_conv.is_owned = false;
25903 LDKChannelPublicKeys countersignatory_keys_conv;
25904 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
25905 countersignatory_keys_conv.is_owned = false;
25906 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
25907 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
25908 return (uint64_t)ret_conv;
25911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25912 LDKTrustedCommitmentTransaction this_obj_conv;
25913 this_obj_conv.inner = (void*)(this_obj & (~1));
25914 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25915 TrustedCommitmentTransaction_free(this_obj_conv);
25918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
25919 LDKTrustedCommitmentTransaction this_arg_conv;
25920 this_arg_conv.inner = (void*)(this_arg & (~1));
25921 this_arg_conv.is_owned = false;
25922 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25923 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
25927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
25928 LDKTrustedCommitmentTransaction this_arg_conv;
25929 this_arg_conv.inner = (void*)(this_arg & (~1));
25930 this_arg_conv.is_owned = false;
25931 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
25932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25934 uint64_t ret_ref = (uint64_t)ret_var.inner;
25935 if (ret_var.is_owned) {
25941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
25942 LDKTrustedCommitmentTransaction this_arg_conv;
25943 this_arg_conv.inner = (void*)(this_arg & (~1));
25944 this_arg_conv.is_owned = false;
25945 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
25946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25948 uint64_t ret_ref = (uint64_t)ret_var.inner;
25949 if (ret_var.is_owned) {
25955 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) {
25956 LDKTrustedCommitmentTransaction this_arg_conv;
25957 this_arg_conv.inner = (void*)(this_arg & (~1));
25958 this_arg_conv.is_owned = false;
25959 unsigned char htlc_base_key_arr[32];
25960 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
25961 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
25962 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
25963 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25964 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25965 channel_parameters_conv.is_owned = false;
25966 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
25967 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
25968 return (uint64_t)ret_conv;
25971 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) {
25972 LDKPublicKey broadcaster_payment_basepoint_ref;
25973 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
25974 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
25975 LDKPublicKey countersignatory_payment_basepoint_ref;
25976 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
25977 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
25978 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
25982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25983 LDKInitFeatures a_conv;
25984 a_conv.inner = (void*)(a & (~1));
25985 a_conv.is_owned = false;
25986 LDKInitFeatures b_conv;
25987 b_conv.inner = (void*)(b & (~1));
25988 b_conv.is_owned = false;
25989 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
25993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25994 LDKNodeFeatures a_conv;
25995 a_conv.inner = (void*)(a & (~1));
25996 a_conv.is_owned = false;
25997 LDKNodeFeatures b_conv;
25998 b_conv.inner = (void*)(b & (~1));
25999 b_conv.is_owned = false;
26000 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
26004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26005 LDKChannelFeatures a_conv;
26006 a_conv.inner = (void*)(a & (~1));
26007 a_conv.is_owned = false;
26008 LDKChannelFeatures b_conv;
26009 b_conv.inner = (void*)(b & (~1));
26010 b_conv.is_owned = false;
26011 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
26015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26016 LDKInvoiceFeatures a_conv;
26017 a_conv.inner = (void*)(a & (~1));
26018 a_conv.is_owned = false;
26019 LDKInvoiceFeatures b_conv;
26020 b_conv.inner = (void*)(b & (~1));
26021 b_conv.is_owned = false;
26022 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
26026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26027 LDKInitFeatures orig_conv;
26028 orig_conv.inner = (void*)(orig & (~1));
26029 orig_conv.is_owned = false;
26030 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
26031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26033 uint64_t ret_ref = (uint64_t)ret_var.inner;
26034 if (ret_var.is_owned) {
26040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26041 LDKNodeFeatures orig_conv;
26042 orig_conv.inner = (void*)(orig & (~1));
26043 orig_conv.is_owned = false;
26044 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
26045 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26046 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26047 uint64_t ret_ref = (uint64_t)ret_var.inner;
26048 if (ret_var.is_owned) {
26054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26055 LDKChannelFeatures orig_conv;
26056 orig_conv.inner = (void*)(orig & (~1));
26057 orig_conv.is_owned = false;
26058 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
26059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26061 uint64_t ret_ref = (uint64_t)ret_var.inner;
26062 if (ret_var.is_owned) {
26068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26069 LDKInvoiceFeatures orig_conv;
26070 orig_conv.inner = (void*)(orig & (~1));
26071 orig_conv.is_owned = false;
26072 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
26073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26075 uint64_t ret_ref = (uint64_t)ret_var.inner;
26076 if (ret_var.is_owned) {
26082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26083 LDKInitFeatures this_obj_conv;
26084 this_obj_conv.inner = (void*)(this_obj & (~1));
26085 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26086 InitFeatures_free(this_obj_conv);
26089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26090 LDKNodeFeatures this_obj_conv;
26091 this_obj_conv.inner = (void*)(this_obj & (~1));
26092 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26093 NodeFeatures_free(this_obj_conv);
26096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26097 LDKChannelFeatures this_obj_conv;
26098 this_obj_conv.inner = (void*)(this_obj & (~1));
26099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26100 ChannelFeatures_free(this_obj_conv);
26103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26104 LDKInvoiceFeatures this_obj_conv;
26105 this_obj_conv.inner = (void*)(this_obj & (~1));
26106 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26107 InvoiceFeatures_free(this_obj_conv);
26110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
26111 LDKInitFeatures ret_var = InitFeatures_empty();
26112 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26113 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26114 uint64_t ret_ref = (uint64_t)ret_var.inner;
26115 if (ret_var.is_owned) {
26121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
26122 LDKInitFeatures ret_var = InitFeatures_known();
26123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26125 uint64_t ret_ref = (uint64_t)ret_var.inner;
26126 if (ret_var.is_owned) {
26132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26133 LDKInitFeatures this_arg_conv;
26134 this_arg_conv.inner = (void*)(this_arg & (~1));
26135 this_arg_conv.is_owned = false;
26136 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
26140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
26141 LDKNodeFeatures ret_var = NodeFeatures_empty();
26142 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26143 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26144 uint64_t ret_ref = (uint64_t)ret_var.inner;
26145 if (ret_var.is_owned) {
26151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
26152 LDKNodeFeatures ret_var = NodeFeatures_known();
26153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26155 uint64_t ret_ref = (uint64_t)ret_var.inner;
26156 if (ret_var.is_owned) {
26162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26163 LDKNodeFeatures this_arg_conv;
26164 this_arg_conv.inner = (void*)(this_arg & (~1));
26165 this_arg_conv.is_owned = false;
26166 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
26170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
26171 LDKChannelFeatures ret_var = ChannelFeatures_empty();
26172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26174 uint64_t ret_ref = (uint64_t)ret_var.inner;
26175 if (ret_var.is_owned) {
26181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
26182 LDKChannelFeatures ret_var = ChannelFeatures_known();
26183 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26184 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26185 uint64_t ret_ref = (uint64_t)ret_var.inner;
26186 if (ret_var.is_owned) {
26192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26193 LDKChannelFeatures this_arg_conv;
26194 this_arg_conv.inner = (void*)(this_arg & (~1));
26195 this_arg_conv.is_owned = false;
26196 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
26200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
26201 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
26202 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26203 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26204 uint64_t ret_ref = (uint64_t)ret_var.inner;
26205 if (ret_var.is_owned) {
26211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
26212 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
26213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26215 uint64_t ret_ref = (uint64_t)ret_var.inner;
26216 if (ret_var.is_owned) {
26222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26223 LDKInvoiceFeatures this_arg_conv;
26224 this_arg_conv.inner = (void*)(this_arg & (~1));
26225 this_arg_conv.is_owned = false;
26226 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
26230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26231 LDKInitFeatures this_arg_conv;
26232 this_arg_conv.inner = (void*)(this_arg & (~1));
26233 this_arg_conv.is_owned = false;
26234 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
26238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26239 LDKNodeFeatures this_arg_conv;
26240 this_arg_conv.inner = (void*)(this_arg & (~1));
26241 this_arg_conv.is_owned = false;
26242 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
26246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26247 LDKInvoiceFeatures this_arg_conv;
26248 this_arg_conv.inner = (void*)(this_arg & (~1));
26249 this_arg_conv.is_owned = false;
26250 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
26254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26255 LDKInitFeatures obj_conv;
26256 obj_conv.inner = (void*)(obj & (~1));
26257 obj_conv.is_owned = false;
26258 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
26259 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26260 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26261 CVec_u8Z_free(ret_var);
26265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26266 LDKNodeFeatures obj_conv;
26267 obj_conv.inner = (void*)(obj & (~1));
26268 obj_conv.is_owned = false;
26269 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
26270 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26271 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26272 CVec_u8Z_free(ret_var);
26276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26277 LDKChannelFeatures obj_conv;
26278 obj_conv.inner = (void*)(obj & (~1));
26279 obj_conv.is_owned = false;
26280 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
26281 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26282 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26283 CVec_u8Z_free(ret_var);
26287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26288 LDKInvoiceFeatures obj_conv;
26289 obj_conv.inner = (void*)(obj & (~1));
26290 obj_conv.is_owned = false;
26291 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
26292 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26293 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26294 CVec_u8Z_free(ret_var);
26298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26299 LDKu8slice ser_ref;
26300 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26301 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26302 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
26303 *ret_conv = InitFeatures_read(ser_ref);
26304 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26305 return (uint64_t)ret_conv;
26308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26309 LDKu8slice ser_ref;
26310 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26311 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26312 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
26313 *ret_conv = NodeFeatures_read(ser_ref);
26314 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26315 return (uint64_t)ret_conv;
26318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26319 LDKu8slice ser_ref;
26320 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26321 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26322 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
26323 *ret_conv = ChannelFeatures_read(ser_ref);
26324 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26325 return (uint64_t)ret_conv;
26328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26329 LDKu8slice ser_ref;
26330 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26331 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26332 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
26333 *ret_conv = InvoiceFeatures_read(ser_ref);
26334 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26335 return (uint64_t)ret_conv;
26338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26339 LDKShutdownScript this_obj_conv;
26340 this_obj_conv.inner = (void*)(this_obj & (~1));
26341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26342 ShutdownScript_free(this_obj_conv);
26345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26346 LDKShutdownScript orig_conv;
26347 orig_conv.inner = (void*)(orig & (~1));
26348 orig_conv.is_owned = false;
26349 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
26350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26352 uint64_t ret_ref = (uint64_t)ret_var.inner;
26353 if (ret_var.is_owned) {
26359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26360 LDKInvalidShutdownScript this_obj_conv;
26361 this_obj_conv.inner = (void*)(this_obj & (~1));
26362 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26363 InvalidShutdownScript_free(this_obj_conv);
26366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
26367 LDKInvalidShutdownScript this_ptr_conv;
26368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26369 this_ptr_conv.is_owned = false;
26370 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
26371 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26372 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26377 LDKInvalidShutdownScript this_ptr_conv;
26378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26379 this_ptr_conv.is_owned = false;
26380 LDKCVec_u8Z val_ref;
26381 val_ref.datalen = (*env)->GetArrayLength(env, val);
26382 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
26383 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26384 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
26387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
26388 LDKCVec_u8Z script_arg_ref;
26389 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
26390 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
26391 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
26392 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
26393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26395 uint64_t ret_ref = (uint64_t)ret_var.inner;
26396 if (ret_var.is_owned) {
26402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
26403 LDKShutdownScript obj_conv;
26404 obj_conv.inner = (void*)(obj & (~1));
26405 obj_conv.is_owned = false;
26406 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
26407 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26408 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26409 CVec_u8Z_free(ret_var);
26413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26414 LDKu8slice ser_ref;
26415 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26416 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26417 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26418 *ret_conv = ShutdownScript_read(ser_ref);
26419 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26420 return (uint64_t)ret_conv;
26423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
26424 unsigned char pubkey_hash_arr[20];
26425 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
26426 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
26427 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
26428 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
26429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26431 uint64_t ret_ref = (uint64_t)ret_var.inner;
26432 if (ret_var.is_owned) {
26438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
26439 unsigned char script_hash_arr[20];
26440 CHECK((*env)->GetArrayLength(env, script_hash) == 20);
26441 (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
26442 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
26443 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
26444 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26445 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26446 uint64_t ret_ref = (uint64_t)ret_var.inner;
26447 if (ret_var.is_owned) {
26453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
26454 unsigned char pubkey_hash_arr[20];
26455 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
26456 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
26457 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
26458 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
26459 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26460 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26461 uint64_t ret_ref = (uint64_t)ret_var.inner;
26462 if (ret_var.is_owned) {
26468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
26469 unsigned char script_hash_arr[32];
26470 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
26471 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
26472 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
26473 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
26474 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26475 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26476 uint64_t ret_ref = (uint64_t)ret_var.inner;
26477 if (ret_var.is_owned) {
26483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
26484 LDKu8slice program_ref;
26485 program_ref.datalen = (*env)->GetArrayLength(env, program);
26486 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
26487 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26488 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
26489 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
26490 return (uint64_t)ret_conv;
26493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
26494 LDKShutdownScript this_arg_conv;
26495 this_arg_conv.inner = (void*)(this_arg & (~1));
26496 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26497 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
26498 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
26499 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26500 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26501 CVec_u8Z_free(ret_var);
26505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
26506 LDKShutdownScript this_arg_conv;
26507 this_arg_conv.inner = (void*)(this_arg & (~1));
26508 this_arg_conv.is_owned = false;
26509 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
26514 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
26515 LDKShutdownScript this_arg_conv;
26516 this_arg_conv.inner = (void*)(this_arg & (~1));
26517 this_arg_conv.is_owned = false;
26518 LDKInitFeatures features_conv;
26519 features_conv.inner = (void*)(features & (~1));
26520 features_conv.is_owned = false;
26521 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
26525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26526 if ((this_ptr & 1) != 0) return;
26527 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
26528 FREE((void*)this_ptr);
26529 CustomMessageReader_free(this_ptr_conv);
26532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26533 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
26534 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
26535 *ret_ret = Type_clone(orig_conv);
26536 return (uint64_t)ret_ret;
26539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26540 if ((this_ptr & 1) != 0) return;
26541 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
26542 FREE((void*)this_ptr);
26543 Type_free(this_ptr_conv);
26546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26547 LDKRouteHop this_obj_conv;
26548 this_obj_conv.inner = (void*)(this_obj & (~1));
26549 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26550 RouteHop_free(this_obj_conv);
26553 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26554 LDKRouteHop this_ptr_conv;
26555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26556 this_ptr_conv.is_owned = false;
26557 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26558 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
26562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26563 LDKRouteHop this_ptr_conv;
26564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26565 this_ptr_conv.is_owned = false;
26566 LDKPublicKey val_ref;
26567 CHECK((*env)->GetArrayLength(env, val) == 33);
26568 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26569 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
26572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26573 LDKRouteHop this_ptr_conv;
26574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26575 this_ptr_conv.is_owned = false;
26576 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
26577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26579 uint64_t ret_ref = (uint64_t)ret_var.inner;
26580 if (ret_var.is_owned) {
26586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26587 LDKRouteHop this_ptr_conv;
26588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26589 this_ptr_conv.is_owned = false;
26590 LDKNodeFeatures val_conv;
26591 val_conv.inner = (void*)(val & (~1));
26592 val_conv.is_owned = (val & 1) || (val == 0);
26593 val_conv = NodeFeatures_clone(&val_conv);
26594 RouteHop_set_node_features(&this_ptr_conv, val_conv);
26597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26598 LDKRouteHop this_ptr_conv;
26599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26600 this_ptr_conv.is_owned = false;
26601 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
26605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26606 LDKRouteHop this_ptr_conv;
26607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26608 this_ptr_conv.is_owned = false;
26609 RouteHop_set_short_channel_id(&this_ptr_conv, val);
26612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26613 LDKRouteHop this_ptr_conv;
26614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26615 this_ptr_conv.is_owned = false;
26616 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
26617 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26618 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26619 uint64_t ret_ref = (uint64_t)ret_var.inner;
26620 if (ret_var.is_owned) {
26626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26627 LDKRouteHop this_ptr_conv;
26628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26629 this_ptr_conv.is_owned = false;
26630 LDKChannelFeatures val_conv;
26631 val_conv.inner = (void*)(val & (~1));
26632 val_conv.is_owned = (val & 1) || (val == 0);
26633 val_conv = ChannelFeatures_clone(&val_conv);
26634 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
26637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26638 LDKRouteHop this_ptr_conv;
26639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26640 this_ptr_conv.is_owned = false;
26641 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
26645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26646 LDKRouteHop this_ptr_conv;
26647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26648 this_ptr_conv.is_owned = false;
26649 RouteHop_set_fee_msat(&this_ptr_conv, val);
26652 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26653 LDKRouteHop this_ptr_conv;
26654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26655 this_ptr_conv.is_owned = false;
26656 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
26660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26661 LDKRouteHop this_ptr_conv;
26662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26663 this_ptr_conv.is_owned = false;
26664 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26667 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) {
26668 LDKPublicKey pubkey_arg_ref;
26669 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
26670 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
26671 LDKNodeFeatures node_features_arg_conv;
26672 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
26673 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
26674 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
26675 LDKChannelFeatures channel_features_arg_conv;
26676 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
26677 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
26678 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
26679 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);
26680 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26681 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26682 uint64_t ret_ref = (uint64_t)ret_var.inner;
26683 if (ret_var.is_owned) {
26689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26690 LDKRouteHop orig_conv;
26691 orig_conv.inner = (void*)(orig & (~1));
26692 orig_conv.is_owned = false;
26693 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
26694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26696 uint64_t ret_ref = (uint64_t)ret_var.inner;
26697 if (ret_var.is_owned) {
26703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
26704 LDKRouteHop o_conv;
26705 o_conv.inner = (void*)(o & (~1));
26706 o_conv.is_owned = false;
26707 int64_t ret_val = RouteHop_hash(&o_conv);
26711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26712 LDKRouteHop a_conv;
26713 a_conv.inner = (void*)(a & (~1));
26714 a_conv.is_owned = false;
26715 LDKRouteHop b_conv;
26716 b_conv.inner = (void*)(b & (~1));
26717 b_conv.is_owned = false;
26718 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
26722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
26723 LDKRouteHop obj_conv;
26724 obj_conv.inner = (void*)(obj & (~1));
26725 obj_conv.is_owned = false;
26726 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
26727 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26728 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26729 CVec_u8Z_free(ret_var);
26733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26734 LDKu8slice ser_ref;
26735 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26736 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26737 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26738 *ret_conv = RouteHop_read(ser_ref);
26739 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26740 return (uint64_t)ret_conv;
26743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26744 LDKRoute this_obj_conv;
26745 this_obj_conv.inner = (void*)(this_obj & (~1));
26746 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26747 Route_free(this_obj_conv);
26750 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26751 LDKRoute this_ptr_conv;
26752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26753 this_ptr_conv.is_owned = false;
26754 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
26755 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
26757 for (size_t m = 0; m < ret_var.datalen; m++) {
26758 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
26759 int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
26760 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
26761 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
26762 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
26763 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26764 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26765 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
26766 if (ret_conv_12_conv_10_var.is_owned) {
26767 ret_conv_12_conv_10_ref |= 1;
26769 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
26771 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
26772 FREE(ret_conv_12_var.data);
26773 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
26775 FREE(ret_var.data);
26779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
26780 LDKRoute this_ptr_conv;
26781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26782 this_ptr_conv.is_owned = false;
26783 LDKCVec_CVec_RouteHopZZ val_constr;
26784 val_constr.datalen = (*env)->GetArrayLength(env, val);
26785 if (val_constr.datalen > 0)
26786 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26788 val_constr.data = NULL;
26789 for (size_t m = 0; m < val_constr.datalen; m++) {
26790 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
26791 LDKCVec_RouteHopZ val_conv_12_constr;
26792 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
26793 if (val_conv_12_constr.datalen > 0)
26794 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26796 val_conv_12_constr.data = NULL;
26797 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
26798 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
26799 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
26800 LDKRouteHop val_conv_12_conv_10_conv;
26801 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
26802 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
26803 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
26804 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
26806 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
26807 val_constr.data[m] = val_conv_12_constr;
26809 Route_set_paths(&this_ptr_conv, val_constr);
26812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
26813 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
26814 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
26815 if (paths_arg_constr.datalen > 0)
26816 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26818 paths_arg_constr.data = NULL;
26819 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
26820 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
26821 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
26822 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
26823 if (paths_arg_conv_12_constr.datalen > 0)
26824 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26826 paths_arg_conv_12_constr.data = NULL;
26827 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
26828 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
26829 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
26830 LDKRouteHop paths_arg_conv_12_conv_10_conv;
26831 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
26832 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
26833 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
26834 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
26836 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
26837 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
26839 LDKRoute ret_var = Route_new(paths_arg_constr);
26840 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26841 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26842 uint64_t ret_ref = (uint64_t)ret_var.inner;
26843 if (ret_var.is_owned) {
26849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26850 LDKRoute orig_conv;
26851 orig_conv.inner = (void*)(orig & (~1));
26852 orig_conv.is_owned = false;
26853 LDKRoute ret_var = Route_clone(&orig_conv);
26854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26856 uint64_t ret_ref = (uint64_t)ret_var.inner;
26857 if (ret_var.is_owned) {
26863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
26865 o_conv.inner = (void*)(o & (~1));
26866 o_conv.is_owned = false;
26867 int64_t ret_val = Route_hash(&o_conv);
26871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26873 a_conv.inner = (void*)(a & (~1));
26874 a_conv.is_owned = false;
26876 b_conv.inner = (void*)(b & (~1));
26877 b_conv.is_owned = false;
26878 jboolean ret_val = Route_eq(&a_conv, &b_conv);
26882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
26883 LDKRoute this_arg_conv;
26884 this_arg_conv.inner = (void*)(this_arg & (~1));
26885 this_arg_conv.is_owned = false;
26886 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
26890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
26891 LDKRoute this_arg_conv;
26892 this_arg_conv.inner = (void*)(this_arg & (~1));
26893 this_arg_conv.is_owned = false;
26894 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
26898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
26900 obj_conv.inner = (void*)(obj & (~1));
26901 obj_conv.is_owned = false;
26902 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
26903 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26904 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26905 CVec_u8Z_free(ret_var);
26909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26910 LDKu8slice ser_ref;
26911 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26912 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26913 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26914 *ret_conv = Route_read(ser_ref);
26915 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26916 return (uint64_t)ret_conv;
26919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26920 LDKRouteHint this_obj_conv;
26921 this_obj_conv.inner = (void*)(this_obj & (~1));
26922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26923 RouteHint_free(this_obj_conv);
26926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26927 LDKRouteHint orig_conv;
26928 orig_conv.inner = (void*)(orig & (~1));
26929 orig_conv.is_owned = false;
26930 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
26931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26933 uint64_t ret_ref = (uint64_t)ret_var.inner;
26934 if (ret_var.is_owned) {
26940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26941 LDKRouteHint o_conv;
26942 o_conv.inner = (void*)(o & (~1));
26943 o_conv.is_owned = false;
26944 int64_t ret_val = RouteHint_hash(&o_conv);
26948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26949 LDKRouteHint a_conv;
26950 a_conv.inner = (void*)(a & (~1));
26951 a_conv.is_owned = false;
26952 LDKRouteHint b_conv;
26953 b_conv.inner = (void*)(b & (~1));
26954 b_conv.is_owned = false;
26955 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
26959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26960 LDKRouteHintHop this_obj_conv;
26961 this_obj_conv.inner = (void*)(this_obj & (~1));
26962 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26963 RouteHintHop_free(this_obj_conv);
26966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26967 LDKRouteHintHop this_ptr_conv;
26968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26969 this_ptr_conv.is_owned = false;
26970 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26971 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
26975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26976 LDKRouteHintHop this_ptr_conv;
26977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26978 this_ptr_conv.is_owned = false;
26979 LDKPublicKey val_ref;
26980 CHECK((*env)->GetArrayLength(env, val) == 33);
26981 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26982 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
26985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26986 LDKRouteHintHop this_ptr_conv;
26987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26988 this_ptr_conv.is_owned = false;
26989 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
26993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26994 LDKRouteHintHop this_ptr_conv;
26995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26996 this_ptr_conv.is_owned = false;
26997 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
27000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
27001 LDKRouteHintHop this_ptr_conv;
27002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27003 this_ptr_conv.is_owned = false;
27004 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
27005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27007 uint64_t ret_ref = (uint64_t)ret_var.inner;
27008 if (ret_var.is_owned) {
27014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27015 LDKRouteHintHop this_ptr_conv;
27016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27017 this_ptr_conv.is_owned = false;
27018 LDKRoutingFees val_conv;
27019 val_conv.inner = (void*)(val & (~1));
27020 val_conv.is_owned = (val & 1) || (val == 0);
27021 val_conv = RoutingFees_clone(&val_conv);
27022 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
27025 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27026 LDKRouteHintHop this_ptr_conv;
27027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27028 this_ptr_conv.is_owned = false;
27029 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
27033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27034 LDKRouteHintHop this_ptr_conv;
27035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27036 this_ptr_conv.is_owned = false;
27037 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
27040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27041 LDKRouteHintHop this_ptr_conv;
27042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27043 this_ptr_conv.is_owned = false;
27044 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27045 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
27046 uint64_t ret_ref = (uint64_t)ret_copy;
27050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27051 LDKRouteHintHop this_ptr_conv;
27052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27053 this_ptr_conv.is_owned = false;
27054 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27055 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27056 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
27059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27060 LDKRouteHintHop this_ptr_conv;
27061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27062 this_ptr_conv.is_owned = false;
27063 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27064 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
27065 uint64_t ret_ref = (uint64_t)ret_copy;
27069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27070 LDKRouteHintHop this_ptr_conv;
27071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27072 this_ptr_conv.is_owned = false;
27073 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27074 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27075 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
27078 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) {
27079 LDKPublicKey src_node_id_arg_ref;
27080 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
27081 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
27082 LDKRoutingFees fees_arg_conv;
27083 fees_arg_conv.inner = (void*)(fees_arg & (~1));
27084 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
27085 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
27086 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
27087 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
27088 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
27089 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
27090 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);
27091 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27092 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27093 uint64_t ret_ref = (uint64_t)ret_var.inner;
27094 if (ret_var.is_owned) {
27100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27101 LDKRouteHintHop orig_conv;
27102 orig_conv.inner = (void*)(orig & (~1));
27103 orig_conv.is_owned = false;
27104 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
27105 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27106 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27107 uint64_t ret_ref = (uint64_t)ret_var.inner;
27108 if (ret_var.is_owned) {
27114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
27115 LDKRouteHintHop o_conv;
27116 o_conv.inner = (void*)(o & (~1));
27117 o_conv.is_owned = false;
27118 int64_t ret_val = RouteHintHop_hash(&o_conv);
27122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27123 LDKRouteHintHop a_conv;
27124 a_conv.inner = (void*)(a & (~1));
27125 a_conv.is_owned = false;
27126 LDKRouteHintHop b_conv;
27127 b_conv.inner = (void*)(b & (~1));
27128 b_conv.is_owned = false;
27129 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
27133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
27134 LDKPublicKey our_node_id_ref;
27135 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
27136 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
27137 LDKNetworkGraph network_conv;
27138 network_conv.inner = (void*)(network & (~1));
27139 network_conv.is_owned = false;
27140 LDKPublicKey payee_ref;
27141 CHECK((*env)->GetArrayLength(env, payee) == 33);
27142 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
27143 LDKCVec_ChannelDetailsZ first_hops_constr;
27144 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
27145 if (first_hops != NULL) {
27146 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
27147 if (first_hops_constr.datalen > 0)
27148 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27150 first_hops_constr.data = NULL;
27151 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
27152 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
27153 int64_t first_hops_conv_16 = first_hops_vals[q];
27154 LDKChannelDetails first_hops_conv_16_conv;
27155 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
27156 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
27157 first_hops_constr.data[q] = first_hops_conv_16_conv;
27159 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
27160 first_hops_ptr = &first_hops_constr;
27162 LDKCVec_RouteHintZ last_hops_constr;
27163 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
27164 if (last_hops_constr.datalen > 0)
27165 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
27167 last_hops_constr.data = NULL;
27168 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
27169 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
27170 int64_t last_hops_conv_11 = last_hops_vals[l];
27171 LDKRouteHint last_hops_conv_11_conv;
27172 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
27173 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
27174 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
27175 last_hops_constr.data[l] = last_hops_conv_11_conv;
27177 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
27178 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27179 if (logger_conv.free == LDKLogger_JCalls_free) {
27180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27181 LDKLogger_JCalls_cloned(&logger_conv);
27183 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
27184 *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
27185 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
27186 return (uint64_t)ret_conv;
27189 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) {
27190 LDKPublicKey our_node_id_ref;
27191 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
27192 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
27193 LDKNetworkGraph network_conv;
27194 network_conv.inner = (void*)(network & (~1));
27195 network_conv.is_owned = false;
27196 LDKPublicKey payee_ref;
27197 CHECK((*env)->GetArrayLength(env, payee) == 33);
27198 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
27199 LDKInvoiceFeatures payee_features_conv;
27200 payee_features_conv.inner = (void*)(payee_features & (~1));
27201 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
27202 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
27203 LDKCVec_ChannelDetailsZ first_hops_constr;
27204 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
27205 if (first_hops != NULL) {
27206 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
27207 if (first_hops_constr.datalen > 0)
27208 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27210 first_hops_constr.data = NULL;
27211 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
27212 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
27213 int64_t first_hops_conv_16 = first_hops_vals[q];
27214 LDKChannelDetails first_hops_conv_16_conv;
27215 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
27216 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
27217 first_hops_constr.data[q] = first_hops_conv_16_conv;
27219 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
27220 first_hops_ptr = &first_hops_constr;
27222 LDKCVec_RouteHintZ last_hops_constr;
27223 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
27224 if (last_hops_constr.datalen > 0)
27225 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
27227 last_hops_constr.data = NULL;
27228 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
27229 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
27230 int64_t last_hops_conv_11 = last_hops_vals[l];
27231 LDKRouteHint last_hops_conv_11_conv;
27232 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
27233 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
27234 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
27235 last_hops_constr.data[l] = last_hops_conv_11_conv;
27237 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
27238 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27239 if (logger_conv.free == LDKLogger_JCalls_free) {
27240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27241 LDKLogger_JCalls_cloned(&logger_conv);
27243 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
27244 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
27245 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
27246 return (uint64_t)ret_conv;
27249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27250 LDKNetworkGraph this_obj_conv;
27251 this_obj_conv.inner = (void*)(this_obj & (~1));
27252 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27253 NetworkGraph_free(this_obj_conv);
27256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27257 LDKNetworkGraph orig_conv;
27258 orig_conv.inner = (void*)(orig & (~1));
27259 orig_conv.is_owned = false;
27260 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
27261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27263 uint64_t ret_ref = (uint64_t)ret_var.inner;
27264 if (ret_var.is_owned) {
27270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27271 LDKReadOnlyNetworkGraph this_obj_conv;
27272 this_obj_conv.inner = (void*)(this_obj & (~1));
27273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27274 ReadOnlyNetworkGraph_free(this_obj_conv);
27277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27278 if ((this_ptr & 1) != 0) return;
27279 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
27280 FREE((void*)this_ptr);
27281 NetworkUpdate_free(this_ptr_conv);
27284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27285 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
27286 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27287 *ret_copy = NetworkUpdate_clone(orig_conv);
27288 uint64_t ret_ref = (uint64_t)ret_copy;
27292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
27293 LDKChannelUpdate msg_conv;
27294 msg_conv.inner = (void*)(msg & (~1));
27295 msg_conv.is_owned = (msg & 1) || (msg == 0);
27296 msg_conv = ChannelUpdate_clone(&msg_conv);
27297 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27298 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
27299 uint64_t ret_ref = (uint64_t)ret_copy;
27303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
27304 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27305 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
27306 uint64_t ret_ref = (uint64_t)ret_copy;
27310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
27311 LDKPublicKey node_id_ref;
27312 CHECK((*env)->GetArrayLength(env, node_id) == 33);
27313 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27314 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27315 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
27316 uint64_t ret_ref = (uint64_t)ret_copy;
27320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27321 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
27322 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
27323 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27324 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27325 CVec_u8Z_free(ret_var);
27329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27330 LDKNetGraphMsgHandler this_arg_conv;
27331 this_arg_conv.inner = (void*)(this_arg & (~1));
27332 this_arg_conv.is_owned = false;
27333 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
27334 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
27335 return (uint64_t)ret_ret;
27338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27339 LDKNetGraphMsgHandler this_obj_conv;
27340 this_obj_conv.inner = (void*)(this_obj & (~1));
27341 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27342 NetGraphMsgHandler_free(this_obj_conv);
27345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) {
27346 LDKNetGraphMsgHandler this_ptr_conv;
27347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27348 this_ptr_conv.is_owned = false;
27349 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
27350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27352 uint64_t ret_ref = (uint64_t)ret_var.inner;
27353 if (ret_var.is_owned) {
27359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27360 LDKNetGraphMsgHandler this_ptr_conv;
27361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27362 this_ptr_conv.is_owned = false;
27363 LDKNetworkGraph val_conv;
27364 val_conv.inner = (void*)(val & (~1));
27365 val_conv.is_owned = (val & 1) || (val == 0);
27366 val_conv = NetworkGraph_clone(&val_conv);
27367 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
27370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
27371 LDKNetworkGraph network_graph_conv;
27372 network_graph_conv.inner = (void*)(network_graph & (~1));
27373 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
27374 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
27375 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27376 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27377 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27378 // Manually implement clone for Java trait instances
27379 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27380 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27381 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27384 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27385 if (logger_conv.free == LDKLogger_JCalls_free) {
27386 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27387 LDKLogger_JCalls_cloned(&logger_conv);
27389 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
27390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27392 uint64_t ret_ref = (uint64_t)ret_var.inner;
27393 if (ret_var.is_owned) {
27399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
27400 LDKNetGraphMsgHandler this_arg_conv;
27401 this_arg_conv.inner = (void*)(this_arg & (~1));
27402 this_arg_conv.is_owned = false;
27403 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27404 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27405 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27406 // Manually implement clone for Java trait instances
27407 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27408 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27409 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27412 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
27415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27416 LDKNetGraphMsgHandler this_arg_conv;
27417 this_arg_conv.inner = (void*)(this_arg & (~1));
27418 this_arg_conv.is_owned = false;
27419 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
27420 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
27421 return (uint64_t)ret_ret;
27424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27425 LDKNetGraphMsgHandler this_arg_conv;
27426 this_arg_conv.inner = (void*)(this_arg & (~1));
27427 this_arg_conv.is_owned = false;
27428 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27429 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
27430 return (uint64_t)ret_ret;
27433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27434 LDKDirectionalChannelInfo this_obj_conv;
27435 this_obj_conv.inner = (void*)(this_obj & (~1));
27436 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27437 DirectionalChannelInfo_free(this_obj_conv);
27440 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
27441 LDKDirectionalChannelInfo this_ptr_conv;
27442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27443 this_ptr_conv.is_owned = false;
27444 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
27448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27449 LDKDirectionalChannelInfo this_ptr_conv;
27450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27451 this_ptr_conv.is_owned = false;
27452 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
27455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
27456 LDKDirectionalChannelInfo this_ptr_conv;
27457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27458 this_ptr_conv.is_owned = false;
27459 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
27463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27464 LDKDirectionalChannelInfo this_ptr_conv;
27465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27466 this_ptr_conv.is_owned = false;
27467 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
27470 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27471 LDKDirectionalChannelInfo this_ptr_conv;
27472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27473 this_ptr_conv.is_owned = false;
27474 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
27478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27479 LDKDirectionalChannelInfo this_ptr_conv;
27480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27481 this_ptr_conv.is_owned = false;
27482 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27486 LDKDirectionalChannelInfo this_ptr_conv;
27487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27488 this_ptr_conv.is_owned = false;
27489 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
27493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27494 LDKDirectionalChannelInfo this_ptr_conv;
27495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27496 this_ptr_conv.is_owned = false;
27497 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
27500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27501 LDKDirectionalChannelInfo this_ptr_conv;
27502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27503 this_ptr_conv.is_owned = false;
27504 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27505 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
27506 uint64_t ret_ref = (uint64_t)ret_copy;
27510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27511 LDKDirectionalChannelInfo this_ptr_conv;
27512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27513 this_ptr_conv.is_owned = false;
27514 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27515 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27516 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
27519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
27520 LDKDirectionalChannelInfo this_ptr_conv;
27521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27522 this_ptr_conv.is_owned = false;
27523 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
27524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27526 uint64_t ret_ref = (uint64_t)ret_var.inner;
27527 if (ret_var.is_owned) {
27533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27534 LDKDirectionalChannelInfo this_ptr_conv;
27535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27536 this_ptr_conv.is_owned = false;
27537 LDKRoutingFees val_conv;
27538 val_conv.inner = (void*)(val & (~1));
27539 val_conv.is_owned = (val & 1) || (val == 0);
27540 val_conv = RoutingFees_clone(&val_conv);
27541 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
27544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27545 LDKDirectionalChannelInfo this_ptr_conv;
27546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27547 this_ptr_conv.is_owned = false;
27548 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
27549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27551 uint64_t ret_ref = (uint64_t)ret_var.inner;
27552 if (ret_var.is_owned) {
27558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27559 LDKDirectionalChannelInfo this_ptr_conv;
27560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27561 this_ptr_conv.is_owned = false;
27562 LDKChannelUpdate val_conv;
27563 val_conv.inner = (void*)(val & (~1));
27564 val_conv.is_owned = (val & 1) || (val == 0);
27565 val_conv = ChannelUpdate_clone(&val_conv);
27566 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
27569 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) {
27570 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
27571 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
27572 LDKRoutingFees fees_arg_conv;
27573 fees_arg_conv.inner = (void*)(fees_arg & (~1));
27574 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
27575 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
27576 LDKChannelUpdate last_update_message_arg_conv;
27577 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
27578 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
27579 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
27580 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);
27581 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27582 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27583 uint64_t ret_ref = (uint64_t)ret_var.inner;
27584 if (ret_var.is_owned) {
27590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27591 LDKDirectionalChannelInfo orig_conv;
27592 orig_conv.inner = (void*)(orig & (~1));
27593 orig_conv.is_owned = false;
27594 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
27595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27597 uint64_t ret_ref = (uint64_t)ret_var.inner;
27598 if (ret_var.is_owned) {
27604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27605 LDKDirectionalChannelInfo obj_conv;
27606 obj_conv.inner = (void*)(obj & (~1));
27607 obj_conv.is_owned = false;
27608 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
27609 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27610 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27611 CVec_u8Z_free(ret_var);
27615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27616 LDKu8slice ser_ref;
27617 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27618 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27619 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
27620 *ret_conv = DirectionalChannelInfo_read(ser_ref);
27621 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27622 return (uint64_t)ret_conv;
27625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27626 LDKChannelInfo this_obj_conv;
27627 this_obj_conv.inner = (void*)(this_obj & (~1));
27628 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27629 ChannelInfo_free(this_obj_conv);
27632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27633 LDKChannelInfo this_ptr_conv;
27634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27635 this_ptr_conv.is_owned = false;
27636 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
27637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27639 uint64_t ret_ref = (uint64_t)ret_var.inner;
27640 if (ret_var.is_owned) {
27646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27647 LDKChannelInfo this_ptr_conv;
27648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27649 this_ptr_conv.is_owned = false;
27650 LDKChannelFeatures val_conv;
27651 val_conv.inner = (void*)(val & (~1));
27652 val_conv.is_owned = (val & 1) || (val == 0);
27653 val_conv = ChannelFeatures_clone(&val_conv);
27654 ChannelInfo_set_features(&this_ptr_conv, val_conv);
27657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27658 LDKChannelInfo this_ptr_conv;
27659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27660 this_ptr_conv.is_owned = false;
27661 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27662 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
27666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27667 LDKChannelInfo this_ptr_conv;
27668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27669 this_ptr_conv.is_owned = false;
27670 LDKPublicKey val_ref;
27671 CHECK((*env)->GetArrayLength(env, val) == 33);
27672 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27673 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
27676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27677 LDKChannelInfo this_ptr_conv;
27678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27679 this_ptr_conv.is_owned = false;
27680 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
27681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27683 uint64_t ret_ref = (uint64_t)ret_var.inner;
27684 if (ret_var.is_owned) {
27690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27691 LDKChannelInfo this_ptr_conv;
27692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27693 this_ptr_conv.is_owned = false;
27694 LDKDirectionalChannelInfo val_conv;
27695 val_conv.inner = (void*)(val & (~1));
27696 val_conv.is_owned = (val & 1) || (val == 0);
27697 val_conv = DirectionalChannelInfo_clone(&val_conv);
27698 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
27701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27702 LDKChannelInfo this_ptr_conv;
27703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27704 this_ptr_conv.is_owned = false;
27705 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
27710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27711 LDKChannelInfo this_ptr_conv;
27712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27713 this_ptr_conv.is_owned = false;
27714 LDKPublicKey val_ref;
27715 CHECK((*env)->GetArrayLength(env, val) == 33);
27716 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27717 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
27720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27721 LDKChannelInfo this_ptr_conv;
27722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27723 this_ptr_conv.is_owned = false;
27724 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
27725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27727 uint64_t ret_ref = (uint64_t)ret_var.inner;
27728 if (ret_var.is_owned) {
27734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27735 LDKChannelInfo this_ptr_conv;
27736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27737 this_ptr_conv.is_owned = false;
27738 LDKDirectionalChannelInfo val_conv;
27739 val_conv.inner = (void*)(val & (~1));
27740 val_conv.is_owned = (val & 1) || (val == 0);
27741 val_conv = DirectionalChannelInfo_clone(&val_conv);
27742 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
27745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
27746 LDKChannelInfo this_ptr_conv;
27747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27748 this_ptr_conv.is_owned = false;
27749 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27750 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
27751 uint64_t ret_ref = (uint64_t)ret_copy;
27755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27756 LDKChannelInfo this_ptr_conv;
27757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27758 this_ptr_conv.is_owned = false;
27759 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27760 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27761 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
27764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27765 LDKChannelInfo this_ptr_conv;
27766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27767 this_ptr_conv.is_owned = false;
27768 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
27769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27771 uint64_t ret_ref = (uint64_t)ret_var.inner;
27772 if (ret_var.is_owned) {
27778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27779 LDKChannelInfo this_ptr_conv;
27780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27781 this_ptr_conv.is_owned = false;
27782 LDKChannelAnnouncement val_conv;
27783 val_conv.inner = (void*)(val & (~1));
27784 val_conv.is_owned = (val & 1) || (val == 0);
27785 val_conv = ChannelAnnouncement_clone(&val_conv);
27786 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
27789 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) {
27790 LDKChannelFeatures features_arg_conv;
27791 features_arg_conv.inner = (void*)(features_arg & (~1));
27792 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27793 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
27794 LDKPublicKey node_one_arg_ref;
27795 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
27796 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
27797 LDKDirectionalChannelInfo one_to_two_arg_conv;
27798 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
27799 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
27800 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
27801 LDKPublicKey node_two_arg_ref;
27802 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
27803 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
27804 LDKDirectionalChannelInfo two_to_one_arg_conv;
27805 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
27806 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
27807 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
27808 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
27809 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
27810 LDKChannelAnnouncement announcement_message_arg_conv;
27811 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
27812 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
27813 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
27814 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);
27815 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27816 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27817 uint64_t ret_ref = (uint64_t)ret_var.inner;
27818 if (ret_var.is_owned) {
27824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27825 LDKChannelInfo orig_conv;
27826 orig_conv.inner = (void*)(orig & (~1));
27827 orig_conv.is_owned = false;
27828 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
27829 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27830 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27831 uint64_t ret_ref = (uint64_t)ret_var.inner;
27832 if (ret_var.is_owned) {
27838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27839 LDKChannelInfo obj_conv;
27840 obj_conv.inner = (void*)(obj & (~1));
27841 obj_conv.is_owned = false;
27842 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
27843 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27844 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27845 CVec_u8Z_free(ret_var);
27849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27850 LDKu8slice ser_ref;
27851 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27852 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27853 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
27854 *ret_conv = ChannelInfo_read(ser_ref);
27855 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27856 return (uint64_t)ret_conv;
27859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27860 LDKRoutingFees this_obj_conv;
27861 this_obj_conv.inner = (void*)(this_obj & (~1));
27862 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27863 RoutingFees_free(this_obj_conv);
27866 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27867 LDKRoutingFees this_ptr_conv;
27868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27869 this_ptr_conv.is_owned = false;
27870 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
27874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27875 LDKRoutingFees this_ptr_conv;
27876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27877 this_ptr_conv.is_owned = false;
27878 RoutingFees_set_base_msat(&this_ptr_conv, val);
27881 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27882 LDKRoutingFees this_ptr_conv;
27883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27884 this_ptr_conv.is_owned = false;
27885 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
27889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27890 LDKRoutingFees this_ptr_conv;
27891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27892 this_ptr_conv.is_owned = false;
27893 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
27896 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) {
27897 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
27898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27900 uint64_t ret_ref = (uint64_t)ret_var.inner;
27901 if (ret_var.is_owned) {
27907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27908 LDKRoutingFees a_conv;
27909 a_conv.inner = (void*)(a & (~1));
27910 a_conv.is_owned = false;
27911 LDKRoutingFees b_conv;
27912 b_conv.inner = (void*)(b & (~1));
27913 b_conv.is_owned = false;
27914 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
27918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27919 LDKRoutingFees orig_conv;
27920 orig_conv.inner = (void*)(orig & (~1));
27921 orig_conv.is_owned = false;
27922 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
27923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27925 uint64_t ret_ref = (uint64_t)ret_var.inner;
27926 if (ret_var.is_owned) {
27932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
27933 LDKRoutingFees o_conv;
27934 o_conv.inner = (void*)(o & (~1));
27935 o_conv.is_owned = false;
27936 int64_t ret_val = RoutingFees_hash(&o_conv);
27940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
27941 LDKRoutingFees obj_conv;
27942 obj_conv.inner = (void*)(obj & (~1));
27943 obj_conv.is_owned = false;
27944 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
27945 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27946 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27947 CVec_u8Z_free(ret_var);
27951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27952 LDKu8slice ser_ref;
27953 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27954 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27955 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
27956 *ret_conv = RoutingFees_read(ser_ref);
27957 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27958 return (uint64_t)ret_conv;
27961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27962 LDKNodeAnnouncementInfo this_obj_conv;
27963 this_obj_conv.inner = (void*)(this_obj & (~1));
27964 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27965 NodeAnnouncementInfo_free(this_obj_conv);
27968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27969 LDKNodeAnnouncementInfo this_ptr_conv;
27970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27971 this_ptr_conv.is_owned = false;
27972 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
27973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27975 uint64_t ret_ref = (uint64_t)ret_var.inner;
27976 if (ret_var.is_owned) {
27982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27983 LDKNodeAnnouncementInfo this_ptr_conv;
27984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27985 this_ptr_conv.is_owned = false;
27986 LDKNodeFeatures val_conv;
27987 val_conv.inner = (void*)(val & (~1));
27988 val_conv.is_owned = (val & 1) || (val == 0);
27989 val_conv = NodeFeatures_clone(&val_conv);
27990 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
27993 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
27994 LDKNodeAnnouncementInfo this_ptr_conv;
27995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27996 this_ptr_conv.is_owned = false;
27997 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
28001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28002 LDKNodeAnnouncementInfo this_ptr_conv;
28003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28004 this_ptr_conv.is_owned = false;
28005 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
28008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
28009 LDKNodeAnnouncementInfo this_ptr_conv;
28010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28011 this_ptr_conv.is_owned = false;
28012 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
28013 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
28017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28018 LDKNodeAnnouncementInfo this_ptr_conv;
28019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28020 this_ptr_conv.is_owned = false;
28021 LDKThreeBytes val_ref;
28022 CHECK((*env)->GetArrayLength(env, val) == 3);
28023 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
28024 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
28027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28028 LDKNodeAnnouncementInfo this_ptr_conv;
28029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28030 this_ptr_conv.is_owned = false;
28031 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
28036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28037 LDKNodeAnnouncementInfo this_ptr_conv;
28038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28039 this_ptr_conv.is_owned = false;
28040 LDKThirtyTwoBytes val_ref;
28041 CHECK((*env)->GetArrayLength(env, val) == 32);
28042 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28043 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
28046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28047 LDKNodeAnnouncementInfo this_ptr_conv;
28048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28049 this_ptr_conv.is_owned = false;
28050 LDKCVec_NetAddressZ val_constr;
28051 val_constr.datalen = (*env)->GetArrayLength(env, val);
28052 if (val_constr.datalen > 0)
28053 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28055 val_constr.data = NULL;
28056 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28057 for (size_t m = 0; m < val_constr.datalen; m++) {
28058 int64_t val_conv_12 = val_vals[m];
28059 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
28060 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
28061 val_constr.data[m] = val_conv_12_conv;
28063 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28064 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
28067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
28068 LDKNodeAnnouncementInfo this_ptr_conv;
28069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28070 this_ptr_conv.is_owned = false;
28071 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
28072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28074 uint64_t ret_ref = (uint64_t)ret_var.inner;
28075 if (ret_var.is_owned) {
28081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28082 LDKNodeAnnouncementInfo this_ptr_conv;
28083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28084 this_ptr_conv.is_owned = false;
28085 LDKNodeAnnouncement val_conv;
28086 val_conv.inner = (void*)(val & (~1));
28087 val_conv.is_owned = (val & 1) || (val == 0);
28088 val_conv = NodeAnnouncement_clone(&val_conv);
28089 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
28092 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) {
28093 LDKNodeFeatures features_arg_conv;
28094 features_arg_conv.inner = (void*)(features_arg & (~1));
28095 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28096 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
28097 LDKThreeBytes rgb_arg_ref;
28098 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
28099 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
28100 LDKThirtyTwoBytes alias_arg_ref;
28101 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
28102 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
28103 LDKCVec_NetAddressZ addresses_arg_constr;
28104 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
28105 if (addresses_arg_constr.datalen > 0)
28106 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28108 addresses_arg_constr.data = NULL;
28109 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
28110 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
28111 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
28112 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
28113 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
28115 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
28116 LDKNodeAnnouncement announcement_message_arg_conv;
28117 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
28118 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
28119 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
28120 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
28121 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28122 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28123 uint64_t ret_ref = (uint64_t)ret_var.inner;
28124 if (ret_var.is_owned) {
28130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28131 LDKNodeAnnouncementInfo orig_conv;
28132 orig_conv.inner = (void*)(orig & (~1));
28133 orig_conv.is_owned = false;
28134 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
28135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28137 uint64_t ret_ref = (uint64_t)ret_var.inner;
28138 if (ret_var.is_owned) {
28144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28145 LDKNodeAnnouncementInfo obj_conv;
28146 obj_conv.inner = (void*)(obj & (~1));
28147 obj_conv.is_owned = false;
28148 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
28149 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28150 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28151 CVec_u8Z_free(ret_var);
28155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28156 LDKu8slice ser_ref;
28157 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28158 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28159 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
28160 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
28161 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28162 return (uint64_t)ret_conv;
28165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28166 LDKNodeInfo this_obj_conv;
28167 this_obj_conv.inner = (void*)(this_obj & (~1));
28168 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28169 NodeInfo_free(this_obj_conv);
28172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28173 LDKNodeInfo this_ptr_conv;
28174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28175 this_ptr_conv.is_owned = false;
28176 LDKCVec_u64Z val_constr;
28177 val_constr.datalen = (*env)->GetArrayLength(env, val);
28178 if (val_constr.datalen > 0)
28179 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
28181 val_constr.data = NULL;
28182 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28183 for (size_t g = 0; g < val_constr.datalen; g++) {
28184 int64_t val_conv_6 = val_vals[g];
28185 val_constr.data[g] = val_conv_6;
28187 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28188 NodeInfo_set_channels(&this_ptr_conv, val_constr);
28191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
28192 LDKNodeInfo this_ptr_conv;
28193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28194 this_ptr_conv.is_owned = false;
28195 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
28196 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28197 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28198 uint64_t ret_ref = (uint64_t)ret_var.inner;
28199 if (ret_var.is_owned) {
28205 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) {
28206 LDKNodeInfo this_ptr_conv;
28207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28208 this_ptr_conv.is_owned = false;
28209 LDKRoutingFees val_conv;
28210 val_conv.inner = (void*)(val & (~1));
28211 val_conv.is_owned = (val & 1) || (val == 0);
28212 val_conv = RoutingFees_clone(&val_conv);
28213 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
28216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28217 LDKNodeInfo this_ptr_conv;
28218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28219 this_ptr_conv.is_owned = false;
28220 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
28221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28223 uint64_t ret_ref = (uint64_t)ret_var.inner;
28224 if (ret_var.is_owned) {
28230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28231 LDKNodeInfo this_ptr_conv;
28232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28233 this_ptr_conv.is_owned = false;
28234 LDKNodeAnnouncementInfo val_conv;
28235 val_conv.inner = (void*)(val & (~1));
28236 val_conv.is_owned = (val & 1) || (val == 0);
28237 val_conv = NodeAnnouncementInfo_clone(&val_conv);
28238 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
28241 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) {
28242 LDKCVec_u64Z channels_arg_constr;
28243 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28244 if (channels_arg_constr.datalen > 0)
28245 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
28247 channels_arg_constr.data = NULL;
28248 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28249 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
28250 int64_t channels_arg_conv_6 = channels_arg_vals[g];
28251 channels_arg_constr.data[g] = channels_arg_conv_6;
28253 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28254 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
28255 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
28256 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
28257 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
28258 LDKNodeAnnouncementInfo announcement_info_arg_conv;
28259 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
28260 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
28261 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
28262 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
28263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28265 uint64_t ret_ref = (uint64_t)ret_var.inner;
28266 if (ret_var.is_owned) {
28272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28273 LDKNodeInfo orig_conv;
28274 orig_conv.inner = (void*)(orig & (~1));
28275 orig_conv.is_owned = false;
28276 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
28277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28279 uint64_t ret_ref = (uint64_t)ret_var.inner;
28280 if (ret_var.is_owned) {
28286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28287 LDKNodeInfo obj_conv;
28288 obj_conv.inner = (void*)(obj & (~1));
28289 obj_conv.is_owned = false;
28290 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
28291 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28292 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28293 CVec_u8Z_free(ret_var);
28297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28298 LDKu8slice ser_ref;
28299 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28300 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28301 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
28302 *ret_conv = NodeInfo_read(ser_ref);
28303 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28304 return (uint64_t)ret_conv;
28307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
28308 LDKNetworkGraph obj_conv;
28309 obj_conv.inner = (void*)(obj & (~1));
28310 obj_conv.is_owned = false;
28311 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
28312 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28313 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28314 CVec_u8Z_free(ret_var);
28318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28319 LDKu8slice ser_ref;
28320 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28321 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28322 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
28323 *ret_conv = NetworkGraph_read(ser_ref);
28324 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28325 return (uint64_t)ret_conv;
28328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
28329 LDKThirtyTwoBytes genesis_hash_ref;
28330 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
28331 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
28332 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
28333 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28334 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28335 uint64_t ret_ref = (uint64_t)ret_var.inner;
28336 if (ret_var.is_owned) {
28342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
28343 LDKNetworkGraph this_arg_conv;
28344 this_arg_conv.inner = (void*)(this_arg & (~1));
28345 this_arg_conv.is_owned = false;
28346 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
28347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28349 uint64_t ret_ref = (uint64_t)ret_var.inner;
28350 if (ret_var.is_owned) {
28356 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) {
28357 LDKNetworkGraph this_arg_conv;
28358 this_arg_conv.inner = (void*)(this_arg & (~1));
28359 this_arg_conv.is_owned = false;
28360 LDKNodeAnnouncement msg_conv;
28361 msg_conv.inner = (void*)(msg & (~1));
28362 msg_conv.is_owned = false;
28363 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28364 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
28365 return (uint64_t)ret_conv;
28368 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) {
28369 LDKNetworkGraph this_arg_conv;
28370 this_arg_conv.inner = (void*)(this_arg & (~1));
28371 this_arg_conv.is_owned = false;
28372 LDKUnsignedNodeAnnouncement msg_conv;
28373 msg_conv.inner = (void*)(msg & (~1));
28374 msg_conv.is_owned = false;
28375 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28376 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
28377 return (uint64_t)ret_conv;
28380 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) {
28381 LDKNetworkGraph this_arg_conv;
28382 this_arg_conv.inner = (void*)(this_arg & (~1));
28383 this_arg_conv.is_owned = false;
28384 LDKChannelAnnouncement msg_conv;
28385 msg_conv.inner = (void*)(msg & (~1));
28386 msg_conv.is_owned = false;
28387 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28388 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28389 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28390 // Manually implement clone for Java trait instances
28391 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28392 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28393 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28396 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28397 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28398 return (uint64_t)ret_conv;
28401 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) {
28402 LDKNetworkGraph this_arg_conv;
28403 this_arg_conv.inner = (void*)(this_arg & (~1));
28404 this_arg_conv.is_owned = false;
28405 LDKUnsignedChannelAnnouncement msg_conv;
28406 msg_conv.inner = (void*)(msg & (~1));
28407 msg_conv.is_owned = false;
28408 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28409 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28410 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28411 // Manually implement clone for Java trait instances
28412 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28413 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28414 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28417 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28418 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28419 return (uint64_t)ret_conv;
28422 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) {
28423 LDKNetworkGraph this_arg_conv;
28424 this_arg_conv.inner = (void*)(this_arg & (~1));
28425 this_arg_conv.is_owned = false;
28426 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
28429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
28430 LDKNetworkGraph this_arg_conv;
28431 this_arg_conv.inner = (void*)(this_arg & (~1));
28432 this_arg_conv.is_owned = false;
28433 LDKPublicKey _node_id_ref;
28434 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
28435 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
28436 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
28439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28440 LDKNetworkGraph this_arg_conv;
28441 this_arg_conv.inner = (void*)(this_arg & (~1));
28442 this_arg_conv.is_owned = false;
28443 LDKChannelUpdate msg_conv;
28444 msg_conv.inner = (void*)(msg & (~1));
28445 msg_conv.is_owned = false;
28446 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28447 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
28448 return (uint64_t)ret_conv;
28451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28452 LDKNetworkGraph this_arg_conv;
28453 this_arg_conv.inner = (void*)(this_arg & (~1));
28454 this_arg_conv.is_owned = false;
28455 LDKUnsignedChannelUpdate msg_conv;
28456 msg_conv.inner = (void*)(msg & (~1));
28457 msg_conv.is_owned = false;
28458 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28459 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
28460 return (uint64_t)ret_conv;
28463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28464 LDKFilesystemPersister this_obj_conv;
28465 this_obj_conv.inner = (void*)(this_obj & (~1));
28466 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28467 FilesystemPersister_free(this_obj_conv);
28470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
28471 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
28472 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
28473 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28474 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28475 uint64_t ret_ref = (uint64_t)ret_var.inner;
28476 if (ret_var.is_owned) {
28482 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
28483 LDKFilesystemPersister this_arg_conv;
28484 this_arg_conv.inner = (void*)(this_arg & (~1));
28485 this_arg_conv.is_owned = false;
28486 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
28487 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
28492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
28493 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
28494 LDKChannelManager manager_conv;
28495 manager_conv.inner = (void*)(manager & (~1));
28496 manager_conv.is_owned = false;
28497 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28498 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
28499 return (uint64_t)ret_conv;
28502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
28503 LDKFilesystemPersister this_arg_conv;
28504 this_arg_conv.inner = (void*)(this_arg & (~1));
28505 this_arg_conv.is_owned = false;
28506 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
28507 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28508 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28509 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28511 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
28512 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
28513 return (uint64_t)ret_conv;
28516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
28517 LDKFilesystemPersister this_arg_conv;
28518 this_arg_conv.inner = (void*)(this_arg & (~1));
28519 this_arg_conv.is_owned = false;
28520 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
28521 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
28522 return (uint64_t)ret_ret;
28525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28526 LDKBackgroundProcessor this_obj_conv;
28527 this_obj_conv.inner = (void*)(this_obj & (~1));
28528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28529 BackgroundProcessor_free(this_obj_conv);
28532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28533 if ((this_ptr & 1) != 0) return;
28534 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
28535 FREE((void*)this_ptr);
28536 ChannelManagerPersister_free(this_ptr_conv);
28539 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 net_graph_msg_handler, int64_t peer_manager, int64_t logger) {
28540 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
28541 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
28542 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28543 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
28545 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
28546 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
28547 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28548 LDKEventHandler_JCalls_cloned(&event_handler_conv);
28550 LDKChainMonitor chain_monitor_conv;
28551 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
28552 chain_monitor_conv.is_owned = false;
28553 LDKChannelManager channel_manager_conv;
28554 channel_manager_conv.inner = (void*)(channel_manager & (~1));
28555 channel_manager_conv.is_owned = false;
28556 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
28557 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
28558 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
28559 LDKPeerManager peer_manager_conv;
28560 peer_manager_conv.inner = (void*)(peer_manager & (~1));
28561 peer_manager_conv.is_owned = false;
28562 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
28563 if (logger_conv.free == LDKLogger_JCalls_free) {
28564 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28565 LDKLogger_JCalls_cloned(&logger_conv);
28567 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
28568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28570 uint64_t ret_ref = (uint64_t)ret_var.inner;
28571 if (ret_var.is_owned) {
28577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
28578 LDKBackgroundProcessor this_arg_conv;
28579 this_arg_conv.inner = (void*)(this_arg & (~1));
28580 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28581 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28582 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28583 *ret_conv = BackgroundProcessor_join(this_arg_conv);
28584 return (uint64_t)ret_conv;
28587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
28588 LDKBackgroundProcessor this_arg_conv;
28589 this_arg_conv.inner = (void*)(this_arg & (~1));
28590 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28591 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28592 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28593 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
28594 return (uint64_t)ret_conv;
28597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
28601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28602 LDKInvoice this_obj_conv;
28603 this_obj_conv.inner = (void*)(this_obj & (~1));
28604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28605 Invoice_free(this_obj_conv);
28608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28610 a_conv.inner = (void*)(a & (~1));
28611 a_conv.is_owned = false;
28613 b_conv.inner = (void*)(b & (~1));
28614 b_conv.is_owned = false;
28615 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
28619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28620 LDKInvoice orig_conv;
28621 orig_conv.inner = (void*)(orig & (~1));
28622 orig_conv.is_owned = false;
28623 LDKInvoice ret_var = Invoice_clone(&orig_conv);
28624 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28625 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28626 uint64_t ret_ref = (uint64_t)ret_var.inner;
28627 if (ret_var.is_owned) {
28633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28634 LDKSignedRawInvoice this_obj_conv;
28635 this_obj_conv.inner = (void*)(this_obj & (~1));
28636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28637 SignedRawInvoice_free(this_obj_conv);
28640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28641 LDKSignedRawInvoice a_conv;
28642 a_conv.inner = (void*)(a & (~1));
28643 a_conv.is_owned = false;
28644 LDKSignedRawInvoice b_conv;
28645 b_conv.inner = (void*)(b & (~1));
28646 b_conv.is_owned = false;
28647 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
28651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28652 LDKSignedRawInvoice orig_conv;
28653 orig_conv.inner = (void*)(orig & (~1));
28654 orig_conv.is_owned = false;
28655 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
28656 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28657 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28658 uint64_t ret_ref = (uint64_t)ret_var.inner;
28659 if (ret_var.is_owned) {
28665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28666 LDKRawInvoice this_obj_conv;
28667 this_obj_conv.inner = (void*)(this_obj & (~1));
28668 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28669 RawInvoice_free(this_obj_conv);
28672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
28673 LDKRawInvoice this_ptr_conv;
28674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28675 this_ptr_conv.is_owned = false;
28676 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
28677 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28678 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28679 uint64_t ret_ref = (uint64_t)ret_var.inner;
28680 if (ret_var.is_owned) {
28686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28687 LDKRawInvoice this_ptr_conv;
28688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28689 this_ptr_conv.is_owned = false;
28690 LDKRawDataPart val_conv;
28691 val_conv.inner = (void*)(val & (~1));
28692 val_conv.is_owned = (val & 1) || (val == 0);
28693 val_conv = RawDataPart_clone(&val_conv);
28694 RawInvoice_set_data(&this_ptr_conv, val_conv);
28697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28698 LDKRawInvoice a_conv;
28699 a_conv.inner = (void*)(a & (~1));
28700 a_conv.is_owned = false;
28701 LDKRawInvoice b_conv;
28702 b_conv.inner = (void*)(b & (~1));
28703 b_conv.is_owned = false;
28704 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
28708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28709 LDKRawInvoice orig_conv;
28710 orig_conv.inner = (void*)(orig & (~1));
28711 orig_conv.is_owned = false;
28712 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
28713 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28714 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28715 uint64_t ret_ref = (uint64_t)ret_var.inner;
28716 if (ret_var.is_owned) {
28722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28723 LDKRawDataPart this_obj_conv;
28724 this_obj_conv.inner = (void*)(this_obj & (~1));
28725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28726 RawDataPart_free(this_obj_conv);
28729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
28730 LDKRawDataPart this_ptr_conv;
28731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28732 this_ptr_conv.is_owned = false;
28733 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
28734 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28735 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28736 uint64_t ret_ref = (uint64_t)ret_var.inner;
28737 if (ret_var.is_owned) {
28743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28744 LDKRawDataPart this_ptr_conv;
28745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28746 this_ptr_conv.is_owned = false;
28747 LDKPositiveTimestamp val_conv;
28748 val_conv.inner = (void*)(val & (~1));
28749 val_conv.is_owned = (val & 1) || (val == 0);
28750 val_conv = PositiveTimestamp_clone(&val_conv);
28751 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
28754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28755 LDKRawDataPart a_conv;
28756 a_conv.inner = (void*)(a & (~1));
28757 a_conv.is_owned = false;
28758 LDKRawDataPart b_conv;
28759 b_conv.inner = (void*)(b & (~1));
28760 b_conv.is_owned = false;
28761 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
28765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28766 LDKRawDataPart orig_conv;
28767 orig_conv.inner = (void*)(orig & (~1));
28768 orig_conv.is_owned = false;
28769 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
28770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28772 uint64_t ret_ref = (uint64_t)ret_var.inner;
28773 if (ret_var.is_owned) {
28779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28780 LDKPositiveTimestamp this_obj_conv;
28781 this_obj_conv.inner = (void*)(this_obj & (~1));
28782 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28783 PositiveTimestamp_free(this_obj_conv);
28786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28787 LDKPositiveTimestamp a_conv;
28788 a_conv.inner = (void*)(a & (~1));
28789 a_conv.is_owned = false;
28790 LDKPositiveTimestamp b_conv;
28791 b_conv.inner = (void*)(b & (~1));
28792 b_conv.is_owned = false;
28793 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
28797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28798 LDKPositiveTimestamp orig_conv;
28799 orig_conv.inner = (void*)(orig & (~1));
28800 orig_conv.is_owned = false;
28801 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
28802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28804 uint64_t ret_ref = (uint64_t)ret_var.inner;
28805 if (ret_var.is_owned) {
28811 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28812 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
28813 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
28817 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
28818 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
28822 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
28823 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
28827 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
28828 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
28832 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
28833 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
28837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28838 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
28839 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
28840 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
28844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
28845 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
28846 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
28850 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28851 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
28852 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
28856 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
28857 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
28861 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
28862 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
28866 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
28867 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
28871 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
28872 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
28876 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
28877 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
28881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
28882 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
28883 int64_t ret_val = Currency_hash(o_conv);
28887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28888 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
28889 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
28890 jboolean ret_val = Currency_eq(a_conv, b_conv);
28894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28895 LDKSha256 this_obj_conv;
28896 this_obj_conv.inner = (void*)(this_obj & (~1));
28897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28898 Sha256_free(this_obj_conv);
28901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28902 LDKSha256 orig_conv;
28903 orig_conv.inner = (void*)(orig & (~1));
28904 orig_conv.is_owned = false;
28905 LDKSha256 ret_var = Sha256_clone(&orig_conv);
28906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28908 uint64_t ret_ref = (uint64_t)ret_var.inner;
28909 if (ret_var.is_owned) {
28915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
28917 o_conv.inner = (void*)(o & (~1));
28918 o_conv.is_owned = false;
28919 int64_t ret_val = Sha256_hash(&o_conv);
28923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28925 a_conv.inner = (void*)(a & (~1));
28926 a_conv.is_owned = false;
28928 b_conv.inner = (void*)(b & (~1));
28929 b_conv.is_owned = false;
28930 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
28934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28935 LDKDescription this_obj_conv;
28936 this_obj_conv.inner = (void*)(this_obj & (~1));
28937 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28938 Description_free(this_obj_conv);
28941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28942 LDKDescription orig_conv;
28943 orig_conv.inner = (void*)(orig & (~1));
28944 orig_conv.is_owned = false;
28945 LDKDescription ret_var = Description_clone(&orig_conv);
28946 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28947 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28948 uint64_t ret_ref = (uint64_t)ret_var.inner;
28949 if (ret_var.is_owned) {
28955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
28956 LDKDescription o_conv;
28957 o_conv.inner = (void*)(o & (~1));
28958 o_conv.is_owned = false;
28959 int64_t ret_val = Description_hash(&o_conv);
28963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28964 LDKDescription a_conv;
28965 a_conv.inner = (void*)(a & (~1));
28966 a_conv.is_owned = false;
28967 LDKDescription b_conv;
28968 b_conv.inner = (void*)(b & (~1));
28969 b_conv.is_owned = false;
28970 jboolean ret_val = Description_eq(&a_conv, &b_conv);
28974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28975 LDKPayeePubKey this_obj_conv;
28976 this_obj_conv.inner = (void*)(this_obj & (~1));
28977 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28978 PayeePubKey_free(this_obj_conv);
28981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28982 LDKPayeePubKey orig_conv;
28983 orig_conv.inner = (void*)(orig & (~1));
28984 orig_conv.is_owned = false;
28985 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
28986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28988 uint64_t ret_ref = (uint64_t)ret_var.inner;
28989 if (ret_var.is_owned) {
28995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
28996 LDKPayeePubKey o_conv;
28997 o_conv.inner = (void*)(o & (~1));
28998 o_conv.is_owned = false;
28999 int64_t ret_val = PayeePubKey_hash(&o_conv);
29003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29004 LDKPayeePubKey a_conv;
29005 a_conv.inner = (void*)(a & (~1));
29006 a_conv.is_owned = false;
29007 LDKPayeePubKey b_conv;
29008 b_conv.inner = (void*)(b & (~1));
29009 b_conv.is_owned = false;
29010 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
29014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29015 LDKExpiryTime this_obj_conv;
29016 this_obj_conv.inner = (void*)(this_obj & (~1));
29017 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29018 ExpiryTime_free(this_obj_conv);
29021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29022 LDKExpiryTime orig_conv;
29023 orig_conv.inner = (void*)(orig & (~1));
29024 orig_conv.is_owned = false;
29025 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
29026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29028 uint64_t ret_ref = (uint64_t)ret_var.inner;
29029 if (ret_var.is_owned) {
29035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
29036 LDKExpiryTime o_conv;
29037 o_conv.inner = (void*)(o & (~1));
29038 o_conv.is_owned = false;
29039 int64_t ret_val = ExpiryTime_hash(&o_conv);
29043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29044 LDKExpiryTime a_conv;
29045 a_conv.inner = (void*)(a & (~1));
29046 a_conv.is_owned = false;
29047 LDKExpiryTime b_conv;
29048 b_conv.inner = (void*)(b & (~1));
29049 b_conv.is_owned = false;
29050 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
29054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29055 LDKMinFinalCltvExpiry this_obj_conv;
29056 this_obj_conv.inner = (void*)(this_obj & (~1));
29057 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29058 MinFinalCltvExpiry_free(this_obj_conv);
29061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29062 LDKMinFinalCltvExpiry orig_conv;
29063 orig_conv.inner = (void*)(orig & (~1));
29064 orig_conv.is_owned = false;
29065 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
29066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29068 uint64_t ret_ref = (uint64_t)ret_var.inner;
29069 if (ret_var.is_owned) {
29075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
29076 LDKMinFinalCltvExpiry o_conv;
29077 o_conv.inner = (void*)(o & (~1));
29078 o_conv.is_owned = false;
29079 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
29083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29084 LDKMinFinalCltvExpiry a_conv;
29085 a_conv.inner = (void*)(a & (~1));
29086 a_conv.is_owned = false;
29087 LDKMinFinalCltvExpiry b_conv;
29088 b_conv.inner = (void*)(b & (~1));
29089 b_conv.is_owned = false;
29090 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
29094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29095 if ((this_ptr & 1) != 0) return;
29096 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
29097 FREE((void*)this_ptr);
29098 Fallback_free(this_ptr_conv);
29101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29102 LDKFallback* orig_conv = (LDKFallback*)orig;
29103 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29104 *ret_copy = Fallback_clone(orig_conv);
29105 uint64_t ret_ref = (uint64_t)ret_copy;
29109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
29111 LDKCVec_u8Z program_ref;
29112 program_ref.datalen = (*env)->GetArrayLength(env, program);
29113 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
29114 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
29115 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29116 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
29117 uint64_t ret_ref = (uint64_t)ret_copy;
29121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
29122 LDKTwentyBytes a_ref;
29123 CHECK((*env)->GetArrayLength(env, a) == 20);
29124 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
29125 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29126 *ret_copy = Fallback_pub_key_hash(a_ref);
29127 uint64_t ret_ref = (uint64_t)ret_copy;
29131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
29132 LDKTwentyBytes a_ref;
29133 CHECK((*env)->GetArrayLength(env, a) == 20);
29134 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
29135 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
29136 *ret_copy = Fallback_script_hash(a_ref);
29137 uint64_t ret_ref = (uint64_t)ret_copy;
29141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
29142 LDKFallback* o_conv = (LDKFallback*)o;
29143 int64_t ret_val = Fallback_hash(o_conv);
29147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29148 LDKFallback* a_conv = (LDKFallback*)a;
29149 LDKFallback* b_conv = (LDKFallback*)b;
29150 jboolean ret_val = Fallback_eq(a_conv, b_conv);
29154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29155 LDKInvoiceSignature this_obj_conv;
29156 this_obj_conv.inner = (void*)(this_obj & (~1));
29157 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29158 InvoiceSignature_free(this_obj_conv);
29161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29162 LDKInvoiceSignature orig_conv;
29163 orig_conv.inner = (void*)(orig & (~1));
29164 orig_conv.is_owned = false;
29165 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
29166 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29167 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29168 uint64_t ret_ref = (uint64_t)ret_var.inner;
29169 if (ret_var.is_owned) {
29175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29176 LDKInvoiceSignature a_conv;
29177 a_conv.inner = (void*)(a & (~1));
29178 a_conv.is_owned = false;
29179 LDKInvoiceSignature b_conv;
29180 b_conv.inner = (void*)(b & (~1));
29181 b_conv.is_owned = false;
29182 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
29186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29187 LDKPrivateRoute this_obj_conv;
29188 this_obj_conv.inner = (void*)(this_obj & (~1));
29189 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29190 PrivateRoute_free(this_obj_conv);
29193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29194 LDKPrivateRoute orig_conv;
29195 orig_conv.inner = (void*)(orig & (~1));
29196 orig_conv.is_owned = false;
29197 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
29198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29200 uint64_t ret_ref = (uint64_t)ret_var.inner;
29201 if (ret_var.is_owned) {
29207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
29208 LDKPrivateRoute o_conv;
29209 o_conv.inner = (void*)(o & (~1));
29210 o_conv.is_owned = false;
29211 int64_t ret_val = PrivateRoute_hash(&o_conv);
29215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29216 LDKPrivateRoute a_conv;
29217 a_conv.inner = (void*)(a & (~1));
29218 a_conv.is_owned = false;
29219 LDKPrivateRoute b_conv;
29220 b_conv.inner = (void*)(b & (~1));
29221 b_conv.is_owned = false;
29222 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
29226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
29227 LDKSignedRawInvoice this_arg_conv;
29228 this_arg_conv.inner = (void*)(this_arg & (~1));
29229 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29230 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
29231 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
29232 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
29233 return ((uint64_t)ret_conv);
29236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
29237 LDKSignedRawInvoice this_arg_conv;
29238 this_arg_conv.inner = (void*)(this_arg & (~1));
29239 this_arg_conv.is_owned = false;
29240 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
29241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29243 uint64_t ret_ref = (uint64_t)ret_var.inner;
29244 if (ret_var.is_owned) {
29250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29251 LDKSignedRawInvoice this_arg_conv;
29252 this_arg_conv.inner = (void*)(this_arg & (~1));
29253 this_arg_conv.is_owned = false;
29254 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29255 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
29259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29260 LDKSignedRawInvoice this_arg_conv;
29261 this_arg_conv.inner = (void*)(this_arg & (~1));
29262 this_arg_conv.is_owned = false;
29263 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
29264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29266 uint64_t ret_ref = (uint64_t)ret_var.inner;
29267 if (ret_var.is_owned) {
29273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29274 LDKSignedRawInvoice this_arg_conv;
29275 this_arg_conv.inner = (void*)(this_arg & (~1));
29276 this_arg_conv.is_owned = false;
29277 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
29278 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
29279 return (uint64_t)ret_conv;
29282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29283 LDKSignedRawInvoice this_arg_conv;
29284 this_arg_conv.inner = (void*)(this_arg & (~1));
29285 this_arg_conv.is_owned = false;
29286 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
29290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29291 LDKRawInvoice this_arg_conv;
29292 this_arg_conv.inner = (void*)(this_arg & (~1));
29293 this_arg_conv.is_owned = false;
29294 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29295 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
29299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29300 LDKRawInvoice this_arg_conv;
29301 this_arg_conv.inner = (void*)(this_arg & (~1));
29302 this_arg_conv.is_owned = false;
29303 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
29304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29306 uint64_t ret_ref = (uint64_t)ret_var.inner;
29307 if (ret_var.is_owned) {
29313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
29314 LDKRawInvoice this_arg_conv;
29315 this_arg_conv.inner = (void*)(this_arg & (~1));
29316 this_arg_conv.is_owned = false;
29317 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
29318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29320 uint64_t ret_ref = (uint64_t)ret_var.inner;
29321 if (ret_var.is_owned) {
29327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29328 LDKRawInvoice this_arg_conv;
29329 this_arg_conv.inner = (void*)(this_arg & (~1));
29330 this_arg_conv.is_owned = false;
29331 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
29332 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29333 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29334 uint64_t ret_ref = (uint64_t)ret_var.inner;
29335 if (ret_var.is_owned) {
29341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29342 LDKRawInvoice this_arg_conv;
29343 this_arg_conv.inner = (void*)(this_arg & (~1));
29344 this_arg_conv.is_owned = false;
29345 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
29346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29348 uint64_t ret_ref = (uint64_t)ret_var.inner;
29349 if (ret_var.is_owned) {
29355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29356 LDKRawInvoice this_arg_conv;
29357 this_arg_conv.inner = (void*)(this_arg & (~1));
29358 this_arg_conv.is_owned = false;
29359 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
29360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29362 uint64_t ret_ref = (uint64_t)ret_var.inner;
29363 if (ret_var.is_owned) {
29369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
29370 LDKRawInvoice this_arg_conv;
29371 this_arg_conv.inner = (void*)(this_arg & (~1));
29372 this_arg_conv.is_owned = false;
29373 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
29374 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29375 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29376 uint64_t ret_ref = (uint64_t)ret_var.inner;
29377 if (ret_var.is_owned) {
29383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29384 LDKRawInvoice this_arg_conv;
29385 this_arg_conv.inner = (void*)(this_arg & (~1));
29386 this_arg_conv.is_owned = false;
29387 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29388 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
29392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
29393 LDKRawInvoice this_arg_conv;
29394 this_arg_conv.inner = (void*)(this_arg & (~1));
29395 this_arg_conv.is_owned = false;
29396 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
29397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29399 uint64_t ret_ref = (uint64_t)ret_var.inner;
29400 if (ret_var.is_owned) {
29406 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
29407 LDKRawInvoice this_arg_conv;
29408 this_arg_conv.inner = (void*)(this_arg & (~1));
29409 this_arg_conv.is_owned = false;
29410 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
29411 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29412 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29413 for (size_t o = 0; o < ret_var.datalen; o++) {
29414 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29415 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29416 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29417 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29418 if (ret_conv_14_var.is_owned) {
29419 ret_conv_14_ref |= 1;
29421 ret_arr_ptr[o] = ret_conv_14_ref;
29423 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29424 FREE(ret_var.data);
29428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
29429 LDKRawInvoice this_arg_conv;
29430 this_arg_conv.inner = (void*)(this_arg & (~1));
29431 this_arg_conv.is_owned = false;
29432 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29433 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
29434 uint64_t ret_ref = (uint64_t)ret_copy;
29438 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
29439 LDKRawInvoice this_arg_conv;
29440 this_arg_conv.inner = (void*)(this_arg & (~1));
29441 this_arg_conv.is_owned = false;
29442 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
29446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
29447 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29448 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
29449 return (uint64_t)ret_conv;
29452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
29453 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29454 *ret_conv = PositiveTimestamp_from_system_time(time);
29455 return (uint64_t)ret_conv;
29458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
29459 LDKPositiveTimestamp this_arg_conv;
29460 this_arg_conv.inner = (void*)(this_arg & (~1));
29461 this_arg_conv.is_owned = false;
29462 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
29466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29467 LDKPositiveTimestamp this_arg_conv;
29468 this_arg_conv.inner = (void*)(this_arg & (~1));
29469 this_arg_conv.is_owned = false;
29470 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
29474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
29475 LDKInvoice this_arg_conv;
29476 this_arg_conv.inner = (void*)(this_arg & (~1));
29477 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29478 this_arg_conv = Invoice_clone(&this_arg_conv);
29479 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
29480 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29481 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29482 uint64_t ret_ref = (uint64_t)ret_var.inner;
29483 if (ret_var.is_owned) {
29489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29490 LDKInvoice this_arg_conv;
29491 this_arg_conv.inner = (void*)(this_arg & (~1));
29492 this_arg_conv.is_owned = false;
29493 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
29494 *ret_conv = Invoice_check_signature(&this_arg_conv);
29495 return (uint64_t)ret_conv;
29498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
29499 LDKSignedRawInvoice signed_invoice_conv;
29500 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
29501 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
29502 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
29503 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
29504 *ret_conv = Invoice_from_signed(signed_invoice_conv);
29505 return (uint64_t)ret_conv;
29508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
29509 LDKInvoice this_arg_conv;
29510 this_arg_conv.inner = (void*)(this_arg & (~1));
29511 this_arg_conv.is_owned = false;
29512 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
29516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29517 LDKInvoice this_arg_conv;
29518 this_arg_conv.inner = (void*)(this_arg & (~1));
29519 this_arg_conv.is_owned = false;
29520 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29521 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
29525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29526 LDKInvoice this_arg_conv;
29527 this_arg_conv.inner = (void*)(this_arg & (~1));
29528 this_arg_conv.is_owned = false;
29529 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29530 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
29534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29535 LDKInvoice this_arg_conv;
29536 this_arg_conv.inner = (void*)(this_arg & (~1));
29537 this_arg_conv.is_owned = false;
29538 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29539 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
29543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
29544 LDKInvoice this_arg_conv;
29545 this_arg_conv.inner = (void*)(this_arg & (~1));
29546 this_arg_conv.is_owned = false;
29547 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
29548 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29549 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29550 uint64_t ret_ref = (uint64_t)ret_var.inner;
29551 if (ret_var.is_owned) {
29557 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29558 LDKInvoice this_arg_conv;
29559 this_arg_conv.inner = (void*)(this_arg & (~1));
29560 this_arg_conv.is_owned = false;
29561 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29562 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
29566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29567 LDKInvoice this_arg_conv;
29568 this_arg_conv.inner = (void*)(this_arg & (~1));
29569 this_arg_conv.is_owned = false;
29570 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
29574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
29575 LDKInvoice this_arg_conv;
29576 this_arg_conv.inner = (void*)(this_arg & (~1));
29577 this_arg_conv.is_owned = false;
29578 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
29582 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
29583 LDKInvoice this_arg_conv;
29584 this_arg_conv.inner = (void*)(this_arg & (~1));
29585 this_arg_conv.is_owned = false;
29586 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
29587 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29588 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29589 for (size_t o = 0; o < ret_var.datalen; o++) {
29590 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29591 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29592 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29593 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29594 if (ret_conv_14_var.is_owned) {
29595 ret_conv_14_ref |= 1;
29597 ret_arr_ptr[o] = ret_conv_14_ref;
29599 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29600 FREE(ret_var.data);
29604 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
29605 LDKInvoice this_arg_conv;
29606 this_arg_conv.inner = (void*)(this_arg & (~1));
29607 this_arg_conv.is_owned = false;
29608 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
29609 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29610 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29611 for (size_t l = 0; l < ret_var.datalen; l++) {
29612 LDKRouteHint ret_conv_11_var = ret_var.data[l];
29613 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29614 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29615 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
29616 if (ret_conv_11_var.is_owned) {
29617 ret_conv_11_ref |= 1;
29619 ret_arr_ptr[l] = ret_conv_11_ref;
29621 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29622 FREE(ret_var.data);
29626 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
29627 LDKInvoice this_arg_conv;
29628 this_arg_conv.inner = (void*)(this_arg & (~1));
29629 this_arg_conv.is_owned = false;
29630 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
29634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
29635 LDKInvoice this_arg_conv;
29636 this_arg_conv.inner = (void*)(this_arg & (~1));
29637 this_arg_conv.is_owned = false;
29638 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29639 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
29640 uint64_t ret_ref = (uint64_t)ret_copy;
29644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
29645 LDKStr description_conv = java_to_owned_str(env, description);
29646 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
29647 *ret_conv = Description_new(description_conv);
29648 return (uint64_t)ret_conv;
29651 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
29652 LDKDescription this_arg_conv;
29653 this_arg_conv.inner = (void*)(this_arg & (~1));
29654 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29655 this_arg_conv = Description_clone(&this_arg_conv);
29656 LDKStr ret_str = Description_into_inner(this_arg_conv);
29657 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
29663 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29664 *ret_conv = ExpiryTime_from_seconds(seconds);
29665 return (uint64_t)ret_conv;
29668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
29669 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29670 *ret_conv = ExpiryTime_from_duration(duration);
29671 return (uint64_t)ret_conv;
29674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
29675 LDKExpiryTime this_arg_conv;
29676 this_arg_conv.inner = (void*)(this_arg & (~1));
29677 this_arg_conv.is_owned = false;
29678 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
29682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
29683 LDKExpiryTime this_arg_conv;
29684 this_arg_conv.inner = (void*)(this_arg & (~1));
29685 this_arg_conv.is_owned = false;
29686 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
29690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
29691 LDKRouteHint hops_conv;
29692 hops_conv.inner = (void*)(hops & (~1));
29693 hops_conv.is_owned = (hops & 1) || (hops == 0);
29694 hops_conv = RouteHint_clone(&hops_conv);
29695 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
29696 *ret_conv = PrivateRoute_new(hops_conv);
29697 return (uint64_t)ret_conv;
29700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
29701 LDKPrivateRoute this_arg_conv;
29702 this_arg_conv.inner = (void*)(this_arg & (~1));
29703 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29704 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
29705 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
29706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29708 uint64_t ret_ref = (uint64_t)ret_var.inner;
29709 if (ret_var.is_owned) {
29715 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29716 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
29717 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
29721 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
29722 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
29726 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
29727 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
29731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
29732 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
29736 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
29737 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
29741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29742 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
29743 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
29744 jboolean ret_val = CreationError_eq(a_conv, b_conv);
29748 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29749 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
29750 LDKStr ret_str = CreationError_to_str(o_conv);
29751 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29756 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29757 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
29758 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
29762 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
29763 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
29767 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
29768 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
29772 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
29773 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
29777 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
29778 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
29782 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
29783 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
29787 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
29788 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
29792 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
29793 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
29797 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
29798 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
29802 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
29803 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
29807 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
29808 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
29812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29813 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
29814 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
29815 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
29819 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29820 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
29821 LDKStr ret_str = SemanticError_to_str(o_conv);
29822 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29828 if ((this_ptr & 1) != 0) return;
29829 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
29830 FREE((void*)this_ptr);
29831 SignOrCreationError_free(this_ptr_conv);
29834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29835 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
29836 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29837 *ret_copy = SignOrCreationError_clone(orig_conv);
29838 uint64_t ret_ref = (uint64_t)ret_copy;
29842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
29843 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29844 *ret_copy = SignOrCreationError_sign_error();
29845 uint64_t ret_ref = (uint64_t)ret_copy;
29849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
29850 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
29851 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29852 *ret_copy = SignOrCreationError_creation_error(a_conv);
29853 uint64_t ret_ref = (uint64_t)ret_copy;
29857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29858 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
29859 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
29860 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
29864 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29865 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
29866 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
29867 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29872 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) {
29873 LDKChannelManager channelmanager_conv;
29874 channelmanager_conv.inner = (void*)(channelmanager & (~1));
29875 channelmanager_conv.is_owned = false;
29876 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
29877 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29878 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29879 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29881 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
29882 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
29883 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
29884 LDKStr description_conv = java_to_owned_str(env, description);
29885 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
29886 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
29887 return (uint64_t)ret_conv;
29890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29891 LDKStr s_conv = java_to_owned_str(env, s);
29892 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
29893 *ret_conv = SiPrefix_from_str(s_conv);
29894 return (uint64_t)ret_conv;
29897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29898 LDKStr s_conv = java_to_owned_str(env, s);
29899 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
29900 *ret_conv = Invoice_from_str(s_conv);
29901 return (uint64_t)ret_conv;
29904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29905 LDKStr s_conv = java_to_owned_str(env, s);
29906 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
29907 *ret_conv = SignedRawInvoice_from_str(s_conv);
29908 return (uint64_t)ret_conv;
29911 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29913 o_conv.inner = (void*)(o & (~1));
29914 o_conv.is_owned = false;
29915 LDKStr ret_str = Invoice_to_str(&o_conv);
29916 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29921 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29922 LDKSignedRawInvoice o_conv;
29923 o_conv.inner = (void*)(o & (~1));
29924 o_conv.is_owned = false;
29925 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
29926 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29931 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29932 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
29933 LDKStr ret_str = Currency_to_str(o_conv);
29934 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29939 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29940 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
29941 LDKStr ret_str = SiPrefix_to_str(o_conv);
29942 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);