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_1lib_1version_1string(JNIEnv *env, jclass _c) {
134 return str_ref_to_java(env, "v0.0.101.0", strlen("v0.0.101.0"));
136 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
137 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
139 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
140 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
142 static jclass arr_of_B_clz = NULL;
143 static jclass arr_of_J_clz = NULL;
144 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
145 arr_of_B_clz = (*env)->FindClass(env, "[B");
146 CHECK(arr_of_B_clz != NULL);
147 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
148 arr_of_J_clz = (*env)->FindClass(env, "[J");
149 CHECK(arr_of_J_clz != NULL);
150 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
152 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
153 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
154 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
155 case 0: return LDKAccessError_UnknownChain;
156 case 1: return LDKAccessError_UnknownTx;
160 static jclass AccessError_class = NULL;
161 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
162 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
163 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
164 AccessError_class = (*env)->NewGlobalRef(env, clz);
165 CHECK(AccessError_class != NULL);
166 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
167 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
168 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
169 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
171 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
173 case LDKAccessError_UnknownChain:
174 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
175 case LDKAccessError_UnknownTx:
176 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
181 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
182 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
183 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
184 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
188 static jclass ChannelMonitorUpdateErr_class = NULL;
189 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
190 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
191 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
192 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
193 CHECK(ChannelMonitorUpdateErr_class != NULL);
194 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
195 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
196 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
197 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
199 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
201 case LDKChannelMonitorUpdateErr_TemporaryFailure:
202 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
203 case LDKChannelMonitorUpdateErr_PermanentFailure:
204 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
209 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
210 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
211 case 0: return LDKConfirmationTarget_Background;
212 case 1: return LDKConfirmationTarget_Normal;
213 case 2: return LDKConfirmationTarget_HighPriority;
217 static jclass ConfirmationTarget_class = NULL;
218 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
219 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
220 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
221 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
222 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
223 CHECK(ConfirmationTarget_class != NULL);
224 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
225 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
226 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
227 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
228 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
229 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
231 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
233 case LDKConfirmationTarget_Background:
234 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
235 case LDKConfirmationTarget_Normal:
236 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
237 case LDKConfirmationTarget_HighPriority:
238 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
243 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
244 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
245 case 0: return LDKCreationError_DescriptionTooLong;
246 case 1: return LDKCreationError_RouteTooLong;
247 case 2: return LDKCreationError_TimestampOutOfBounds;
248 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
252 static jclass CreationError_class = NULL;
253 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
254 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
255 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
256 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
257 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
258 CreationError_class = (*env)->NewGlobalRef(env, clz);
259 CHECK(CreationError_class != NULL);
260 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
261 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
262 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
263 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
264 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
265 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
266 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
267 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
269 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
271 case LDKCreationError_DescriptionTooLong:
272 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
273 case LDKCreationError_RouteTooLong:
274 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
275 case LDKCreationError_TimestampOutOfBounds:
276 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
277 case LDKCreationError_ExpiryTimeOutOfBounds:
278 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
283 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
284 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
285 case 0: return LDKCurrency_Bitcoin;
286 case 1: return LDKCurrency_BitcoinTestnet;
287 case 2: return LDKCurrency_Regtest;
288 case 3: return LDKCurrency_Simnet;
289 case 4: return LDKCurrency_Signet;
293 static jclass Currency_class = NULL;
294 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
295 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
296 static jfieldID Currency_LDKCurrency_Regtest = NULL;
297 static jfieldID Currency_LDKCurrency_Simnet = NULL;
298 static jfieldID Currency_LDKCurrency_Signet = NULL;
299 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
300 Currency_class = (*env)->NewGlobalRef(env, clz);
301 CHECK(Currency_class != NULL);
302 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
303 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
304 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
305 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
306 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
307 CHECK(Currency_LDKCurrency_Regtest != NULL);
308 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
309 CHECK(Currency_LDKCurrency_Simnet != NULL);
310 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
311 CHECK(Currency_LDKCurrency_Signet != NULL);
313 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
315 case LDKCurrency_Bitcoin:
316 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
317 case LDKCurrency_BitcoinTestnet:
318 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
319 case LDKCurrency_Regtest:
320 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
321 case LDKCurrency_Simnet:
322 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
323 case LDKCurrency_Signet:
324 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
329 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
330 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
331 case 0: return LDKIOError_NotFound;
332 case 1: return LDKIOError_PermissionDenied;
333 case 2: return LDKIOError_ConnectionRefused;
334 case 3: return LDKIOError_ConnectionReset;
335 case 4: return LDKIOError_ConnectionAborted;
336 case 5: return LDKIOError_NotConnected;
337 case 6: return LDKIOError_AddrInUse;
338 case 7: return LDKIOError_AddrNotAvailable;
339 case 8: return LDKIOError_BrokenPipe;
340 case 9: return LDKIOError_AlreadyExists;
341 case 10: return LDKIOError_WouldBlock;
342 case 11: return LDKIOError_InvalidInput;
343 case 12: return LDKIOError_InvalidData;
344 case 13: return LDKIOError_TimedOut;
345 case 14: return LDKIOError_WriteZero;
346 case 15: return LDKIOError_Interrupted;
347 case 16: return LDKIOError_Other;
348 case 17: return LDKIOError_UnexpectedEof;
352 static jclass IOError_class = NULL;
353 static jfieldID IOError_LDKIOError_NotFound = NULL;
354 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
355 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
356 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
357 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
358 static jfieldID IOError_LDKIOError_NotConnected = NULL;
359 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
360 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
361 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
362 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
363 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
364 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
365 static jfieldID IOError_LDKIOError_InvalidData = NULL;
366 static jfieldID IOError_LDKIOError_TimedOut = NULL;
367 static jfieldID IOError_LDKIOError_WriteZero = NULL;
368 static jfieldID IOError_LDKIOError_Interrupted = NULL;
369 static jfieldID IOError_LDKIOError_Other = NULL;
370 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
371 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
372 IOError_class = (*env)->NewGlobalRef(env, clz);
373 CHECK(IOError_class != NULL);
374 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
375 CHECK(IOError_LDKIOError_NotFound != NULL);
376 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
377 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
378 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
379 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
380 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
381 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
382 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
383 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
384 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
385 CHECK(IOError_LDKIOError_NotConnected != NULL);
386 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
387 CHECK(IOError_LDKIOError_AddrInUse != NULL);
388 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
389 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
390 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
391 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
392 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
393 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
394 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
395 CHECK(IOError_LDKIOError_WouldBlock != NULL);
396 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
397 CHECK(IOError_LDKIOError_InvalidInput != NULL);
398 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
399 CHECK(IOError_LDKIOError_InvalidData != NULL);
400 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
401 CHECK(IOError_LDKIOError_TimedOut != NULL);
402 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
403 CHECK(IOError_LDKIOError_WriteZero != NULL);
404 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
405 CHECK(IOError_LDKIOError_Interrupted != NULL);
406 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
407 CHECK(IOError_LDKIOError_Other != NULL);
408 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
409 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
411 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
413 case LDKIOError_NotFound:
414 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
415 case LDKIOError_PermissionDenied:
416 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
417 case LDKIOError_ConnectionRefused:
418 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
419 case LDKIOError_ConnectionReset:
420 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
421 case LDKIOError_ConnectionAborted:
422 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
423 case LDKIOError_NotConnected:
424 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
425 case LDKIOError_AddrInUse:
426 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
427 case LDKIOError_AddrNotAvailable:
428 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
429 case LDKIOError_BrokenPipe:
430 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
431 case LDKIOError_AlreadyExists:
432 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
433 case LDKIOError_WouldBlock:
434 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
435 case LDKIOError_InvalidInput:
436 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
437 case LDKIOError_InvalidData:
438 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
439 case LDKIOError_TimedOut:
440 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
441 case LDKIOError_WriteZero:
442 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
443 case LDKIOError_Interrupted:
444 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
445 case LDKIOError_Other:
446 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
447 case LDKIOError_UnexpectedEof:
448 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
453 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
454 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
455 case 0: return LDKLevel_Trace;
456 case 1: return LDKLevel_Debug;
457 case 2: return LDKLevel_Info;
458 case 3: return LDKLevel_Warn;
459 case 4: return LDKLevel_Error;
463 static jclass Level_class = NULL;
464 static jfieldID Level_LDKLevel_Trace = NULL;
465 static jfieldID Level_LDKLevel_Debug = NULL;
466 static jfieldID Level_LDKLevel_Info = NULL;
467 static jfieldID Level_LDKLevel_Warn = NULL;
468 static jfieldID Level_LDKLevel_Error = NULL;
469 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
470 Level_class = (*env)->NewGlobalRef(env, clz);
471 CHECK(Level_class != NULL);
472 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
473 CHECK(Level_LDKLevel_Trace != NULL);
474 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
475 CHECK(Level_LDKLevel_Debug != NULL);
476 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Info != NULL);
478 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Warn != NULL);
480 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
481 CHECK(Level_LDKLevel_Error != NULL);
483 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
486 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
488 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
490 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
494 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
499 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
500 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
501 case 0: return LDKNetwork_Bitcoin;
502 case 1: return LDKNetwork_Testnet;
503 case 2: return LDKNetwork_Regtest;
504 case 3: return LDKNetwork_Signet;
508 static jclass Network_class = NULL;
509 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
510 static jfieldID Network_LDKNetwork_Testnet = NULL;
511 static jfieldID Network_LDKNetwork_Regtest = NULL;
512 static jfieldID Network_LDKNetwork_Signet = NULL;
513 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
514 Network_class = (*env)->NewGlobalRef(env, clz);
515 CHECK(Network_class != NULL);
516 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
517 CHECK(Network_LDKNetwork_Bitcoin != NULL);
518 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
519 CHECK(Network_LDKNetwork_Testnet != NULL);
520 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
521 CHECK(Network_LDKNetwork_Regtest != NULL);
522 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
523 CHECK(Network_LDKNetwork_Signet != NULL);
525 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
527 case LDKNetwork_Bitcoin:
528 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
529 case LDKNetwork_Testnet:
530 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
531 case LDKNetwork_Regtest:
532 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
533 case LDKNetwork_Signet:
534 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
539 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
540 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
541 case 0: return LDKSecp256k1Error_IncorrectSignature;
542 case 1: return LDKSecp256k1Error_InvalidMessage;
543 case 2: return LDKSecp256k1Error_InvalidPublicKey;
544 case 3: return LDKSecp256k1Error_InvalidSignature;
545 case 4: return LDKSecp256k1Error_InvalidSecretKey;
546 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
547 case 6: return LDKSecp256k1Error_InvalidTweak;
548 case 7: return LDKSecp256k1Error_TweakCheckFailed;
549 case 8: return LDKSecp256k1Error_NotEnoughMemory;
553 static jclass Secp256k1Error_class = NULL;
554 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
555 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
556 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
563 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
564 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
565 CHECK(Secp256k1Error_class != NULL);
566 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
567 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
568 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
569 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
570 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
571 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
572 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
573 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
574 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
578 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
580 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
582 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
583 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
585 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
587 case LDKSecp256k1Error_IncorrectSignature:
588 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
589 case LDKSecp256k1Error_InvalidMessage:
590 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
591 case LDKSecp256k1Error_InvalidPublicKey:
592 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
593 case LDKSecp256k1Error_InvalidSignature:
594 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
595 case LDKSecp256k1Error_InvalidSecretKey:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
597 case LDKSecp256k1Error_InvalidRecoveryId:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
599 case LDKSecp256k1Error_InvalidTweak:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
601 case LDKSecp256k1Error_TweakCheckFailed:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
603 case LDKSecp256k1Error_NotEnoughMemory:
604 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
609 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
610 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
611 case 0: return LDKSemanticError_NoPaymentHash;
612 case 1: return LDKSemanticError_MultiplePaymentHashes;
613 case 2: return LDKSemanticError_NoDescription;
614 case 3: return LDKSemanticError_MultipleDescriptions;
615 case 4: return LDKSemanticError_NoPaymentSecret;
616 case 5: return LDKSemanticError_MultiplePaymentSecrets;
617 case 6: return LDKSemanticError_InvalidFeatures;
618 case 7: return LDKSemanticError_InvalidRecoveryId;
619 case 8: return LDKSemanticError_InvalidSignature;
620 case 9: return LDKSemanticError_ImpreciseAmount;
624 static jclass SemanticError_class = NULL;
625 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
626 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
627 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
628 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
629 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
630 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
631 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
632 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
633 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
634 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
635 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
636 SemanticError_class = (*env)->NewGlobalRef(env, clz);
637 CHECK(SemanticError_class != NULL);
638 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
639 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
640 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
642 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
644 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
646 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
648 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
650 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
652 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
653 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
654 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
655 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
656 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
657 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
659 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
661 case LDKSemanticError_NoPaymentHash:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
663 case LDKSemanticError_MultiplePaymentHashes:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
665 case LDKSemanticError_NoDescription:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
667 case LDKSemanticError_MultipleDescriptions:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
669 case LDKSemanticError_NoPaymentSecret:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
671 case LDKSemanticError_MultiplePaymentSecrets:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
673 case LDKSemanticError_InvalidFeatures:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
675 case LDKSemanticError_InvalidRecoveryId:
676 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
677 case LDKSemanticError_InvalidSignature:
678 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
679 case LDKSemanticError_ImpreciseAmount:
680 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
685 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
686 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
687 case 0: return LDKSiPrefix_Milli;
688 case 1: return LDKSiPrefix_Micro;
689 case 2: return LDKSiPrefix_Nano;
690 case 3: return LDKSiPrefix_Pico;
694 static jclass SiPrefix_class = NULL;
695 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
696 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
697 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
698 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
699 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
700 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
701 CHECK(SiPrefix_class != NULL);
702 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
703 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
704 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
705 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
706 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
707 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
708 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
709 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
711 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
713 case LDKSiPrefix_Milli:
714 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
715 case LDKSiPrefix_Micro:
716 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
717 case LDKSiPrefix_Nano:
718 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
719 case LDKSiPrefix_Pico:
720 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
726 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
727 ret->datalen = (*env)->GetArrayLength(env, elems);
728 if (ret->datalen == 0) {
731 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
732 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
733 for (size_t i = 0; i < ret->datalen; i++) {
734 ret->data[i] = java_elems[i];
736 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
738 return (uint64_t)ret;
740 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
741 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
742 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
745 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) {
746 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
747 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
748 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
749 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
750 CVec_u8Z_free(ret_var);
754 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) {
755 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
756 int64_t ret_val = TxOut_get_value(thing_conv);
760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
761 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
764 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
765 CHECK(val->result_ok);
766 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
767 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
771 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
772 CHECK(!val->result_ok);
773 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
777 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
780 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
781 CHECK(val->result_ok);
782 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
783 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
786 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
787 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
788 CHECK(!val->result_ok);
789 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
793 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
796 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
797 CHECK(val->result_ok);
798 LDKTxCreationKeys res_var = (*val->contents.result);
799 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
800 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
801 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
805 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
806 CHECK(!val->result_ok);
807 LDKDecodeError err_var = (*val->contents.err);
808 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
809 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
810 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
814 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
817 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
818 CHECK(val->result_ok);
819 LDKChannelPublicKeys res_var = (*val->contents.result);
820 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
821 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
822 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
826 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
827 CHECK(!val->result_ok);
828 LDKDecodeError err_var = (*val->contents.err);
829 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
830 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
831 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
835 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
838 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
839 CHECK(val->result_ok);
840 LDKTxCreationKeys res_var = (*val->contents.result);
841 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
842 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
843 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
846 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
847 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
848 CHECK(!val->result_ok);
849 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
852 static jclass LDKCOption_u32Z_Some_class = NULL;
853 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
854 static jclass LDKCOption_u32Z_None_class = NULL;
855 static jmethodID LDKCOption_u32Z_None_meth = NULL;
856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
857 LDKCOption_u32Z_Some_class =
858 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
859 CHECK(LDKCOption_u32Z_Some_class != NULL);
860 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
861 CHECK(LDKCOption_u32Z_Some_meth != NULL);
862 LDKCOption_u32Z_None_class =
863 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
864 CHECK(LDKCOption_u32Z_None_class != NULL);
865 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
866 CHECK(LDKCOption_u32Z_None_meth != NULL);
868 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
869 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
871 case LDKCOption_u32Z_Some: {
872 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
874 case LDKCOption_u32Z_None: {
875 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
881 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
884 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
885 CHECK(val->result_ok);
886 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
887 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
888 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
889 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
893 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
894 CHECK(!val->result_ok);
895 LDKDecodeError err_var = (*val->contents.err);
896 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
897 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
898 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
902 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
905 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
906 CHECK(val->result_ok);
907 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
908 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
909 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
910 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
914 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
915 CHECK(!val->result_ok);
916 LDKDecodeError err_var = (*val->contents.err);
917 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
918 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
919 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
923 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
926 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
927 CHECK(val->result_ok);
928 LDKChannelTransactionParameters res_var = (*val->contents.result);
929 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
930 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
931 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
935 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
936 CHECK(!val->result_ok);
937 LDKDecodeError err_var = (*val->contents.err);
938 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
944 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
947 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
948 CHECK(val->result_ok);
949 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
950 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
951 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
952 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
956 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
957 CHECK(!val->result_ok);
958 LDKDecodeError err_var = (*val->contents.err);
959 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
960 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
961 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
965 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
968 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
969 CHECK(val->result_ok);
970 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
971 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
972 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
973 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
977 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
978 CHECK(!val->result_ok);
979 LDKDecodeError err_var = (*val->contents.err);
980 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
981 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
986 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
989 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
990 CHECK(val->result_ok);
991 LDKTrustedClosingTransaction res_var = (*val->contents.result);
992 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
993 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
994 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
998 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
999 CHECK(!val->result_ok);
1000 return *val->contents.err;
1002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1003 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1006 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1007 CHECK(val->result_ok);
1008 LDKCommitmentTransaction res_var = (*val->contents.result);
1009 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1010 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1011 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1015 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1016 CHECK(!val->result_ok);
1017 LDKDecodeError err_var = (*val->contents.err);
1018 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1019 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1020 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1024 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
1026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1027 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1028 CHECK(val->result_ok);
1029 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1030 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1031 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1032 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1036 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1037 CHECK(!val->result_ok);
1038 return *val->contents.err;
1040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1041 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1043 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1044 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1045 CHECK(val->result_ok);
1046 LDKCVec_SignatureZ res_var = (*val->contents.result);
1047 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1049 for (size_t i = 0; i < res_var.datalen; i++) {
1050 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1051 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1052 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1057 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1058 CHECK(!val->result_ok);
1059 return *val->contents.err;
1061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1062 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1065 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1066 CHECK(val->result_ok);
1067 LDKShutdownScript res_var = (*val->contents.result);
1068 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1069 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1070 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1074 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1075 CHECK(!val->result_ok);
1076 LDKDecodeError err_var = (*val->contents.err);
1077 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1078 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1079 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1083 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1086 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1087 CHECK(val->result_ok);
1088 LDKShutdownScript res_var = (*val->contents.result);
1089 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1090 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1091 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1095 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1096 CHECK(!val->result_ok);
1097 LDKInvalidShutdownScript err_var = (*val->contents.err);
1098 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1099 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1100 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1104 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1107 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1108 CHECK(val->result_ok);
1109 return *val->contents.result;
1111 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1112 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1113 CHECK(!val->result_ok);
1114 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1118 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1121 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1122 CHECK(val->result_ok);
1123 LDKRouteHop res_var = (*val->contents.result);
1124 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1125 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1126 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1130 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1131 CHECK(!val->result_ok);
1132 LDKDecodeError err_var = (*val->contents.err);
1133 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1134 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1135 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1139 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1140 ret->datalen = (*env)->GetArrayLength(env, elems);
1141 if (ret->datalen == 0) {
1144 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1145 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1146 for (size_t i = 0; i < ret->datalen; i++) {
1147 int64_t arr_elem = java_elems[i];
1148 LDKRouteHop arr_elem_conv;
1149 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1150 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1151 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1152 ret->data[i] = arr_elem_conv;
1154 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1156 return (uint64_t)ret;
1158 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1159 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1160 for (size_t i = 0; i < ret.datalen; i++) {
1161 ret.data[i] = RouteHop_clone(&orig->data[i]);
1165 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1166 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1167 for (size_t i = 0; i < ret.datalen; i++) {
1168 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1173 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1176 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1177 CHECK(val->result_ok);
1178 LDKRoute res_var = (*val->contents.result);
1179 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1180 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1181 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1185 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1186 CHECK(!val->result_ok);
1187 LDKDecodeError err_var = (*val->contents.err);
1188 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1189 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1190 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1193 static jclass LDKCOption_u64Z_Some_class = NULL;
1194 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1195 static jclass LDKCOption_u64Z_None_class = NULL;
1196 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1198 LDKCOption_u64Z_Some_class =
1199 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1200 CHECK(LDKCOption_u64Z_Some_class != NULL);
1201 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1202 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1203 LDKCOption_u64Z_None_class =
1204 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1205 CHECK(LDKCOption_u64Z_None_class != NULL);
1206 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1207 CHECK(LDKCOption_u64Z_None_meth != NULL);
1209 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1210 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1212 case LDKCOption_u64Z_Some: {
1213 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1215 case LDKCOption_u64Z_None: {
1216 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1222 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1223 ret->datalen = (*env)->GetArrayLength(env, elems);
1224 if (ret->datalen == 0) {
1227 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1228 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1229 for (size_t i = 0; i < ret->datalen; i++) {
1230 int64_t arr_elem = java_elems[i];
1231 LDKChannelDetails arr_elem_conv;
1232 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1233 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1234 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1235 ret->data[i] = arr_elem_conv;
1237 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1239 return (uint64_t)ret;
1241 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1242 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1243 for (size_t i = 0; i < ret.datalen; i++) {
1244 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1249 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1250 ret->datalen = (*env)->GetArrayLength(env, elems);
1251 if (ret->datalen == 0) {
1254 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1255 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1256 for (size_t i = 0; i < ret->datalen; i++) {
1257 int64_t arr_elem = java_elems[i];
1258 LDKRouteHint arr_elem_conv;
1259 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1260 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1261 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1262 ret->data[i] = arr_elem_conv;
1264 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1266 return (uint64_t)ret;
1268 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1269 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1270 for (size_t i = 0; i < ret.datalen; i++) {
1271 ret.data[i] = RouteHint_clone(&orig->data[i]);
1275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1276 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1279 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1280 CHECK(val->result_ok);
1281 LDKRoute res_var = (*val->contents.result);
1282 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1283 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1284 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1288 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1289 CHECK(!val->result_ok);
1290 LDKLightningError err_var = (*val->contents.err);
1291 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1292 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1293 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1297 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1300 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1301 CHECK(val->result_ok);
1302 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1303 return (uint64_t)res_ref;
1305 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1306 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1307 CHECK(!val->result_ok);
1308 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1312 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1314 LDKTransaction b_ref;
1315 b_ref.datalen = (*env)->GetArrayLength(env, b);
1316 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1317 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1318 b_ref.data_is_owned = false;
1320 return (uint64_t)ret;
1322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1323 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1327 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1328 LDKTransaction b_var = tuple->b;
1329 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1330 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1334 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1335 ret->datalen = (*env)->GetArrayLength(env, elems);
1336 if (ret->datalen == 0) {
1339 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1340 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1341 for (size_t i = 0; i < ret->datalen; i++) {
1342 int64_t arr_elem = java_elems[i];
1343 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1344 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1345 ret->data[i] = arr_elem_conv;
1347 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1349 return (uint64_t)ret;
1351 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1352 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1353 for (size_t i = 0; i < ret.datalen; i++) {
1354 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1358 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1359 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1360 for (size_t i = 0; i < ret.datalen; i++) {
1361 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1366 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1369 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1370 CHECK(val->result_ok);
1371 return *val->contents.result;
1373 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1374 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1375 CHECK(!val->result_ok);
1376 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1379 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1380 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1381 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1382 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1384 LDKMonitorEvent_HTLCEvent_class =
1385 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1386 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1387 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1388 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1389 LDKMonitorEvent_CommitmentTxConfirmed_class =
1390 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
1391 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1392 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1393 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1395 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1396 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1398 case LDKMonitorEvent_HTLCEvent: {
1399 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1400 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1401 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1402 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1403 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1405 case LDKMonitorEvent_CommitmentTxConfirmed: {
1406 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1407 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1408 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1409 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1410 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1416 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1417 ret->datalen = (*env)->GetArrayLength(env, elems);
1418 if (ret->datalen == 0) {
1421 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1422 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1423 for (size_t i = 0; i < ret->datalen; i++) {
1424 int64_t arr_elem = java_elems[i];
1425 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1426 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1427 ret->data[i] = arr_elem_conv;
1429 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1431 return (uint64_t)ret;
1433 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1434 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1435 for (size_t i = 0; i < ret.datalen; i++) {
1436 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1440 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1441 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1442 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1443 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1445 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1446 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1447 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1448 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1449 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1450 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1451 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1452 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1453 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1454 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1456 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1457 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1459 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1460 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1461 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1463 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1464 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1469 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
1470 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
1471 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
1472 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
1473 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
1474 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
1475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
1476 LDKNetworkUpdate_ChannelUpdateMessage_class =
1477 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
1478 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
1479 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1480 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
1481 LDKNetworkUpdate_ChannelClosed_class =
1482 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
1483 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
1484 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1485 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
1486 LDKNetworkUpdate_NodeFailure_class =
1487 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
1488 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
1489 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
1490 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
1492 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1493 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1495 case LDKNetworkUpdate_ChannelUpdateMessage: {
1496 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1497 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1498 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1499 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1500 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
1502 case LDKNetworkUpdate_ChannelClosed: {
1503 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1505 case LDKNetworkUpdate_NodeFailure: {
1506 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1507 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1508 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1513 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
1514 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
1515 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
1516 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
1517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
1518 LDKCOption_NetworkUpdateZ_Some_class =
1519 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
1520 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
1521 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
1522 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
1523 LDKCOption_NetworkUpdateZ_None_class =
1524 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
1525 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
1526 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
1527 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
1529 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1530 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1532 case LDKCOption_NetworkUpdateZ_Some: {
1533 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1534 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
1536 case LDKCOption_NetworkUpdateZ_None: {
1537 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
1542 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1543 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1544 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1545 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1546 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1547 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1549 LDKSpendableOutputDescriptor_StaticOutput_class =
1550 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1551 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1552 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1553 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1554 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1555 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1556 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1557 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1558 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1559 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1560 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1561 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1562 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1563 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1565 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1566 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1568 case LDKSpendableOutputDescriptor_StaticOutput: {
1569 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1570 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1571 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1572 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1573 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1574 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1576 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1577 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1578 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1579 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1580 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1581 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1583 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1584 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1585 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1586 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1587 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1588 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1594 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1595 ret->datalen = (*env)->GetArrayLength(env, elems);
1596 if (ret->datalen == 0) {
1599 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1600 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1601 for (size_t i = 0; i < ret->datalen; i++) {
1602 int64_t arr_elem = java_elems[i];
1603 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1604 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1605 ret->data[i] = arr_elem_conv;
1607 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1609 return (uint64_t)ret;
1611 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1612 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1613 for (size_t i = 0; i < ret.datalen; i++) {
1614 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1618 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1619 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1620 static jclass LDKErrorAction_IgnoreError_class = NULL;
1621 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1622 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1623 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1624 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1625 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1627 LDKErrorAction_DisconnectPeer_class =
1628 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1629 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1630 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1631 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1632 LDKErrorAction_IgnoreError_class =
1633 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1634 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1635 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1636 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1637 LDKErrorAction_IgnoreAndLog_class =
1638 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1639 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1640 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1641 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1642 LDKErrorAction_SendErrorMessage_class =
1643 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1644 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1645 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1646 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1648 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1649 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1651 case LDKErrorAction_DisconnectPeer: {
1652 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1653 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1654 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1655 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1656 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1658 case LDKErrorAction_IgnoreError: {
1659 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1661 case LDKErrorAction_IgnoreAndLog: {
1662 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1663 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1665 case LDKErrorAction_SendErrorMessage: {
1666 LDKErrorMessage msg_var = obj->send_error_message.msg;
1667 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1668 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1669 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1670 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1675 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1676 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1677 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1678 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1679 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1680 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1681 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1682 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1683 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1684 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1685 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1686 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1687 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1688 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1689 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1690 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1691 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1692 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1693 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1694 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1695 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1696 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1697 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1698 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1699 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1700 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1701 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1702 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1703 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1704 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1705 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1706 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1707 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1708 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1709 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1710 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1711 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1712 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1714 LDKMessageSendEvent_SendAcceptChannel_class =
1715 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1716 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1717 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1718 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1719 LDKMessageSendEvent_SendOpenChannel_class =
1720 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1721 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1722 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1723 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1724 LDKMessageSendEvent_SendFundingCreated_class =
1725 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1726 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1727 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1728 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1729 LDKMessageSendEvent_SendFundingSigned_class =
1730 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1731 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1732 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1733 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1734 LDKMessageSendEvent_SendFundingLocked_class =
1735 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1736 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1737 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1738 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1739 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1740 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1741 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1742 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1743 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1744 LDKMessageSendEvent_UpdateHTLCs_class =
1745 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1746 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1747 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1748 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1749 LDKMessageSendEvent_SendRevokeAndACK_class =
1750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1751 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1752 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1753 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1754 LDKMessageSendEvent_SendClosingSigned_class =
1755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1756 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1757 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1758 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1759 LDKMessageSendEvent_SendShutdown_class =
1760 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1761 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1762 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1763 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1764 LDKMessageSendEvent_SendChannelReestablish_class =
1765 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1766 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1767 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1768 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1769 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1770 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1771 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1772 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1773 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1774 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1775 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1776 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1777 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1778 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1779 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1780 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1781 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1782 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1783 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1784 LDKMessageSendEvent_SendChannelUpdate_class =
1785 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1786 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1787 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1788 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1789 LDKMessageSendEvent_HandleError_class =
1790 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1791 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1792 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1793 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1794 LDKMessageSendEvent_SendChannelRangeQuery_class =
1795 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1796 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1797 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1798 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1799 LDKMessageSendEvent_SendShortIdsQuery_class =
1800 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1801 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1802 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1803 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1804 LDKMessageSendEvent_SendReplyChannelRange_class =
1805 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1806 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1807 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1808 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1810 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1811 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1813 case LDKMessageSendEvent_SendAcceptChannel: {
1814 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1815 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1816 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1817 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1818 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1819 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1820 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1822 case LDKMessageSendEvent_SendOpenChannel: {
1823 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1824 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1825 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1826 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1827 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1828 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1829 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1831 case LDKMessageSendEvent_SendFundingCreated: {
1832 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1833 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1834 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1835 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1836 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1837 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1838 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1840 case LDKMessageSendEvent_SendFundingSigned: {
1841 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1842 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1843 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1844 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1845 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1846 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1847 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1849 case LDKMessageSendEvent_SendFundingLocked: {
1850 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1851 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1852 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1853 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1854 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1855 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1856 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1858 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1859 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1860 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1861 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1862 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1863 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1864 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1865 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1867 case LDKMessageSendEvent_UpdateHTLCs: {
1868 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1869 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1870 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1871 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1872 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1873 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1874 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1876 case LDKMessageSendEvent_SendRevokeAndACK: {
1877 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1878 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1879 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1880 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1881 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1882 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1883 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1885 case LDKMessageSendEvent_SendClosingSigned: {
1886 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1887 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1888 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1889 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1892 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1894 case LDKMessageSendEvent_SendShutdown: {
1895 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1896 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1897 LDKShutdown msg_var = obj->send_shutdown.msg;
1898 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1899 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1900 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1901 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1903 case LDKMessageSendEvent_SendChannelReestablish: {
1904 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1905 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1906 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1907 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1908 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1909 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1910 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1912 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1913 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1914 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1915 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1916 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1917 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1918 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1919 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1920 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1921 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1923 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1924 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1925 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1926 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1927 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1928 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1930 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1931 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1932 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1933 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1934 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1935 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1937 case LDKMessageSendEvent_SendChannelUpdate: {
1938 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1939 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1940 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1941 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1942 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1943 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1944 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1946 case LDKMessageSendEvent_HandleError: {
1947 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1948 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1949 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1950 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1952 case LDKMessageSendEvent_SendChannelRangeQuery: {
1953 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1954 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1955 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1956 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1957 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1958 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1959 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1961 case LDKMessageSendEvent_SendShortIdsQuery: {
1962 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1963 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1964 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1965 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1966 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1967 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1968 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1970 case LDKMessageSendEvent_SendReplyChannelRange: {
1971 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1972 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1973 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1974 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1975 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1976 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1977 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1983 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1984 ret->datalen = (*env)->GetArrayLength(env, elems);
1985 if (ret->datalen == 0) {
1988 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1989 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1990 for (size_t i = 0; i < ret->datalen; i++) {
1991 int64_t arr_elem = java_elems[i];
1992 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1993 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1994 ret->data[i] = arr_elem_conv;
1996 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1998 return (uint64_t)ret;
2000 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2001 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2002 for (size_t i = 0; i < ret.datalen; i++) {
2003 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2008 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2011 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2012 CHECK(val->result_ok);
2013 LDKInitFeatures res_var = (*val->contents.result);
2014 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2015 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2016 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2020 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2021 CHECK(!val->result_ok);
2022 LDKDecodeError err_var = (*val->contents.err);
2023 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2024 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2025 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2029 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2032 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2033 CHECK(val->result_ok);
2034 LDKNodeFeatures res_var = (*val->contents.result);
2035 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2036 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2037 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2041 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2042 CHECK(!val->result_ok);
2043 LDKDecodeError err_var = (*val->contents.err);
2044 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2045 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2046 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2050 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2053 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2054 CHECK(val->result_ok);
2055 LDKChannelFeatures res_var = (*val->contents.result);
2056 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2057 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2058 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2062 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2063 CHECK(!val->result_ok);
2064 LDKDecodeError err_var = (*val->contents.err);
2065 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2066 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2067 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2071 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2074 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2075 CHECK(val->result_ok);
2076 LDKInvoiceFeatures res_var = (*val->contents.result);
2077 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2078 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2079 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2083 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2084 CHECK(!val->result_ok);
2085 LDKDecodeError err_var = (*val->contents.err);
2086 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2087 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2088 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2092 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2095 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2096 CHECK(val->result_ok);
2097 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2098 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2099 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2100 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2104 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2105 CHECK(!val->result_ok);
2106 LDKDecodeError err_var = (*val->contents.err);
2107 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2108 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2109 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2113 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2116 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2117 CHECK(val->result_ok);
2118 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2119 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2120 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2121 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2125 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2126 CHECK(!val->result_ok);
2127 LDKDecodeError err_var = (*val->contents.err);
2128 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2129 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2130 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2134 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2137 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2138 CHECK(val->result_ok);
2139 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2143 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2144 CHECK(!val->result_ok);
2145 LDKDecodeError err_var = (*val->contents.err);
2146 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2147 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2148 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2152 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
2154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2155 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2156 CHECK(val->result_ok);
2157 return *val->contents.result;
2159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2160 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2161 CHECK(!val->result_ok);
2162 return *val->contents.err;
2164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2165 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2167 CHECK((*env)->GetArrayLength(env, a) == 64);
2168 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2170 LDKCVec_SignatureZ b_constr;
2171 b_constr.datalen = (*env)->GetArrayLength(env, b);
2172 if (b_constr.datalen > 0)
2173 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2175 b_constr.data = NULL;
2176 for (size_t i = 0; i < b_constr.datalen; i++) {
2177 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2178 LDKSignature b_conv_8_ref;
2179 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2180 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2181 b_constr.data[i] = b_conv_8_ref;
2184 return (uint64_t)ret;
2186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2187 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2188 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2189 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2192 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2193 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2194 LDKCVec_SignatureZ b_var = tuple->b;
2195 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2197 for (size_t i = 0; i < b_var.datalen; i++) {
2198 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2199 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2200 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2205 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2208 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2209 CHECK(val->result_ok);
2210 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2214 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2215 CHECK(!val->result_ok);
2216 return *val->contents.err;
2218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2219 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2222 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2223 CHECK(val->result_ok);
2224 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2225 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2229 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2230 CHECK(!val->result_ok);
2231 return *val->contents.err;
2233 typedef struct LDKBaseSign_JCalls {
2234 atomic_size_t refcnt;
2237 jmethodID get_per_commitment_point_meth;
2238 jmethodID release_commitment_secret_meth;
2239 jmethodID validate_holder_commitment_meth;
2240 jmethodID channel_keys_id_meth;
2241 jmethodID sign_counterparty_commitment_meth;
2242 jmethodID validate_counterparty_revocation_meth;
2243 jmethodID sign_holder_commitment_and_htlcs_meth;
2244 jmethodID sign_justice_revoked_output_meth;
2245 jmethodID sign_justice_revoked_htlc_meth;
2246 jmethodID sign_counterparty_htlc_transaction_meth;
2247 jmethodID sign_closing_transaction_meth;
2248 jmethodID sign_channel_announcement_meth;
2249 jmethodID ready_channel_meth;
2250 } LDKBaseSign_JCalls;
2251 static void LDKBaseSign_JCalls_free(void* this_arg) {
2252 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2253 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2255 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2256 if (get_jenv_res == JNI_EDETACHED) {
2257 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2259 DO_ASSERT(get_jenv_res == JNI_OK);
2261 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2262 if (get_jenv_res == JNI_EDETACHED) {
2263 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2268 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2269 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2271 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2272 if (get_jenv_res == JNI_EDETACHED) {
2273 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2275 DO_ASSERT(get_jenv_res == JNI_OK);
2277 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2279 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2280 if ((*env)->ExceptionCheck(env)) {
2281 (*env)->ExceptionDescribe(env);
2282 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2284 LDKPublicKey ret_ref;
2285 CHECK((*env)->GetArrayLength(env, ret) == 33);
2286 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2287 if (get_jenv_res == JNI_EDETACHED) {
2288 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2292 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2293 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2295 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2296 if (get_jenv_res == JNI_EDETACHED) {
2297 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2299 DO_ASSERT(get_jenv_res == JNI_OK);
2301 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2303 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2304 if ((*env)->ExceptionCheck(env)) {
2305 (*env)->ExceptionDescribe(env);
2306 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2308 LDKThirtyTwoBytes ret_ref;
2309 CHECK((*env)->GetArrayLength(env, ret) == 32);
2310 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2311 if (get_jenv_res == JNI_EDETACHED) {
2312 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2316 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
2317 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2319 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2320 if (get_jenv_res == JNI_EDETACHED) {
2321 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2323 DO_ASSERT(get_jenv_res == JNI_OK);
2325 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2326 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2327 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2328 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2329 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
2330 if (holder_tx_var.is_owned) {
2333 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2335 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
2336 if ((*env)->ExceptionCheck(env)) {
2337 (*env)->ExceptionDescribe(env);
2338 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
2340 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2341 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2342 if (get_jenv_res == JNI_EDETACHED) {
2343 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2347 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2348 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2350 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2351 if (get_jenv_res == JNI_EDETACHED) {
2352 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2354 DO_ASSERT(get_jenv_res == JNI_OK);
2356 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2358 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2359 if ((*env)->ExceptionCheck(env)) {
2360 (*env)->ExceptionDescribe(env);
2361 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2363 LDKThirtyTwoBytes ret_ref;
2364 CHECK((*env)->GetArrayLength(env, ret) == 32);
2365 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2366 if (get_jenv_res == JNI_EDETACHED) {
2367 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2371 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2372 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2374 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2375 if (get_jenv_res == JNI_EDETACHED) {
2376 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2378 DO_ASSERT(get_jenv_res == JNI_OK);
2380 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2381 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2382 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2383 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2384 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2385 if (commitment_tx_var.is_owned) {
2386 commitment_tx_ref |= 1;
2388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2390 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2391 if ((*env)->ExceptionCheck(env)) {
2392 (*env)->ExceptionDescribe(env);
2393 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2395 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2396 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2397 if (get_jenv_res == JNI_EDETACHED) {
2398 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2402 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2403 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2405 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2406 if (get_jenv_res == JNI_EDETACHED) {
2407 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2409 DO_ASSERT(get_jenv_res == JNI_OK);
2411 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2412 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2413 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2415 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
2416 if ((*env)->ExceptionCheck(env)) {
2417 (*env)->ExceptionDescribe(env);
2418 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
2420 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2421 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2422 if (get_jenv_res == JNI_EDETACHED) {
2423 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2427 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2428 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2430 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2431 if (get_jenv_res == JNI_EDETACHED) {
2432 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2434 DO_ASSERT(get_jenv_res == JNI_OK);
2436 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2437 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2438 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2439 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2440 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2441 if (commitment_tx_var.is_owned) {
2442 commitment_tx_ref |= 1;
2444 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2446 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2447 if ((*env)->ExceptionCheck(env)) {
2448 (*env)->ExceptionDescribe(env);
2449 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2451 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2452 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2453 if (get_jenv_res == JNI_EDETACHED) {
2454 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2458 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]) {
2459 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2461 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2462 if (get_jenv_res == JNI_EDETACHED) {
2463 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2465 DO_ASSERT(get_jenv_res == JNI_OK);
2467 LDKTransaction justice_tx_var = justice_tx;
2468 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2469 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2470 Transaction_free(justice_tx_var);
2471 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2472 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2473 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2475 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2476 if ((*env)->ExceptionCheck(env)) {
2477 (*env)->ExceptionDescribe(env);
2478 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2480 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2481 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2482 if (get_jenv_res == JNI_EDETACHED) {
2483 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2487 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) {
2488 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2490 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2491 if (get_jenv_res == JNI_EDETACHED) {
2492 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2494 DO_ASSERT(get_jenv_res == JNI_OK);
2496 LDKTransaction justice_tx_var = justice_tx;
2497 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2498 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2499 Transaction_free(justice_tx_var);
2500 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2501 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2502 LDKHTLCOutputInCommitment htlc_var = *htlc;
2503 htlc_var = HTLCOutputInCommitment_clone(htlc);
2504 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2505 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2506 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2507 if (htlc_var.is_owned) {
2510 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2512 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);
2513 if ((*env)->ExceptionCheck(env)) {
2514 (*env)->ExceptionDescribe(env);
2515 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2517 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2518 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2519 if (get_jenv_res == JNI_EDETACHED) {
2520 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2524 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) {
2525 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2527 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2528 if (get_jenv_res == JNI_EDETACHED) {
2529 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2531 DO_ASSERT(get_jenv_res == JNI_OK);
2533 LDKTransaction htlc_tx_var = htlc_tx;
2534 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2535 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2536 Transaction_free(htlc_tx_var);
2537 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2538 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2539 LDKHTLCOutputInCommitment htlc_var = *htlc;
2540 htlc_var = HTLCOutputInCommitment_clone(htlc);
2541 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2542 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2543 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2544 if (htlc_var.is_owned) {
2547 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2549 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);
2550 if ((*env)->ExceptionCheck(env)) {
2551 (*env)->ExceptionDescribe(env);
2552 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2554 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2555 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2556 if (get_jenv_res == JNI_EDETACHED) {
2557 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2561 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2562 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2564 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2565 if (get_jenv_res == JNI_EDETACHED) {
2566 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2568 DO_ASSERT(get_jenv_res == JNI_OK);
2570 LDKClosingTransaction closing_tx_var = *closing_tx;
2571 // Warning: we may need a move here but no clone is available for LDKClosingTransaction
2572 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2573 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2574 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
2575 if (closing_tx_var.is_owned) {
2576 closing_tx_ref |= 1;
2578 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2580 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2581 if ((*env)->ExceptionCheck(env)) {
2582 (*env)->ExceptionDescribe(env);
2583 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2585 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2586 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2587 if (get_jenv_res == JNI_EDETACHED) {
2588 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2592 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2593 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2595 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2596 if (get_jenv_res == JNI_EDETACHED) {
2597 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2599 DO_ASSERT(get_jenv_res == JNI_OK);
2601 LDKUnsignedChannelAnnouncement msg_var = *msg;
2602 msg_var = UnsignedChannelAnnouncement_clone(msg);
2603 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2604 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2605 uint64_t msg_ref = (uint64_t)msg_var.inner;
2606 if (msg_var.is_owned) {
2609 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2611 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2612 if ((*env)->ExceptionCheck(env)) {
2613 (*env)->ExceptionDescribe(env);
2614 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2616 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2617 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2618 if (get_jenv_res == JNI_EDETACHED) {
2619 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2623 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2624 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2626 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2627 if (get_jenv_res == JNI_EDETACHED) {
2628 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2630 DO_ASSERT(get_jenv_res == JNI_OK);
2632 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2633 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2634 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2635 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2636 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2637 if (channel_parameters_var.is_owned) {
2638 channel_parameters_ref |= 1;
2640 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2642 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2643 if ((*env)->ExceptionCheck(env)) {
2644 (*env)->ExceptionDescribe(env);
2645 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2647 if (get_jenv_res == JNI_EDETACHED) {
2648 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2651 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2652 jclass c = (*env)->GetObjectClass(env, o);
2654 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2655 atomic_init(&calls->refcnt, 1);
2656 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2657 calls->o = (*env)->NewWeakGlobalRef(env, o);
2658 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2659 CHECK(calls->get_per_commitment_point_meth != NULL);
2660 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2661 CHECK(calls->release_commitment_secret_meth != NULL);
2662 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
2663 CHECK(calls->validate_holder_commitment_meth != NULL);
2664 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2665 CHECK(calls->channel_keys_id_meth != NULL);
2666 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2667 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2668 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2669 CHECK(calls->validate_counterparty_revocation_meth != NULL);
2670 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2671 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2672 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2673 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2674 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2675 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2676 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2677 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2678 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2679 CHECK(calls->sign_closing_transaction_meth != NULL);
2680 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2681 CHECK(calls->sign_channel_announcement_meth != NULL);
2682 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2683 CHECK(calls->ready_channel_meth != NULL);
2685 LDKChannelPublicKeys pubkeys_conv;
2686 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2687 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2688 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2691 .this_arg = (void*) calls,
2692 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2693 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2694 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2695 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2696 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2697 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2698 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2699 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2700 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2701 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2702 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2703 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2704 .ready_channel = ready_channel_LDKBaseSign_jcall,
2705 .free = LDKBaseSign_JCalls_free,
2706 .pubkeys = pubkeys_conv,
2707 .set_pubkeys = NULL,
2711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2712 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2713 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2714 return (uint64_t)res_ptr;
2716 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) {
2717 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2718 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2719 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2724 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2725 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2726 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2730 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) {
2731 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2732 LDKHolderCommitmentTransaction holder_tx_conv;
2733 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2734 holder_tx_conv.is_owned = false;
2735 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2736 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2737 return (uint64_t)ret_conv;
2740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2741 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2742 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2743 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2747 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) {
2748 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2749 LDKCommitmentTransaction commitment_tx_conv;
2750 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2751 commitment_tx_conv.is_owned = false;
2752 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2753 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2754 return (uint64_t)ret_conv;
2757 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) {
2758 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2759 unsigned char secret_arr[32];
2760 CHECK((*env)->GetArrayLength(env, secret) == 32);
2761 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
2762 unsigned char (*secret_ref)[32] = &secret_arr;
2763 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2764 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2765 return (uint64_t)ret_conv;
2768 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) {
2769 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2770 LDKHolderCommitmentTransaction 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_holder_commitment_and_htlcs)(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_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) {
2779 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2780 LDKTransaction justice_tx_ref;
2781 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2782 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2783 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2784 justice_tx_ref.data_is_owned = true;
2785 unsigned char per_commitment_key_arr[32];
2786 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2787 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2788 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2789 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2790 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2791 return (uint64_t)ret_conv;
2794 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) {
2795 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2796 LDKTransaction justice_tx_ref;
2797 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2798 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2799 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2800 justice_tx_ref.data_is_owned = true;
2801 unsigned char per_commitment_key_arr[32];
2802 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2803 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2804 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2805 LDKHTLCOutputInCommitment htlc_conv;
2806 htlc_conv.inner = (void*)(htlc & (~1));
2807 htlc_conv.is_owned = false;
2808 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2809 *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);
2810 return (uint64_t)ret_conv;
2813 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) {
2814 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2815 LDKTransaction htlc_tx_ref;
2816 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2817 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2818 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2819 htlc_tx_ref.data_is_owned = true;
2820 LDKPublicKey per_commitment_point_ref;
2821 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2822 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2823 LDKHTLCOutputInCommitment htlc_conv;
2824 htlc_conv.inner = (void*)(htlc & (~1));
2825 htlc_conv.is_owned = false;
2826 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2827 *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);
2828 return (uint64_t)ret_conv;
2831 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) {
2832 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2833 LDKClosingTransaction closing_tx_conv;
2834 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2835 closing_tx_conv.is_owned = false;
2836 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2837 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2838 return (uint64_t)ret_conv;
2841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2842 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2843 LDKUnsignedChannelAnnouncement msg_conv;
2844 msg_conv.inner = (void*)(msg & (~1));
2845 msg_conv.is_owned = false;
2846 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2847 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2848 return (uint64_t)ret_conv;
2851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2852 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2853 LDKChannelTransactionParameters channel_parameters_conv;
2854 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2855 channel_parameters_conv.is_owned = false;
2856 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2859 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2860 if (this_arg->set_pubkeys != NULL)
2861 this_arg->set_pubkeys(this_arg);
2862 return this_arg->pubkeys;
2864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2865 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2866 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2869 uint64_t ret_ref = (uint64_t)ret_var.inner;
2870 if (ret_var.is_owned) {
2876 typedef struct LDKSign_JCalls {
2877 atomic_size_t refcnt;
2880 LDKBaseSign_JCalls* BaseSign;
2881 jmethodID write_meth;
2883 static void LDKSign_JCalls_free(void* this_arg) {
2884 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2885 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2887 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2888 if (get_jenv_res == JNI_EDETACHED) {
2889 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2891 DO_ASSERT(get_jenv_res == JNI_OK);
2893 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2894 if (get_jenv_res == JNI_EDETACHED) {
2895 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2900 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2901 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2903 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2904 if (get_jenv_res == JNI_EDETACHED) {
2905 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2907 DO_ASSERT(get_jenv_res == JNI_OK);
2909 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2911 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2912 if ((*env)->ExceptionCheck(env)) {
2913 (*env)->ExceptionDescribe(env);
2914 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2916 LDKCVec_u8Z ret_ref;
2917 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2918 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2919 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2920 if (get_jenv_res == JNI_EDETACHED) {
2921 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2925 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2926 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2927 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2928 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2930 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2931 jclass c = (*env)->GetObjectClass(env, o);
2933 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2934 atomic_init(&calls->refcnt, 1);
2935 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2936 calls->o = (*env)->NewWeakGlobalRef(env, o);
2937 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2938 CHECK(calls->write_meth != NULL);
2940 LDKChannelPublicKeys pubkeys_conv;
2941 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2942 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2943 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2946 .this_arg = (void*) calls,
2947 .write = write_LDKSign_jcall,
2948 .cloned = LDKSign_JCalls_cloned,
2949 .free = LDKSign_JCalls_free,
2950 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2952 calls->BaseSign = ret.BaseSign.this_arg;
2955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2956 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2957 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2958 return (uint64_t)res_ptr;
2960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
2961 LDKSign *inp = (LDKSign *)(arg & ~1);
2962 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
2963 DO_ASSERT((res_ptr & 1) == 0);
2964 return (int64_t)(res_ptr | 1);
2966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2967 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2968 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2969 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2970 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2971 CVec_u8Z_free(ret_var);
2975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2976 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2979 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2980 CHECK(val->result_ok);
2981 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2982 *res_ret = Sign_clone(&(*val->contents.result));
2983 return (uint64_t)res_ret;
2985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2986 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2987 CHECK(!val->result_ok);
2988 LDKDecodeError err_var = (*val->contents.err);
2989 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2990 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2991 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2995 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2998 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2999 CHECK(val->result_ok);
3000 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
3001 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
3004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3005 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3006 CHECK(!val->result_ok);
3007 return *val->contents.err;
3009 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3010 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3011 for (size_t i = 0; i < ret.datalen; i++) {
3012 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3017 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3019 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3020 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3021 CHECK(val->result_ok);
3022 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3023 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3025 for (size_t i = 0; i < res_var.datalen; i++) {
3026 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3027 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3028 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3029 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3034 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3035 CHECK(!val->result_ok);
3036 return *val->contents.err;
3038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3039 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3042 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3043 CHECK(val->result_ok);
3044 LDKInMemorySigner res_var = (*val->contents.result);
3045 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3046 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3047 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3051 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3052 CHECK(!val->result_ok);
3053 LDKDecodeError err_var = (*val->contents.err);
3054 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3055 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3056 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3060 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3061 ret->datalen = (*env)->GetArrayLength(env, elems);
3062 if (ret->datalen == 0) {
3065 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3066 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3067 for (size_t i = 0; i < ret->datalen; i++) {
3068 int64_t arr_elem = java_elems[i];
3069 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3070 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3071 ret->data[i] = arr_elem_conv;
3073 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3075 return (uint64_t)ret;
3077 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3078 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3079 for (size_t i = 0; i < ret.datalen; i++) {
3080 ret.data[i] = TxOut_clone(&orig->data[i]);
3084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3085 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3088 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3089 CHECK(val->result_ok);
3090 LDKTransaction res_var = (*val->contents.result);
3091 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3092 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3096 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3097 CHECK(!val->result_ok);
3098 return *val->contents.err;
3100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3101 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3102 LDKThirtyTwoBytes a_ref;
3103 CHECK((*env)->GetArrayLength(env, a) == 32);
3104 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3106 LDKChannelMonitor b_conv;
3107 b_conv.inner = (void*)(b & (~1));
3108 b_conv.is_owned = (b & 1) || (b == 0);
3109 b_conv = ChannelMonitor_clone(&b_conv);
3111 return (uint64_t)ret;
3113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3114 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
3115 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3116 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3120 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
3121 LDKChannelMonitor b_var = tuple->b;
3122 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3123 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3124 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3128 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3129 ret->datalen = (*env)->GetArrayLength(env, elems);
3130 if (ret->datalen == 0) {
3133 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3134 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3135 for (size_t i = 0; i < ret->datalen; i++) {
3136 int64_t arr_elem = java_elems[i];
3137 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
3138 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
3139 ret->data[i] = arr_elem_conv;
3141 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3143 return (uint64_t)ret;
3145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3146 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3148 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3149 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3150 CHECK(val->result_ok);
3151 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3152 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3153 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3154 for (size_t i = 0; i < res_var.datalen; i++) {
3155 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
3156 res_arr_ptr[i] = res_conv_34_ref;
3158 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3161 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3162 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3163 CHECK(!val->result_ok);
3164 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3167 static jclass LDKCOption_u16Z_Some_class = NULL;
3168 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3169 static jclass LDKCOption_u16Z_None_class = NULL;
3170 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3172 LDKCOption_u16Z_Some_class =
3173 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3174 CHECK(LDKCOption_u16Z_Some_class != NULL);
3175 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3176 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3177 LDKCOption_u16Z_None_class =
3178 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3179 CHECK(LDKCOption_u16Z_None_class != NULL);
3180 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3181 CHECK(LDKCOption_u16Z_None_meth != NULL);
3183 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3184 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3186 case LDKCOption_u16Z_Some: {
3187 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3189 case LDKCOption_u16Z_None: {
3190 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3195 static jclass LDKAPIError_APIMisuseError_class = NULL;
3196 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3197 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3198 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3199 static jclass LDKAPIError_RouteError_class = NULL;
3200 static jmethodID LDKAPIError_RouteError_meth = NULL;
3201 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3202 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3203 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3204 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3205 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3206 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3208 LDKAPIError_APIMisuseError_class =
3209 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3210 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3211 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3212 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3213 LDKAPIError_FeeRateTooHigh_class =
3214 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3215 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3216 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3217 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3218 LDKAPIError_RouteError_class =
3219 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3220 CHECK(LDKAPIError_RouteError_class != NULL);
3221 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3222 CHECK(LDKAPIError_RouteError_meth != NULL);
3223 LDKAPIError_ChannelUnavailable_class =
3224 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3225 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3226 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3227 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3228 LDKAPIError_MonitorUpdateFailed_class =
3229 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3230 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3231 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3232 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3233 LDKAPIError_IncompatibleShutdownScript_class =
3234 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3235 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3236 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3237 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3239 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3240 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3242 case LDKAPIError_APIMisuseError: {
3243 LDKStr err_str = obj->api_misuse_error.err;
3244 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3245 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3247 case LDKAPIError_FeeRateTooHigh: {
3248 LDKStr err_str = obj->fee_rate_too_high.err;
3249 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3250 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3252 case LDKAPIError_RouteError: {
3253 LDKStr err_str = obj->route_error.err;
3254 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3255 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3257 case LDKAPIError_ChannelUnavailable: {
3258 LDKStr err_str = obj->channel_unavailable.err;
3259 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3260 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3262 case LDKAPIError_MonitorUpdateFailed: {
3263 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3265 case LDKAPIError_IncompatibleShutdownScript: {
3266 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3267 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3268 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3269 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
3270 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3275 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3276 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3279 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3280 CHECK(val->result_ok);
3281 return *val->contents.result;
3283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3284 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3285 CHECK(!val->result_ok);
3286 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3290 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3291 ret->datalen = (*env)->GetArrayLength(env, elems);
3292 if (ret->datalen == 0) {
3295 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3296 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3297 for (size_t i = 0; i < ret->datalen; i++) {
3298 int64_t arr_elem = java_elems[i];
3299 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3300 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3301 ret->data[i] = arr_elem_conv;
3303 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3305 return (uint64_t)ret;
3307 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3308 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3309 for (size_t i = 0; i < ret.datalen; i++) {
3310 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3315 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3316 ret->datalen = (*env)->GetArrayLength(env, elems);
3317 if (ret->datalen == 0) {
3320 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3321 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3322 for (size_t i = 0; i < ret->datalen; i++) {
3323 int64_t arr_elem = java_elems[i];
3324 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3325 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3326 ret->data[i] = arr_elem_conv;
3328 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3330 return (uint64_t)ret;
3332 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3333 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3334 for (size_t i = 0; i < ret.datalen; i++) {
3335 ret.data[i] = APIError_clone(&orig->data[i]);
3339 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3340 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3341 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3342 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3343 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3344 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3345 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3346 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3348 LDKPaymentSendFailure_ParameterError_class =
3349 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3350 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3351 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3352 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3353 LDKPaymentSendFailure_PathParameterError_class =
3354 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3355 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3356 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3357 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3358 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3359 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3360 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3361 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3362 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3363 LDKPaymentSendFailure_PartialFailure_class =
3364 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3365 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3366 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3367 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3369 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3370 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3372 case LDKPaymentSendFailure_ParameterError: {
3373 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3374 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3376 case LDKPaymentSendFailure_PathParameterError: {
3377 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3378 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3379 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3380 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3381 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3382 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3383 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3384 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3386 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3387 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3389 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3390 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3391 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3392 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3393 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3394 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3395 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3397 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3398 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3400 case LDKPaymentSendFailure_PartialFailure: {
3401 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3402 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3403 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3404 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3405 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3406 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3407 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3408 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3410 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3411 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3416 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3417 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3420 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3421 CHECK(val->result_ok);
3422 return *val->contents.result;
3424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3425 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3426 CHECK(!val->result_ok);
3427 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3431 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
3433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3434 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3435 CHECK(val->result_ok);
3436 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3437 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3441 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3442 CHECK(!val->result_ok);
3443 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3446 static jclass LDKNetAddress_IPv4_class = NULL;
3447 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3448 static jclass LDKNetAddress_IPv6_class = NULL;
3449 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3450 static jclass LDKNetAddress_OnionV2_class = NULL;
3451 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3452 static jclass LDKNetAddress_OnionV3_class = NULL;
3453 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3455 LDKNetAddress_IPv4_class =
3456 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3457 CHECK(LDKNetAddress_IPv4_class != NULL);
3458 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3459 CHECK(LDKNetAddress_IPv4_meth != NULL);
3460 LDKNetAddress_IPv6_class =
3461 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3462 CHECK(LDKNetAddress_IPv6_class != NULL);
3463 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3464 CHECK(LDKNetAddress_IPv6_meth != NULL);
3465 LDKNetAddress_OnionV2_class =
3466 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3467 CHECK(LDKNetAddress_OnionV2_class != NULL);
3468 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3469 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3470 LDKNetAddress_OnionV3_class =
3471 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3472 CHECK(LDKNetAddress_OnionV3_class != NULL);
3473 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3474 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3476 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3477 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3479 case LDKNetAddress_IPv4: {
3480 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3481 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3482 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3484 case LDKNetAddress_IPv6: {
3485 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3486 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3487 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3489 case LDKNetAddress_OnionV2: {
3490 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3491 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3492 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3494 case LDKNetAddress_OnionV3: {
3495 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3496 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3497 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);
3502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3503 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3504 ret->datalen = (*env)->GetArrayLength(env, elems);
3505 if (ret->datalen == 0) {
3508 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3509 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3510 for (size_t i = 0; i < ret->datalen; i++) {
3511 int64_t arr_elem = java_elems[i];
3512 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3513 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3514 ret->data[i] = arr_elem_conv;
3516 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3518 return (uint64_t)ret;
3520 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3521 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3522 for (size_t i = 0; i < ret.datalen; i++) {
3523 ret.data[i] = NetAddress_clone(&orig->data[i]);
3527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3528 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3529 LDKThirtyTwoBytes a_ref;
3530 CHECK((*env)->GetArrayLength(env, a) == 32);
3531 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3533 LDKThirtyTwoBytes b_ref;
3534 CHECK((*env)->GetArrayLength(env, b) == 32);
3535 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3537 return (uint64_t)ret;
3539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3540 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3541 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3542 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3546 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3547 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3548 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3552 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3555 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3556 CHECK(val->result_ok);
3557 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3558 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3562 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3563 CHECK(!val->result_ok);
3564 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3568 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3569 ret->datalen = (*env)->GetArrayLength(env, elems);
3570 if (ret->datalen == 0) {
3573 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3574 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3575 for (size_t i = 0; i < ret->datalen; i++) {
3576 int64_t arr_elem = java_elems[i];
3577 LDKChannelMonitor arr_elem_conv;
3578 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3579 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3580 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3581 ret->data[i] = arr_elem_conv;
3583 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3585 return (uint64_t)ret;
3587 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3588 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3589 for (size_t i = 0; i < ret.datalen; i++) {
3590 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3594 typedef struct LDKWatch_JCalls {
3595 atomic_size_t refcnt;
3598 jmethodID watch_channel_meth;
3599 jmethodID update_channel_meth;
3600 jmethodID release_pending_monitor_events_meth;
3602 static void LDKWatch_JCalls_free(void* this_arg) {
3603 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3604 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3606 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3607 if (get_jenv_res == JNI_EDETACHED) {
3608 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3610 DO_ASSERT(get_jenv_res == JNI_OK);
3612 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3613 if (get_jenv_res == JNI_EDETACHED) {
3614 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3619 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3620 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3622 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3623 if (get_jenv_res == JNI_EDETACHED) {
3624 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3626 DO_ASSERT(get_jenv_res == JNI_OK);
3628 LDKOutPoint funding_txo_var = funding_txo;
3629 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3630 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3631 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3632 if (funding_txo_var.is_owned) {
3633 funding_txo_ref |= 1;
3635 LDKChannelMonitor monitor_var = monitor;
3636 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3637 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3638 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3639 if (monitor_var.is_owned) {
3642 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3644 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3645 if ((*env)->ExceptionCheck(env)) {
3646 (*env)->ExceptionDescribe(env);
3647 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3649 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3650 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3651 if (get_jenv_res == JNI_EDETACHED) {
3652 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3656 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3657 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3659 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3660 if (get_jenv_res == JNI_EDETACHED) {
3661 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3663 DO_ASSERT(get_jenv_res == JNI_OK);
3665 LDKOutPoint funding_txo_var = funding_txo;
3666 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3667 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3668 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3669 if (funding_txo_var.is_owned) {
3670 funding_txo_ref |= 1;
3672 LDKChannelMonitorUpdate update_var = update;
3673 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3674 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3675 uint64_t update_ref = (uint64_t)update_var.inner;
3676 if (update_var.is_owned) {
3679 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3681 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3682 if ((*env)->ExceptionCheck(env)) {
3683 (*env)->ExceptionDescribe(env);
3684 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3686 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3687 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3688 if (get_jenv_res == JNI_EDETACHED) {
3689 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3693 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3694 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3696 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3697 if (get_jenv_res == JNI_EDETACHED) {
3698 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3700 DO_ASSERT(get_jenv_res == JNI_OK);
3702 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3704 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3705 if ((*env)->ExceptionCheck(env)) {
3706 (*env)->ExceptionDescribe(env);
3707 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
3709 LDKCVec_MonitorEventZ ret_constr;
3710 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3711 if (ret_constr.datalen > 0)
3712 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3714 ret_constr.data = NULL;
3715 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3716 for (size_t o = 0; o < ret_constr.datalen; o++) {
3717 int64_t ret_conv_14 = ret_vals[o];
3718 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3719 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3720 ret_constr.data[o] = ret_conv_14_conv;
3722 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3723 if (get_jenv_res == JNI_EDETACHED) {
3724 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3728 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3729 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3730 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3732 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3733 jclass c = (*env)->GetObjectClass(env, o);
3735 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3736 atomic_init(&calls->refcnt, 1);
3737 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3738 calls->o = (*env)->NewWeakGlobalRef(env, o);
3739 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3740 CHECK(calls->watch_channel_meth != NULL);
3741 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3742 CHECK(calls->update_channel_meth != NULL);
3743 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3744 CHECK(calls->release_pending_monitor_events_meth != NULL);
3747 .this_arg = (void*) calls,
3748 .watch_channel = watch_channel_LDKWatch_jcall,
3749 .update_channel = update_channel_LDKWatch_jcall,
3750 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3751 .free = LDKWatch_JCalls_free,
3755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3756 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3757 *res_ptr = LDKWatch_init(env, clz, o);
3758 return (uint64_t)res_ptr;
3760 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) {
3761 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3762 LDKOutPoint funding_txo_conv;
3763 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3764 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3765 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3766 LDKChannelMonitor monitor_conv;
3767 monitor_conv.inner = (void*)(monitor & (~1));
3768 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3769 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3770 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3771 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3772 return (uint64_t)ret_conv;
3775 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) {
3776 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3777 LDKOutPoint funding_txo_conv;
3778 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3779 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3780 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3781 LDKChannelMonitorUpdate update_conv;
3782 update_conv.inner = (void*)(update & (~1));
3783 update_conv.is_owned = (update & 1) || (update == 0);
3784 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3785 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3786 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3787 return (uint64_t)ret_conv;
3790 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3791 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3792 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3793 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3794 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3795 for (size_t o = 0; o < ret_var.datalen; o++) {
3796 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3797 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3798 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3799 ret_arr_ptr[o] = ret_conv_14_ref;
3801 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3806 typedef struct LDKBroadcasterInterface_JCalls {
3807 atomic_size_t refcnt;
3810 jmethodID broadcast_transaction_meth;
3811 } LDKBroadcasterInterface_JCalls;
3812 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3813 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3814 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3816 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3817 if (get_jenv_res == JNI_EDETACHED) {
3818 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3820 DO_ASSERT(get_jenv_res == JNI_OK);
3822 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3823 if (get_jenv_res == JNI_EDETACHED) {
3824 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3829 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3830 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3832 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3833 if (get_jenv_res == JNI_EDETACHED) {
3834 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3836 DO_ASSERT(get_jenv_res == JNI_OK);
3838 LDKTransaction tx_var = tx;
3839 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3840 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3841 Transaction_free(tx_var);
3842 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3844 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3845 if ((*env)->ExceptionCheck(env)) {
3846 (*env)->ExceptionDescribe(env);
3847 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
3849 if (get_jenv_res == JNI_EDETACHED) {
3850 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3853 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3854 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3855 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3857 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3858 jclass c = (*env)->GetObjectClass(env, o);
3860 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3861 atomic_init(&calls->refcnt, 1);
3862 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3863 calls->o = (*env)->NewWeakGlobalRef(env, o);
3864 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3865 CHECK(calls->broadcast_transaction_meth != NULL);
3867 LDKBroadcasterInterface ret = {
3868 .this_arg = (void*) calls,
3869 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3870 .free = LDKBroadcasterInterface_JCalls_free,
3874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3875 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3876 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3877 return (uint64_t)res_ptr;
3879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3880 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3881 LDKTransaction tx_ref;
3882 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3883 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3884 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3885 tx_ref.data_is_owned = true;
3886 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3889 typedef struct LDKKeysInterface_JCalls {
3890 atomic_size_t refcnt;
3893 jmethodID get_node_secret_meth;
3894 jmethodID get_destination_script_meth;
3895 jmethodID get_shutdown_scriptpubkey_meth;
3896 jmethodID get_channel_signer_meth;
3897 jmethodID get_secure_random_bytes_meth;
3898 jmethodID read_chan_signer_meth;
3899 jmethodID sign_invoice_meth;
3900 } LDKKeysInterface_JCalls;
3901 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3902 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3903 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3905 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3906 if (get_jenv_res == JNI_EDETACHED) {
3907 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3909 DO_ASSERT(get_jenv_res == JNI_OK);
3911 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3912 if (get_jenv_res == JNI_EDETACHED) {
3913 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3918 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3919 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3921 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3922 if (get_jenv_res == JNI_EDETACHED) {
3923 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3925 DO_ASSERT(get_jenv_res == JNI_OK);
3927 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3929 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3930 if ((*env)->ExceptionCheck(env)) {
3931 (*env)->ExceptionDescribe(env);
3932 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
3934 LDKSecretKey ret_ref;
3935 CHECK((*env)->GetArrayLength(env, ret) == 32);
3936 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3937 if (get_jenv_res == JNI_EDETACHED) {
3938 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3942 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3943 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3945 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3946 if (get_jenv_res == JNI_EDETACHED) {
3947 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3949 DO_ASSERT(get_jenv_res == JNI_OK);
3951 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3953 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3954 if ((*env)->ExceptionCheck(env)) {
3955 (*env)->ExceptionDescribe(env);
3956 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
3958 LDKCVec_u8Z ret_ref;
3959 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3960 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3961 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3962 if (get_jenv_res == JNI_EDETACHED) {
3963 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3967 LDKShutdownScript get_shutdown_scriptpubkey_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 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
3979 if ((*env)->ExceptionCheck(env)) {
3980 (*env)->ExceptionDescribe(env);
3981 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
3983 LDKShutdownScript ret_conv;
3984 ret_conv.inner = (void*)(ret & (~1));
3985 ret_conv.is_owned = (ret & 1) || (ret == 0);
3986 ret_conv = ShutdownScript_clone(&ret_conv);
3987 if (get_jenv_res == JNI_EDETACHED) {
3988 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3992 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3993 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3995 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3996 if (get_jenv_res == JNI_EDETACHED) {
3997 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3999 DO_ASSERT(get_jenv_res == JNI_OK);
4001 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4003 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
4004 if ((*env)->ExceptionCheck(env)) {
4005 (*env)->ExceptionDescribe(env);
4006 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
4008 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
4009 ret_conv = Sign_clone(&ret_conv);
4010 if (get_jenv_res == JNI_EDETACHED) {
4011 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4015 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4016 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4018 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4019 if (get_jenv_res == JNI_EDETACHED) {
4020 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4022 DO_ASSERT(get_jenv_res == JNI_OK);
4024 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4026 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
4027 if ((*env)->ExceptionCheck(env)) {
4028 (*env)->ExceptionDescribe(env);
4029 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
4031 LDKThirtyTwoBytes ret_ref;
4032 CHECK((*env)->GetArrayLength(env, ret) == 32);
4033 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4034 if (get_jenv_res == JNI_EDETACHED) {
4035 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4039 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4040 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4042 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4043 if (get_jenv_res == JNI_EDETACHED) {
4044 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4046 DO_ASSERT(get_jenv_res == JNI_OK);
4048 LDKu8slice reader_var = reader;
4049 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
4050 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
4051 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4053 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
4054 if ((*env)->ExceptionCheck(env)) {
4055 (*env)->ExceptionDescribe(env);
4056 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
4058 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
4059 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
4060 if (get_jenv_res == JNI_EDETACHED) {
4061 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4065 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
4066 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4068 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4069 if (get_jenv_res == JNI_EDETACHED) {
4070 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4072 DO_ASSERT(get_jenv_res == JNI_OK);
4074 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
4075 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
4076 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
4077 CVec_u8Z_free(invoice_preimage_var);
4078 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4080 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
4081 if ((*env)->ExceptionCheck(env)) {
4082 (*env)->ExceptionDescribe(env);
4083 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
4085 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
4086 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
4087 if (get_jenv_res == JNI_EDETACHED) {
4088 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4092 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4093 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4094 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4096 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4097 jclass c = (*env)->GetObjectClass(env, o);
4099 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4100 atomic_init(&calls->refcnt, 1);
4101 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4102 calls->o = (*env)->NewWeakGlobalRef(env, o);
4103 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4104 CHECK(calls->get_node_secret_meth != NULL);
4105 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4106 CHECK(calls->get_destination_script_meth != NULL);
4107 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
4108 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
4109 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4110 CHECK(calls->get_channel_signer_meth != NULL);
4111 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4112 CHECK(calls->get_secure_random_bytes_meth != NULL);
4113 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4114 CHECK(calls->read_chan_signer_meth != NULL);
4115 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4116 CHECK(calls->sign_invoice_meth != NULL);
4118 LDKKeysInterface ret = {
4119 .this_arg = (void*) calls,
4120 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4121 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4122 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4123 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4124 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4125 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4126 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4127 .free = LDKKeysInterface_JCalls_free,
4131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4132 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4133 *res_ptr = LDKKeysInterface_init(env, clz, o);
4134 return (uint64_t)res_ptr;
4136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4137 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4138 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4139 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4144 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4145 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4146 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4147 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4148 CVec_u8Z_free(ret_var);
4152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4153 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4154 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4157 uint64_t ret_ref = (uint64_t)ret_var.inner;
4158 if (ret_var.is_owned) {
4164 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) {
4165 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4166 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
4167 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4168 return (uint64_t)ret_ret;
4171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4172 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4173 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4174 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4179 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4180 LDKu8slice reader_ref;
4181 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4182 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4183 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4184 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4185 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4186 return (uint64_t)ret_conv;
4189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4190 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4191 LDKCVec_u8Z invoice_preimage_ref;
4192 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4193 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4194 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4195 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4196 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4197 return (uint64_t)ret_conv;
4200 typedef struct LDKFeeEstimator_JCalls {
4201 atomic_size_t refcnt;
4204 jmethodID get_est_sat_per_1000_weight_meth;
4205 } LDKFeeEstimator_JCalls;
4206 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4207 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4208 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4210 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4211 if (get_jenv_res == JNI_EDETACHED) {
4212 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4214 DO_ASSERT(get_jenv_res == JNI_OK);
4216 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4217 if (get_jenv_res == JNI_EDETACHED) {
4218 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4223 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4224 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4226 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4227 if (get_jenv_res == JNI_EDETACHED) {
4228 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4230 DO_ASSERT(get_jenv_res == JNI_OK);
4232 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4233 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4235 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4236 if ((*env)->ExceptionCheck(env)) {
4237 (*env)->ExceptionDescribe(env);
4238 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4240 if (get_jenv_res == JNI_EDETACHED) {
4241 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4245 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4246 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4247 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4249 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4250 jclass c = (*env)->GetObjectClass(env, o);
4252 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4253 atomic_init(&calls->refcnt, 1);
4254 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4255 calls->o = (*env)->NewWeakGlobalRef(env, o);
4256 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4257 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4259 LDKFeeEstimator ret = {
4260 .this_arg = (void*) calls,
4261 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4262 .free = LDKFeeEstimator_JCalls_free,
4266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4267 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4268 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4269 return (uint64_t)res_ptr;
4271 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) {
4272 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
4273 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4274 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4278 typedef struct LDKLogger_JCalls {
4279 atomic_size_t refcnt;
4284 static void LDKLogger_JCalls_free(void* this_arg) {
4285 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4286 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4288 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4289 if (get_jenv_res == JNI_EDETACHED) {
4290 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4292 DO_ASSERT(get_jenv_res == JNI_OK);
4294 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4295 if (get_jenv_res == JNI_EDETACHED) {
4296 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4301 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4302 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4304 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4305 if (get_jenv_res == JNI_EDETACHED) {
4306 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4308 DO_ASSERT(get_jenv_res == JNI_OK);
4310 const char* record_str = record;
4311 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4312 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4314 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4315 if ((*env)->ExceptionCheck(env)) {
4316 (*env)->ExceptionDescribe(env);
4317 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4319 if (get_jenv_res == JNI_EDETACHED) {
4320 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4323 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4324 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4325 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4327 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4328 jclass c = (*env)->GetObjectClass(env, o);
4330 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4331 atomic_init(&calls->refcnt, 1);
4332 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4333 calls->o = (*env)->NewWeakGlobalRef(env, o);
4334 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4335 CHECK(calls->log_meth != NULL);
4338 .this_arg = (void*) calls,
4339 .log = log_LDKLogger_jcall,
4340 .free = LDKLogger_JCalls_free,
4344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4345 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4346 *res_ptr = LDKLogger_init(env, clz, o);
4347 return (uint64_t)res_ptr;
4349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4350 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4351 LDKThirtyTwoBytes a_ref;
4352 CHECK((*env)->GetArrayLength(env, a) == 32);
4353 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4355 LDKChannelManager b_conv;
4356 b_conv.inner = (void*)(b & (~1));
4357 b_conv.is_owned = (b & 1) || (b == 0);
4358 // Warning: we need a move here but no clone is available for LDKChannelManager
4360 return (uint64_t)ret;
4362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4363 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4364 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4365 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4369 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4370 LDKChannelManager b_var = tuple->b;
4371 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4372 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4373 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4377 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4380 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4381 CHECK(val->result_ok);
4382 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4386 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4387 CHECK(!val->result_ok);
4388 LDKDecodeError err_var = (*val->contents.err);
4389 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4390 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4391 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4395 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4398 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4399 CHECK(val->result_ok);
4400 LDKChannelConfig res_var = (*val->contents.result);
4401 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4402 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4403 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4407 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4408 CHECK(!val->result_ok);
4409 LDKDecodeError err_var = (*val->contents.err);
4410 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4411 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4412 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4416 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4419 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4420 CHECK(val->result_ok);
4421 LDKOutPoint res_var = (*val->contents.result);
4422 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4423 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4424 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4428 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4429 CHECK(!val->result_ok);
4430 LDKDecodeError err_var = (*val->contents.err);
4431 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4432 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4433 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4436 typedef struct LDKType_JCalls {
4437 atomic_size_t refcnt;
4440 jmethodID type_id_meth;
4441 jmethodID debug_str_meth;
4442 jmethodID write_meth;
4444 static void LDKType_JCalls_free(void* this_arg) {
4445 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4446 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4448 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4449 if (get_jenv_res == JNI_EDETACHED) {
4450 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4452 DO_ASSERT(get_jenv_res == JNI_OK);
4454 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4455 if (get_jenv_res == JNI_EDETACHED) {
4456 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4461 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4462 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4464 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4465 if (get_jenv_res == JNI_EDETACHED) {
4466 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4468 DO_ASSERT(get_jenv_res == JNI_OK);
4470 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4472 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
4473 if ((*env)->ExceptionCheck(env)) {
4474 (*env)->ExceptionDescribe(env);
4475 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
4477 if (get_jenv_res == JNI_EDETACHED) {
4478 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4482 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4483 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4485 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4486 if (get_jenv_res == JNI_EDETACHED) {
4487 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4489 DO_ASSERT(get_jenv_res == JNI_OK);
4491 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4493 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
4494 if ((*env)->ExceptionCheck(env)) {
4495 (*env)->ExceptionDescribe(env);
4496 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
4498 LDKStr ret_conv = java_to_owned_str(env, ret);
4499 if (get_jenv_res == JNI_EDETACHED) {
4500 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4504 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
4505 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
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 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4515 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4516 if ((*env)->ExceptionCheck(env)) {
4517 (*env)->ExceptionDescribe(env);
4518 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
4520 LDKCVec_u8Z ret_ref;
4521 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4522 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4523 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4524 if (get_jenv_res == JNI_EDETACHED) {
4525 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4529 static void LDKType_JCalls_cloned(LDKType* new_obj) {
4530 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
4531 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4533 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
4534 jclass c = (*env)->GetObjectClass(env, o);
4536 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
4537 atomic_init(&calls->refcnt, 1);
4538 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4539 calls->o = (*env)->NewWeakGlobalRef(env, o);
4540 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
4541 CHECK(calls->type_id_meth != NULL);
4542 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
4543 CHECK(calls->debug_str_meth != NULL);
4544 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4545 CHECK(calls->write_meth != NULL);
4548 .this_arg = (void*) calls,
4549 .type_id = type_id_LDKType_jcall,
4550 .debug_str = debug_str_LDKType_jcall,
4551 .write = write_LDKType_jcall,
4552 .cloned = LDKType_JCalls_cloned,
4553 .free = LDKType_JCalls_free,
4557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
4558 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
4559 *res_ptr = LDKType_init(env, clz, o);
4560 return (uint64_t)res_ptr;
4562 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4563 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4564 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
4568 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
4569 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4570 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
4571 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
4576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4577 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4578 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4579 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4580 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4581 CVec_u8Z_free(ret_var);
4585 static jclass LDKCOption_TypeZ_Some_class = NULL;
4586 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
4587 static jclass LDKCOption_TypeZ_None_class = NULL;
4588 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
4589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
4590 LDKCOption_TypeZ_Some_class =
4591 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
4592 CHECK(LDKCOption_TypeZ_Some_class != NULL);
4593 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
4594 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
4595 LDKCOption_TypeZ_None_class =
4596 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
4597 CHECK(LDKCOption_TypeZ_None_class != NULL);
4598 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
4599 CHECK(LDKCOption_TypeZ_None_meth != NULL);
4601 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4602 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
4604 case LDKCOption_TypeZ_Some: {
4605 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
4606 *some_ret = Type_clone(&obj->some);
4607 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
4609 case LDKCOption_TypeZ_None: {
4610 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
4615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4616 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
4618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4619 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4620 CHECK(val->result_ok);
4621 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4625 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4626 CHECK(!val->result_ok);
4627 LDKDecodeError err_var = (*val->contents.err);
4628 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4629 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4630 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4634 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4636 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4637 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4638 CHECK(val->result_ok);
4639 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4643 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4644 CHECK(!val->result_ok);
4645 return *val->contents.err;
4647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4648 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4651 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4652 CHECK(val->result_ok);
4653 LDKInvoice res_var = (*val->contents.result);
4654 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4655 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4656 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4660 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4661 CHECK(!val->result_ok);
4662 return *val->contents.err;
4664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4665 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4668 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4669 CHECK(val->result_ok);
4670 LDKSignedRawInvoice res_var = (*val->contents.result);
4671 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4672 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4673 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4677 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4678 CHECK(!val->result_ok);
4679 return *val->contents.err;
4681 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) {
4682 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4683 LDKRawInvoice a_conv;
4684 a_conv.inner = (void*)(a & (~1));
4685 a_conv.is_owned = (a & 1) || (a == 0);
4686 a_conv = RawInvoice_clone(&a_conv);
4688 LDKThirtyTwoBytes b_ref;
4689 CHECK((*env)->GetArrayLength(env, b) == 32);
4690 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4692 LDKInvoiceSignature c_conv;
4693 c_conv.inner = (void*)(c & (~1));
4694 c_conv.is_owned = (c & 1) || (c == 0);
4695 c_conv = InvoiceSignature_clone(&c_conv);
4697 return (uint64_t)ret;
4699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4700 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4701 LDKRawInvoice a_var = tuple->a;
4702 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4703 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4704 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4708 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4709 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4710 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4714 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4715 LDKInvoiceSignature c_var = tuple->c;
4716 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4717 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4718 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4722 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4725 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4726 CHECK(val->result_ok);
4727 LDKPayeePubKey res_var = (*val->contents.result);
4728 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4729 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4730 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4733 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4734 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4735 CHECK(!val->result_ok);
4736 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4740 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4741 ret->datalen = (*env)->GetArrayLength(env, elems);
4742 if (ret->datalen == 0) {
4745 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4746 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4747 for (size_t i = 0; i < ret->datalen; i++) {
4748 int64_t arr_elem = java_elems[i];
4749 LDKPrivateRoute arr_elem_conv;
4750 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4751 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4752 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4753 ret->data[i] = arr_elem_conv;
4755 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4757 return (uint64_t)ret;
4759 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4760 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4761 for (size_t i = 0; i < ret.datalen; i++) {
4762 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4767 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4770 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4771 CHECK(val->result_ok);
4772 LDKPositiveTimestamp res_var = (*val->contents.result);
4773 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4774 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4775 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4778 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4779 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4780 CHECK(!val->result_ok);
4781 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4785 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4788 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4789 CHECK(val->result_ok);
4790 return *val->contents.result;
4792 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4793 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4794 CHECK(!val->result_ok);
4795 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4799 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4802 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4803 CHECK(val->result_ok);
4804 LDKInvoice 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_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4811 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4812 CHECK(!val->result_ok);
4813 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4817 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4820 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4821 CHECK(val->result_ok);
4822 LDKDescription res_var = (*val->contents.result);
4823 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4824 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4825 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4828 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4829 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4830 CHECK(!val->result_ok);
4831 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4835 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4838 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4839 CHECK(val->result_ok);
4840 LDKExpiryTime res_var = (*val->contents.result);
4841 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4842 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4843 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4846 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4847 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4848 CHECK(!val->result_ok);
4849 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4853 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4856 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4857 CHECK(val->result_ok);
4858 LDKPrivateRoute res_var = (*val->contents.result);
4859 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4860 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4861 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4864 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4865 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4866 CHECK(!val->result_ok);
4867 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4871 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4873 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4874 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4875 CHECK(val->result_ok);
4876 LDKStr res_str = (*val->contents.result);
4877 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4880 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4881 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4882 CHECK(!val->result_ok);
4883 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4887 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4890 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4891 CHECK(val->result_ok);
4892 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4893 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4894 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4895 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4899 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4900 CHECK(!val->result_ok);
4901 LDKDecodeError err_var = (*val->contents.err);
4902 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4903 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4904 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4908 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4911 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4912 CHECK(val->result_ok);
4913 LDKHTLCUpdate res_var = (*val->contents.result);
4914 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4915 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4916 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4920 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4921 CHECK(!val->result_ok);
4922 LDKDecodeError err_var = (*val->contents.err);
4923 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4924 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4925 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4929 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4932 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4933 CHECK(val->result_ok);
4934 return *val->contents.result;
4936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4937 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4938 CHECK(!val->result_ok);
4939 LDKMonitorUpdateError err_var = (*val->contents.err);
4940 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4941 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4942 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4946 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4948 a_conv.inner = (void*)(a & (~1));
4949 a_conv.is_owned = (a & 1) || (a == 0);
4950 a_conv = OutPoint_clone(&a_conv);
4953 b_ref.datalen = (*env)->GetArrayLength(env, b);
4954 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4955 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4957 return (uint64_t)ret;
4959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4960 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4961 LDKOutPoint a_var = tuple->a;
4962 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4963 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4964 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4968 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4969 LDKCVec_u8Z b_var = tuple->b;
4970 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4971 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4975 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4978 b_ref.datalen = (*env)->GetArrayLength(env, b);
4979 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4980 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4982 return (uint64_t)ret;
4984 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4985 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4989 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4990 LDKCVec_u8Z b_var = tuple->b;
4991 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4992 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4996 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4997 ret->datalen = (*env)->GetArrayLength(env, elems);
4998 if (ret->datalen == 0) {
5001 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
5002 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5003 for (size_t i = 0; i < ret->datalen; i++) {
5004 int64_t arr_elem = java_elems[i];
5005 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
5006 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
5007 ret->data[i] = arr_elem_conv;
5009 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5011 return (uint64_t)ret;
5013 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5014 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5015 for (size_t i = 0; i < ret.datalen; i++) {
5016 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5021 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
5022 LDKThirtyTwoBytes a_ref;
5023 CHECK((*env)->GetArrayLength(env, a) == 32);
5024 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5026 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
5027 b_constr.datalen = (*env)->GetArrayLength(env, b);
5028 if (b_constr.datalen > 0)
5029 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
5031 b_constr.data = NULL;
5032 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5033 for (size_t b = 0; b < b_constr.datalen; b++) {
5034 int64_t b_conv_27 = b_vals[b];
5035 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
5036 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
5037 b_constr.data[b] = b_conv_27_conv;
5039 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5041 return (uint64_t)ret;
5043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5044 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
5045 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
5046 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
5049 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5050 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
5051 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
5052 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
5053 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
5054 for (size_t b = 0; b < b_var.datalen; b++) {
5055 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
5056 b_arr_ptr[b] = b_conv_27_ref;
5058 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
5061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5062 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
5063 ret->datalen = (*env)->GetArrayLength(env, elems);
5064 if (ret->datalen == 0) {
5067 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
5068 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5069 for (size_t i = 0; i < ret->datalen; i++) {
5070 int64_t arr_elem = java_elems[i];
5071 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
5072 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
5073 ret->data[i] = arr_elem_conv;
5075 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5077 return (uint64_t)ret;
5079 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5080 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 };
5081 for (size_t i = 0; i < ret.datalen; i++) {
5082 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5086 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
5087 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
5088 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
5089 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
5090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
5091 LDKPaymentPurpose_InvoicePayment_class =
5092 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
5093 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
5094 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
5095 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
5096 LDKPaymentPurpose_SpontaneousPayment_class =
5097 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
5098 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
5099 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
5100 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
5102 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5103 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
5105 case LDKPaymentPurpose_InvoicePayment: {
5106 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5107 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
5108 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
5109 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
5110 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
5112 case LDKPaymentPurpose_SpontaneousPayment: {
5113 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
5114 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
5115 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
5120 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5121 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5122 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5123 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5124 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
5125 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
5126 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5127 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5128 static jclass LDKClosureReason_ProcessingError_class = NULL;
5129 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5130 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5131 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5132 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5133 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5135 LDKClosureReason_CounterpartyForceClosed_class =
5136 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
5137 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5138 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
5139 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5140 LDKClosureReason_HolderForceClosed_class =
5141 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
5142 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5143 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5144 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5145 LDKClosureReason_CooperativeClosure_class =
5146 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
5147 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
5148 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
5149 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
5150 LDKClosureReason_CommitmentTxConfirmed_class =
5151 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
5152 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5153 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5154 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5155 LDKClosureReason_ProcessingError_class =
5156 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
5157 CHECK(LDKClosureReason_ProcessingError_class != NULL);
5158 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5159 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5160 LDKClosureReason_DisconnectedPeer_class =
5161 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
5162 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5163 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5164 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5165 LDKClosureReason_OutdatedChannelManager_class =
5166 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
5167 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5168 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5169 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5171 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5172 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
5174 case LDKClosureReason_CounterpartyForceClosed: {
5175 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
5176 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
5177 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
5179 case LDKClosureReason_HolderForceClosed: {
5180 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5182 case LDKClosureReason_CooperativeClosure: {
5183 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
5185 case LDKClosureReason_CommitmentTxConfirmed: {
5186 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5188 case LDKClosureReason_ProcessingError: {
5189 LDKStr err_str = obj->processing_error.err;
5190 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5191 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5193 case LDKClosureReason_DisconnectedPeer: {
5194 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5196 case LDKClosureReason_OutdatedChannelManager: {
5197 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5202 static jclass LDKEvent_FundingGenerationReady_class = NULL;
5203 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
5204 static jclass LDKEvent_PaymentReceived_class = NULL;
5205 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
5206 static jclass LDKEvent_PaymentSent_class = NULL;
5207 static jmethodID LDKEvent_PaymentSent_meth = NULL;
5208 static jclass LDKEvent_PaymentPathFailed_class = NULL;
5209 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
5210 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
5211 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
5212 static jclass LDKEvent_SpendableOutputs_class = NULL;
5213 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
5214 static jclass LDKEvent_PaymentForwarded_class = NULL;
5215 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
5216 static jclass LDKEvent_ChannelClosed_class = NULL;
5217 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
5218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
5219 LDKEvent_FundingGenerationReady_class =
5220 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
5221 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
5222 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
5223 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
5224 LDKEvent_PaymentReceived_class =
5225 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
5226 CHECK(LDKEvent_PaymentReceived_class != NULL);
5227 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
5228 CHECK(LDKEvent_PaymentReceived_meth != NULL);
5229 LDKEvent_PaymentSent_class =
5230 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
5231 CHECK(LDKEvent_PaymentSent_class != NULL);
5232 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
5233 CHECK(LDKEvent_PaymentSent_meth != NULL);
5234 LDKEvent_PaymentPathFailed_class =
5235 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
5236 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
5237 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([BZJZ[J)V");
5238 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
5239 LDKEvent_PendingHTLCsForwardable_class =
5240 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
5241 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
5242 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
5243 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
5244 LDKEvent_SpendableOutputs_class =
5245 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
5246 CHECK(LDKEvent_SpendableOutputs_class != NULL);
5247 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
5248 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
5249 LDKEvent_PaymentForwarded_class =
5250 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
5251 CHECK(LDKEvent_PaymentForwarded_class != NULL);
5252 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
5253 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
5254 LDKEvent_ChannelClosed_class =
5255 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
5256 CHECK(LDKEvent_ChannelClosed_class != NULL);
5257 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJ)V");
5258 CHECK(LDKEvent_ChannelClosed_meth != NULL);
5260 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5261 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
5263 case LDKEvent_FundingGenerationReady: {
5264 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
5265 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
5266 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
5267 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
5268 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
5269 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);
5271 case LDKEvent_PaymentReceived: {
5272 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5273 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
5274 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
5275 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
5277 case LDKEvent_PaymentSent: {
5278 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5279 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
5280 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
5282 case LDKEvent_PaymentPathFailed: {
5283 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5284 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
5285 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
5286 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
5287 int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen);
5288 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
5289 for (size_t k = 0; k < path_var.datalen; k++) {
5290 LDKRouteHop path_conv_10_var = path_var.data[k];
5291 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5292 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5293 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
5294 path_arr_ptr[k] = path_conv_10_ref;
5296 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
5297 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);
5299 case LDKEvent_PendingHTLCsForwardable: {
5300 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
5302 case LDKEvent_SpendableOutputs: {
5303 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
5304 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
5305 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
5306 for (size_t b = 0; b < outputs_var.datalen; b++) {
5307 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
5308 outputs_arr_ptr[b] = outputs_conv_27_ref;
5310 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
5311 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
5313 case LDKEvent_PaymentForwarded: {
5314 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
5315 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
5317 case LDKEvent_ChannelClosed: {
5318 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5319 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
5320 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
5321 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, reason_ref);
5326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5327 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5328 ret->datalen = (*env)->GetArrayLength(env, elems);
5329 if (ret->datalen == 0) {
5332 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
5333 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5334 for (size_t i = 0; i < ret->datalen; i++) {
5335 int64_t arr_elem = java_elems[i];
5336 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
5337 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
5338 ret->data[i] = arr_elem_conv;
5340 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5342 return (uint64_t)ret;
5344 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5345 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5346 for (size_t i = 0; i < ret.datalen; i++) {
5347 ret.data[i] = Event_clone(&orig->data[i]);
5351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5352 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5354 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
5355 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
5357 return (uint64_t)ret;
5359 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5360 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
5363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5364 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
5365 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
5366 return (uint64_t)b_ref;
5368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5369 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
5370 ret->datalen = (*env)->GetArrayLength(env, elems);
5371 if (ret->datalen == 0) {
5374 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
5375 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5376 for (size_t i = 0; i < ret->datalen; i++) {
5377 int64_t arr_elem = java_elems[i];
5378 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
5379 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
5380 ret->data[i] = arr_elem_conv;
5382 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5384 return (uint64_t)ret;
5386 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5387 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5388 for (size_t i = 0; i < ret.datalen; i++) {
5389 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5394 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5395 LDKThirtyTwoBytes a_ref;
5396 CHECK((*env)->GetArrayLength(env, a) == 32);
5397 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5399 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5400 b_constr.datalen = (*env)->GetArrayLength(env, b);
5401 if (b_constr.datalen > 0)
5402 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5404 b_constr.data = NULL;
5405 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5406 for (size_t a = 0; a < b_constr.datalen; a++) {
5407 int64_t b_conv_26 = b_vals[a];
5408 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
5409 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
5410 b_constr.data[a] = b_conv_26_conv;
5412 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5414 return (uint64_t)ret;
5416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5417 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
5418 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
5419 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
5422 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5423 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
5424 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
5425 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
5426 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
5427 for (size_t a = 0; a < b_var.datalen; a++) {
5428 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
5429 b_arr_ptr[a] = b_conv_26_ref;
5431 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
5434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5435 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
5436 ret->datalen = (*env)->GetArrayLength(env, elems);
5437 if (ret->datalen == 0) {
5440 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
5441 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5442 for (size_t i = 0; i < ret->datalen; i++) {
5443 int64_t arr_elem = java_elems[i];
5444 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
5445 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
5446 ret->data[i] = arr_elem_conv;
5448 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5450 return (uint64_t)ret;
5452 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5453 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 };
5454 for (size_t i = 0; i < ret.datalen; i++) {
5455 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5459 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
5460 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
5461 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
5462 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
5463 static jclass LDKBalance_ContentiousClaimable_class = NULL;
5464 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
5465 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
5466 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
5467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
5468 LDKBalance_ClaimableOnChannelClose_class =
5469 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
5470 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
5471 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
5472 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
5473 LDKBalance_ClaimableAwaitingConfirmations_class =
5474 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
5475 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
5476 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
5477 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
5478 LDKBalance_ContentiousClaimable_class =
5479 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
5480 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
5481 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
5482 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
5483 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
5484 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
5485 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
5486 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
5487 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
5489 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5490 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5492 case LDKBalance_ClaimableOnChannelClose: {
5493 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
5495 case LDKBalance_ClaimableAwaitingConfirmations: {
5496 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
5498 case LDKBalance_ContentiousClaimable: {
5499 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
5501 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
5502 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);
5507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5508 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
5509 ret->datalen = (*env)->GetArrayLength(env, elems);
5510 if (ret->datalen == 0) {
5513 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
5514 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5515 for (size_t i = 0; i < ret->datalen; i++) {
5516 int64_t arr_elem = java_elems[i];
5517 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
5518 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
5519 ret->data[i] = arr_elem_conv;
5521 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5523 return (uint64_t)ret;
5525 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
5526 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
5527 for (size_t i = 0; i < ret.datalen; i++) {
5528 ret.data[i] = Balance_clone(&orig->data[i]);
5532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5533 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5536 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5537 CHECK(val->result_ok);
5538 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
5541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5542 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5543 CHECK(!val->result_ok);
5544 LDKDecodeError err_var = (*val->contents.err);
5545 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5546 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5547 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5551 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5554 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5555 CHECK(val->result_ok);
5556 return *val->contents.result;
5558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5559 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5560 CHECK(!val->result_ok);
5561 LDKLightningError err_var = (*val->contents.err);
5562 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5563 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5564 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5568 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
5570 CHECK((*env)->GetArrayLength(env, a) == 33);
5571 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
5573 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
5574 b_conv = Type_clone(&b_conv);
5576 return (uint64_t)ret;
5578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5579 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
5580 int8_tArray a_arr = (*env)->NewByteArray(env, 33);
5581 (*env)->SetByteArrayRegion(env, a_arr, 0, 33, tuple->a.compressed_form);
5584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5585 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
5586 LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
5587 *b_ret = Type_clone(&tuple->b);
5588 return (uint64_t)b_ret;
5590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5591 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
5592 ret->datalen = (*env)->GetArrayLength(env, elems);
5593 if (ret->datalen == 0) {
5596 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
5597 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5598 for (size_t i = 0; i < ret->datalen; i++) {
5599 int64_t arr_elem = java_elems[i];
5600 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
5601 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
5602 ret->data[i] = arr_elem_conv;
5604 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5606 return (uint64_t)ret;
5608 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
5609 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
5610 for (size_t i = 0; i < ret.datalen; i++) {
5611 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
5615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5616 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5619 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5620 CHECK(val->result_ok);
5621 return *val->contents.result;
5623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5624 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5625 CHECK(!val->result_ok);
5626 LDKLightningError err_var = (*val->contents.err);
5627 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5628 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5629 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5632 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) {
5633 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5634 LDKChannelAnnouncement a_conv;
5635 a_conv.inner = (void*)(a & (~1));
5636 a_conv.is_owned = (a & 1) || (a == 0);
5637 a_conv = ChannelAnnouncement_clone(&a_conv);
5639 LDKChannelUpdate b_conv;
5640 b_conv.inner = (void*)(b & (~1));
5641 b_conv.is_owned = (b & 1) || (b == 0);
5642 b_conv = ChannelUpdate_clone(&b_conv);
5644 LDKChannelUpdate c_conv;
5645 c_conv.inner = (void*)(c & (~1));
5646 c_conv.is_owned = (c & 1) || (c == 0);
5647 c_conv = ChannelUpdate_clone(&c_conv);
5649 return (uint64_t)ret;
5651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5652 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5653 LDKChannelAnnouncement a_var = tuple->a;
5654 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5655 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5656 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
5659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5660 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5661 LDKChannelUpdate b_var = tuple->b;
5662 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5663 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5664 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
5667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
5668 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5669 LDKChannelUpdate c_var = tuple->c;
5670 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5671 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5672 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
5675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5676 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5677 ret->datalen = (*env)->GetArrayLength(env, elems);
5678 if (ret->datalen == 0) {
5681 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5682 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5683 for (size_t i = 0; i < ret->datalen; i++) {
5684 int64_t arr_elem = java_elems[i];
5685 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
5686 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5687 ret->data[i] = arr_elem_conv;
5689 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5691 return (uint64_t)ret;
5693 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5694 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5695 for (size_t i = 0; i < ret.datalen; i++) {
5696 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5701 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5702 ret->datalen = (*env)->GetArrayLength(env, elems);
5703 if (ret->datalen == 0) {
5706 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5707 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5708 for (size_t i = 0; i < ret->datalen; i++) {
5709 int64_t arr_elem = java_elems[i];
5710 LDKNodeAnnouncement arr_elem_conv;
5711 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5712 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5713 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5714 ret->data[i] = arr_elem_conv;
5716 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5718 return (uint64_t)ret;
5720 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5721 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5722 for (size_t i = 0; i < ret.datalen; i++) {
5723 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5728 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
5730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5731 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5732 CHECK(val->result_ok);
5733 LDKCVec_u8Z res_var = (*val->contents.result);
5734 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
5735 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
5738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5739 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5740 CHECK(!val->result_ok);
5741 LDKPeerHandleError err_var = (*val->contents.err);
5742 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5743 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5744 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5748 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5751 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5752 CHECK(val->result_ok);
5753 return *val->contents.result;
5755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5756 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5757 CHECK(!val->result_ok);
5758 LDKPeerHandleError err_var = (*val->contents.err);
5759 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5760 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5761 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5765 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5768 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5769 CHECK(val->result_ok);
5770 return *val->contents.result;
5772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5773 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5774 CHECK(!val->result_ok);
5775 LDKPeerHandleError err_var = (*val->contents.err);
5776 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5777 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5778 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5781 typedef struct LDKAccess_JCalls {
5782 atomic_size_t refcnt;
5785 jmethodID get_utxo_meth;
5787 static void LDKAccess_JCalls_free(void* this_arg) {
5788 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
5789 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5791 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5792 if (get_jenv_res == JNI_EDETACHED) {
5793 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5795 DO_ASSERT(get_jenv_res == JNI_OK);
5797 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5798 if (get_jenv_res == JNI_EDETACHED) {
5799 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5804 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5805 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
5807 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5808 if (get_jenv_res == JNI_EDETACHED) {
5809 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5811 DO_ASSERT(get_jenv_res == JNI_OK);
5813 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
5814 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
5815 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5817 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
5818 if ((*env)->ExceptionCheck(env)) {
5819 (*env)->ExceptionDescribe(env);
5820 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
5822 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
5823 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
5824 if (get_jenv_res == JNI_EDETACHED) {
5825 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5829 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
5830 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
5831 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5833 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
5834 jclass c = (*env)->GetObjectClass(env, o);
5836 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
5837 atomic_init(&calls->refcnt, 1);
5838 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5839 calls->o = (*env)->NewWeakGlobalRef(env, o);
5840 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5841 CHECK(calls->get_utxo_meth != NULL);
5844 .this_arg = (void*) calls,
5845 .get_utxo = get_utxo_LDKAccess_jcall,
5846 .free = LDKAccess_JCalls_free,
5850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
5851 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
5852 *res_ptr = LDKAccess_init(env, clz, o);
5853 return (uint64_t)res_ptr;
5855 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) {
5856 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
5857 unsigned char genesis_hash_arr[32];
5858 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
5859 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
5860 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
5861 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5862 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5863 return (uint64_t)ret_conv;
5866 static jclass LDKCOption_AccessZ_Some_class = NULL;
5867 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
5868 static jclass LDKCOption_AccessZ_None_class = NULL;
5869 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
5870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
5871 LDKCOption_AccessZ_Some_class =
5872 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
5873 CHECK(LDKCOption_AccessZ_Some_class != NULL);
5874 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
5875 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
5876 LDKCOption_AccessZ_None_class =
5877 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
5878 CHECK(LDKCOption_AccessZ_None_class != NULL);
5879 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
5880 CHECK(LDKCOption_AccessZ_None_meth != NULL);
5882 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5883 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
5885 case LDKCOption_AccessZ_Some: {
5886 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
5887 *some_ret = obj->some;
5888 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5889 if ((*some_ret).free == LDKAccess_JCalls_free) {
5890 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5891 LDKAccess_JCalls_cloned(&(*some_ret));
5893 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
5895 case LDKCOption_AccessZ_None: {
5896 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
5901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5902 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
5904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5905 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5906 CHECK(val->result_ok);
5907 LDKDirectionalChannelInfo res_var = (*val->contents.result);
5908 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5909 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5910 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5914 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5915 CHECK(!val->result_ok);
5916 LDKDecodeError err_var = (*val->contents.err);
5917 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5918 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5919 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5923 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
5925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5926 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5927 CHECK(val->result_ok);
5928 LDKChannelInfo res_var = (*val->contents.result);
5929 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5930 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5931 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5935 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5936 CHECK(!val->result_ok);
5937 LDKDecodeError err_var = (*val->contents.err);
5938 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5939 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5940 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5944 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
5946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5947 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5948 CHECK(val->result_ok);
5949 LDKRoutingFees res_var = (*val->contents.result);
5950 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5951 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5952 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5956 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5957 CHECK(!val->result_ok);
5958 LDKDecodeError err_var = (*val->contents.err);
5959 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5960 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5961 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5965 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
5967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5968 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5969 CHECK(val->result_ok);
5970 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5971 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5972 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5973 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5977 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5978 CHECK(!val->result_ok);
5979 LDKDecodeError err_var = (*val->contents.err);
5980 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5981 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5982 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5986 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5987 ret->datalen = (*env)->GetArrayLength(env, elems);
5988 if (ret->datalen == 0) {
5991 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5992 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5993 for (size_t i = 0; i < ret->datalen; i++) {
5994 ret->data[i] = java_elems[i];
5996 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5998 return (uint64_t)ret;
6000 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6001 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6002 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6006 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
6008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6009 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6010 CHECK(val->result_ok);
6011 LDKNodeInfo res_var = (*val->contents.result);
6012 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6013 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6014 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6018 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6019 CHECK(!val->result_ok);
6020 LDKDecodeError err_var = (*val->contents.err);
6021 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6022 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6023 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6027 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
6029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6030 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6031 CHECK(val->result_ok);
6032 LDKNetworkGraph res_var = (*val->contents.result);
6033 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6034 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6035 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6039 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6040 CHECK(!val->result_ok);
6041 LDKDecodeError err_var = (*val->contents.err);
6042 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6043 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6044 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6048 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
6050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6051 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6052 CHECK(val->result_ok);
6053 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6056 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6057 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6058 CHECK(!val->result_ok);
6059 return *val->contents.err;
6061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6062 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
6064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6065 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6066 CHECK(val->result_ok);
6067 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6068 *res_conv = (*val->contents.result);
6069 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
6070 return (uint64_t)res_conv;
6072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6073 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6074 CHECK(!val->result_ok);
6075 LDKDecodeError err_var = (*val->contents.err);
6076 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6077 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6078 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6082 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
6084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6085 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6086 CHECK(val->result_ok);
6087 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6091 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6092 CHECK(!val->result_ok);
6093 LDKDecodeError err_var = (*val->contents.err);
6094 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6095 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6096 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6100 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
6101 ret->datalen = (*env)->GetArrayLength(env, elems);
6102 if (ret->datalen == 0) {
6105 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
6106 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6107 for (size_t i = 0; i < ret->datalen; i++) {
6108 int64_t arr_elem = java_elems[i];
6109 LDKUpdateAddHTLC arr_elem_conv;
6110 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6111 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6112 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
6113 ret->data[i] = arr_elem_conv;
6115 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6117 return (uint64_t)ret;
6119 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6120 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6121 for (size_t i = 0; i < ret.datalen; i++) {
6122 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6127 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
6128 ret->datalen = (*env)->GetArrayLength(env, elems);
6129 if (ret->datalen == 0) {
6132 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
6133 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6134 for (size_t i = 0; i < ret->datalen; i++) {
6135 int64_t arr_elem = java_elems[i];
6136 LDKUpdateFulfillHTLC arr_elem_conv;
6137 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6138 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6139 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
6140 ret->data[i] = arr_elem_conv;
6142 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6144 return (uint64_t)ret;
6146 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6147 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6148 for (size_t i = 0; i < ret.datalen; i++) {
6149 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6154 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
6155 ret->datalen = (*env)->GetArrayLength(env, elems);
6156 if (ret->datalen == 0) {
6159 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
6160 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6161 for (size_t i = 0; i < ret->datalen; i++) {
6162 int64_t arr_elem = java_elems[i];
6163 LDKUpdateFailHTLC arr_elem_conv;
6164 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6165 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6166 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
6167 ret->data[i] = arr_elem_conv;
6169 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6171 return (uint64_t)ret;
6173 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6174 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6175 for (size_t i = 0; i < ret.datalen; i++) {
6176 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6181 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
6182 ret->datalen = (*env)->GetArrayLength(env, elems);
6183 if (ret->datalen == 0) {
6186 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
6187 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6188 for (size_t i = 0; i < ret->datalen; i++) {
6189 int64_t arr_elem = java_elems[i];
6190 LDKUpdateFailMalformedHTLC arr_elem_conv;
6191 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6192 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6193 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
6194 ret->data[i] = arr_elem_conv;
6196 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6198 return (uint64_t)ret;
6200 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6201 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6202 for (size_t i = 0; i < ret.datalen; i++) {
6203 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6208 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
6210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6211 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6212 CHECK(val->result_ok);
6213 LDKAcceptChannel res_var = (*val->contents.result);
6214 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6215 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6216 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6220 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6221 CHECK(!val->result_ok);
6222 LDKDecodeError err_var = (*val->contents.err);
6223 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6224 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6225 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6229 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
6231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6232 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6233 CHECK(val->result_ok);
6234 LDKAnnouncementSignatures res_var = (*val->contents.result);
6235 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6236 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6237 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6241 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6242 CHECK(!val->result_ok);
6243 LDKDecodeError err_var = (*val->contents.err);
6244 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6245 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6246 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6250 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
6252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6253 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6254 CHECK(val->result_ok);
6255 LDKChannelReestablish res_var = (*val->contents.result);
6256 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6257 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6258 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6262 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6263 CHECK(!val->result_ok);
6264 LDKDecodeError err_var = (*val->contents.err);
6265 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6266 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6267 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6271 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
6273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6274 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6275 CHECK(val->result_ok);
6276 LDKClosingSigned res_var = (*val->contents.result);
6277 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6278 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6279 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6283 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6284 CHECK(!val->result_ok);
6285 LDKDecodeError err_var = (*val->contents.err);
6286 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6287 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6288 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6292 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
6294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6295 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6296 CHECK(val->result_ok);
6297 LDKClosingSignedFeeRange res_var = (*val->contents.result);
6298 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6299 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6300 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6304 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6305 CHECK(!val->result_ok);
6306 LDKDecodeError err_var = (*val->contents.err);
6307 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6308 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6309 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6313 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
6315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6316 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6317 CHECK(val->result_ok);
6318 LDKCommitmentSigned res_var = (*val->contents.result);
6319 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6320 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6321 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6325 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6326 CHECK(!val->result_ok);
6327 LDKDecodeError err_var = (*val->contents.err);
6328 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6329 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6330 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6334 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
6336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6337 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6338 CHECK(val->result_ok);
6339 LDKFundingCreated res_var = (*val->contents.result);
6340 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6341 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6342 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6346 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6347 CHECK(!val->result_ok);
6348 LDKDecodeError err_var = (*val->contents.err);
6349 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6350 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6351 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6355 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
6357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6358 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6359 CHECK(val->result_ok);
6360 LDKFundingSigned res_var = (*val->contents.result);
6361 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6362 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6363 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6367 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6368 CHECK(!val->result_ok);
6369 LDKDecodeError err_var = (*val->contents.err);
6370 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6371 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6372 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6375 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6376 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
6378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6379 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6380 CHECK(val->result_ok);
6381 LDKFundingLocked res_var = (*val->contents.result);
6382 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6383 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6384 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6388 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6389 CHECK(!val->result_ok);
6390 LDKDecodeError err_var = (*val->contents.err);
6391 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6392 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6393 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6397 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
6399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6400 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6401 CHECK(val->result_ok);
6402 LDKInit res_var = (*val->contents.result);
6403 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6404 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6405 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6409 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6410 CHECK(!val->result_ok);
6411 LDKDecodeError err_var = (*val->contents.err);
6412 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6413 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6414 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6418 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
6420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6421 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6422 CHECK(val->result_ok);
6423 LDKOpenChannel res_var = (*val->contents.result);
6424 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6425 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6426 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6430 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6431 CHECK(!val->result_ok);
6432 LDKDecodeError err_var = (*val->contents.err);
6433 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6434 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6435 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6439 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
6441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6442 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6443 CHECK(val->result_ok);
6444 LDKRevokeAndACK res_var = (*val->contents.result);
6445 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6446 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6447 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6451 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6452 CHECK(!val->result_ok);
6453 LDKDecodeError err_var = (*val->contents.err);
6454 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6455 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6456 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6460 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
6462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6463 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6464 CHECK(val->result_ok);
6465 LDKShutdown res_var = (*val->contents.result);
6466 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6467 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6468 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6472 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6473 CHECK(!val->result_ok);
6474 LDKDecodeError err_var = (*val->contents.err);
6475 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6476 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6477 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6481 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
6483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6484 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6485 CHECK(val->result_ok);
6486 LDKUpdateFailHTLC res_var = (*val->contents.result);
6487 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6488 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6489 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6493 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6494 CHECK(!val->result_ok);
6495 LDKDecodeError err_var = (*val->contents.err);
6496 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6497 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6498 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6502 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
6504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6505 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6506 CHECK(val->result_ok);
6507 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
6508 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6509 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6510 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6514 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6515 CHECK(!val->result_ok);
6516 LDKDecodeError err_var = (*val->contents.err);
6517 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6518 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6519 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6523 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
6525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6526 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6527 CHECK(val->result_ok);
6528 LDKUpdateFee res_var = (*val->contents.result);
6529 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6530 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6531 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6535 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6536 CHECK(!val->result_ok);
6537 LDKDecodeError err_var = (*val->contents.err);
6538 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6539 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6540 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6544 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
6546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6547 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6548 CHECK(val->result_ok);
6549 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
6550 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6551 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6552 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6556 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6557 CHECK(!val->result_ok);
6558 LDKDecodeError err_var = (*val->contents.err);
6559 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6560 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6561 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6564 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6565 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
6567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6568 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6569 CHECK(val->result_ok);
6570 LDKUpdateAddHTLC res_var = (*val->contents.result);
6571 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6572 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6573 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6577 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6578 CHECK(!val->result_ok);
6579 LDKDecodeError err_var = (*val->contents.err);
6580 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6581 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6582 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6586 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
6588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6589 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6590 CHECK(val->result_ok);
6591 LDKPing res_var = (*val->contents.result);
6592 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6593 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6594 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6598 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6599 CHECK(!val->result_ok);
6600 LDKDecodeError err_var = (*val->contents.err);
6601 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6602 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6603 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6607 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
6609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6610 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6611 CHECK(val->result_ok);
6612 LDKPong res_var = (*val->contents.result);
6613 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6614 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6615 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6619 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6620 CHECK(!val->result_ok);
6621 LDKDecodeError err_var = (*val->contents.err);
6622 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6623 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6624 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6628 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6631 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6632 CHECK(val->result_ok);
6633 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
6634 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6635 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6636 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6640 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6641 CHECK(!val->result_ok);
6642 LDKDecodeError err_var = (*val->contents.err);
6643 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6644 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6645 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6649 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6652 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6653 CHECK(val->result_ok);
6654 LDKChannelAnnouncement res_var = (*val->contents.result);
6655 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6656 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6657 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6661 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6662 CHECK(!val->result_ok);
6663 LDKDecodeError err_var = (*val->contents.err);
6664 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6665 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6666 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6670 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
6672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6673 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6674 CHECK(val->result_ok);
6675 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
6676 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6677 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6678 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6682 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6683 CHECK(!val->result_ok);
6684 LDKDecodeError err_var = (*val->contents.err);
6685 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6686 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6687 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6691 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
6693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6694 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6695 CHECK(val->result_ok);
6696 LDKChannelUpdate res_var = (*val->contents.result);
6697 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6698 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6699 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6703 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6704 CHECK(!val->result_ok);
6705 LDKDecodeError err_var = (*val->contents.err);
6706 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6707 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6708 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6712 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
6714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6715 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6716 CHECK(val->result_ok);
6717 LDKErrorMessage res_var = (*val->contents.result);
6718 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6719 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6720 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6724 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6725 CHECK(!val->result_ok);
6726 LDKDecodeError err_var = (*val->contents.err);
6727 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6728 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6729 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6733 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6736 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6737 CHECK(val->result_ok);
6738 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
6739 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6740 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6741 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6745 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6746 CHECK(!val->result_ok);
6747 LDKDecodeError err_var = (*val->contents.err);
6748 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6749 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6750 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6754 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6757 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6758 CHECK(val->result_ok);
6759 LDKNodeAnnouncement res_var = (*val->contents.result);
6760 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6761 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6762 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6766 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6767 CHECK(!val->result_ok);
6768 LDKDecodeError err_var = (*val->contents.err);
6769 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6770 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6771 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6775 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
6777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6778 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6779 CHECK(val->result_ok);
6780 LDKQueryShortChannelIds res_var = (*val->contents.result);
6781 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6782 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6783 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6787 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6788 CHECK(!val->result_ok);
6789 LDKDecodeError err_var = (*val->contents.err);
6790 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6791 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6792 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6796 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
6798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6799 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6800 CHECK(val->result_ok);
6801 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
6802 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6803 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6804 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6808 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6809 CHECK(!val->result_ok);
6810 LDKDecodeError err_var = (*val->contents.err);
6811 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6812 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6813 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6817 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
6819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6820 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6821 CHECK(val->result_ok);
6822 LDKQueryChannelRange res_var = (*val->contents.result);
6823 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6824 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6825 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6829 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6830 CHECK(!val->result_ok);
6831 LDKDecodeError err_var = (*val->contents.err);
6832 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6833 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6834 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6838 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
6840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6841 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6842 CHECK(val->result_ok);
6843 LDKReplyChannelRange res_var = (*val->contents.result);
6844 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6845 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6846 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6850 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6851 CHECK(!val->result_ok);
6852 LDKDecodeError err_var = (*val->contents.err);
6853 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6854 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6855 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6859 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
6861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6862 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6863 CHECK(val->result_ok);
6864 LDKGossipTimestampFilter res_var = (*val->contents.result);
6865 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6866 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6867 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6871 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6872 CHECK(!val->result_ok);
6873 LDKDecodeError err_var = (*val->contents.err);
6874 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6875 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6876 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6879 static jclass LDKSignOrCreationError_SignError_class = NULL;
6880 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
6881 static jclass LDKSignOrCreationError_CreationError_class = NULL;
6882 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
6883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
6884 LDKSignOrCreationError_SignError_class =
6885 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
6886 CHECK(LDKSignOrCreationError_SignError_class != NULL);
6887 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
6888 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
6889 LDKSignOrCreationError_CreationError_class =
6890 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
6891 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
6892 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
6893 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
6895 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6896 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
6898 case LDKSignOrCreationError_SignError: {
6899 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
6901 case LDKSignOrCreationError_CreationError: {
6902 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
6903 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
6908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6909 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
6911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6912 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6913 CHECK(val->result_ok);
6914 LDKInvoice res_var = (*val->contents.result);
6915 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6916 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6917 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6921 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6922 CHECK(!val->result_ok);
6923 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
6926 typedef struct LDKFilter_JCalls {
6927 atomic_size_t refcnt;
6930 jmethodID register_tx_meth;
6931 jmethodID register_output_meth;
6933 static void LDKFilter_JCalls_free(void* this_arg) {
6934 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6935 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6937 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6938 if (get_jenv_res == JNI_EDETACHED) {
6939 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6941 DO_ASSERT(get_jenv_res == JNI_OK);
6943 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6944 if (get_jenv_res == JNI_EDETACHED) {
6945 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6950 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6951 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6953 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6954 if (get_jenv_res == JNI_EDETACHED) {
6955 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6957 DO_ASSERT(get_jenv_res == JNI_OK);
6959 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6960 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6961 LDKu8slice script_pubkey_var = script_pubkey;
6962 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6963 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6964 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6966 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6967 if ((*env)->ExceptionCheck(env)) {
6968 (*env)->ExceptionDescribe(env);
6969 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
6971 if (get_jenv_res == JNI_EDETACHED) {
6972 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6975 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6976 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6978 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6979 if (get_jenv_res == JNI_EDETACHED) {
6980 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6982 DO_ASSERT(get_jenv_res == JNI_OK);
6984 LDKWatchedOutput output_var = output;
6985 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6986 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6987 uint64_t output_ref = (uint64_t)output_var.inner;
6988 if (output_var.is_owned) {
6991 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6993 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6994 if ((*env)->ExceptionCheck(env)) {
6995 (*env)->ExceptionDescribe(env);
6996 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
6998 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6999 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
7000 if (get_jenv_res == JNI_EDETACHED) {
7001 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7005 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7006 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7007 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7009 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7010 jclass c = (*env)->GetObjectClass(env, o);
7012 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7013 atomic_init(&calls->refcnt, 1);
7014 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7015 calls->o = (*env)->NewWeakGlobalRef(env, o);
7016 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7017 CHECK(calls->register_tx_meth != NULL);
7018 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7019 CHECK(calls->register_output_meth != NULL);
7022 .this_arg = (void*) calls,
7023 .register_tx = register_tx_LDKFilter_jcall,
7024 .register_output = register_output_LDKFilter_jcall,
7025 .free = LDKFilter_JCalls_free,
7029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7030 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7031 *res_ptr = LDKFilter_init(env, clz, o);
7032 return (uint64_t)res_ptr;
7034 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) {
7035 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7036 unsigned char txid_arr[32];
7037 CHECK((*env)->GetArrayLength(env, txid) == 32);
7038 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7039 unsigned char (*txid_ref)[32] = &txid_arr;
7040 LDKu8slice script_pubkey_ref;
7041 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7042 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7043 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7044 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7048 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7049 LDKWatchedOutput output_conv;
7050 output_conv.inner = (void*)(output & (~1));
7051 output_conv.is_owned = (output & 1) || (output == 0);
7052 output_conv = WatchedOutput_clone(&output_conv);
7053 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7054 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7055 uint64_t ret_ref = (uint64_t)ret_copy;
7059 static jclass LDKCOption_FilterZ_Some_class = NULL;
7060 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
7061 static jclass LDKCOption_FilterZ_None_class = NULL;
7062 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
7063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
7064 LDKCOption_FilterZ_Some_class =
7065 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
7066 CHECK(LDKCOption_FilterZ_Some_class != NULL);
7067 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
7068 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
7069 LDKCOption_FilterZ_None_class =
7070 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
7071 CHECK(LDKCOption_FilterZ_None_class != NULL);
7072 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
7073 CHECK(LDKCOption_FilterZ_None_meth != NULL);
7075 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7076 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7078 case LDKCOption_FilterZ_Some: {
7079 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
7080 *some_ret = obj->some;
7081 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7082 if ((*some_ret).free == LDKFilter_JCalls_free) {
7083 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7084 LDKFilter_JCalls_cloned(&(*some_ret));
7086 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
7088 case LDKCOption_FilterZ_None: {
7089 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
7094 typedef struct LDKMessageSendEventsProvider_JCalls {
7095 atomic_size_t refcnt;
7098 jmethodID get_and_clear_pending_msg_events_meth;
7099 } LDKMessageSendEventsProvider_JCalls;
7100 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7101 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7102 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7104 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7105 if (get_jenv_res == JNI_EDETACHED) {
7106 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7108 DO_ASSERT(get_jenv_res == JNI_OK);
7110 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7111 if (get_jenv_res == JNI_EDETACHED) {
7112 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7117 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7118 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7120 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7121 if (get_jenv_res == JNI_EDETACHED) {
7122 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7124 DO_ASSERT(get_jenv_res == JNI_OK);
7126 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7128 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
7129 if ((*env)->ExceptionCheck(env)) {
7130 (*env)->ExceptionDescribe(env);
7131 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
7133 LDKCVec_MessageSendEventZ ret_constr;
7134 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7135 if (ret_constr.datalen > 0)
7136 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7138 ret_constr.data = NULL;
7139 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7140 for (size_t s = 0; s < ret_constr.datalen; s++) {
7141 int64_t ret_conv_18 = ret_vals[s];
7142 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
7143 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
7144 ret_constr.data[s] = ret_conv_18_conv;
7146 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7147 if (get_jenv_res == JNI_EDETACHED) {
7148 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7152 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7153 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7154 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7156 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7157 jclass c = (*env)->GetObjectClass(env, o);
7159 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7160 atomic_init(&calls->refcnt, 1);
7161 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7162 calls->o = (*env)->NewWeakGlobalRef(env, o);
7163 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
7164 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
7166 LDKMessageSendEventsProvider ret = {
7167 .this_arg = (void*) calls,
7168 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7169 .free = LDKMessageSendEventsProvider_JCalls_free,
7173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7174 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7175 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
7176 return (uint64_t)res_ptr;
7178 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7179 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
7180 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7181 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7182 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7183 for (size_t s = 0; s < ret_var.datalen; s++) {
7184 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7185 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
7186 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
7187 ret_arr_ptr[s] = ret_conv_18_ref;
7189 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7194 typedef struct LDKEventHandler_JCalls {
7195 atomic_size_t refcnt;
7198 jmethodID handle_event_meth;
7199 } LDKEventHandler_JCalls;
7200 static void LDKEventHandler_JCalls_free(void* this_arg) {
7201 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7202 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7204 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7205 if (get_jenv_res == JNI_EDETACHED) {
7206 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7208 DO_ASSERT(get_jenv_res == JNI_OK);
7210 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7211 if (get_jenv_res == JNI_EDETACHED) {
7212 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7217 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7218 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7220 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7221 if (get_jenv_res == JNI_EDETACHED) {
7222 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7224 DO_ASSERT(get_jenv_res == JNI_OK);
7226 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7227 *ret_event = Event_clone(event);
7228 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7230 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
7231 if ((*env)->ExceptionCheck(env)) {
7232 (*env)->ExceptionDescribe(env);
7233 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
7235 if (get_jenv_res == JNI_EDETACHED) {
7236 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7239 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7240 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7241 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7243 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
7244 jclass c = (*env)->GetObjectClass(env, o);
7246 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7247 atomic_init(&calls->refcnt, 1);
7248 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7249 calls->o = (*env)->NewWeakGlobalRef(env, o);
7250 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
7251 CHECK(calls->handle_event_meth != NULL);
7253 LDKEventHandler ret = {
7254 .this_arg = (void*) calls,
7255 .handle_event = handle_event_LDKEventHandler_jcall,
7256 .free = LDKEventHandler_JCalls_free,
7260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
7261 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7262 *res_ptr = LDKEventHandler_init(env, clz, o);
7263 return (uint64_t)res_ptr;
7265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
7266 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
7267 LDKEvent* event_conv = (LDKEvent*)event;
7268 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7271 typedef struct LDKEventsProvider_JCalls {
7272 atomic_size_t refcnt;
7275 jmethodID process_pending_events_meth;
7276 } LDKEventsProvider_JCalls;
7277 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7278 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7279 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7281 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7282 if (get_jenv_res == JNI_EDETACHED) {
7283 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7285 DO_ASSERT(get_jenv_res == JNI_OK);
7287 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7288 if (get_jenv_res == JNI_EDETACHED) {
7289 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7294 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7295 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7297 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7298 if (get_jenv_res == JNI_EDETACHED) {
7299 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7301 DO_ASSERT(get_jenv_res == JNI_OK);
7303 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7304 *handler_ret = handler;
7305 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7307 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
7308 if ((*env)->ExceptionCheck(env)) {
7309 (*env)->ExceptionDescribe(env);
7310 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
7312 if (get_jenv_res == JNI_EDETACHED) {
7313 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7316 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7317 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7318 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7320 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7321 jclass c = (*env)->GetObjectClass(env, o);
7323 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7324 atomic_init(&calls->refcnt, 1);
7325 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7326 calls->o = (*env)->NewWeakGlobalRef(env, o);
7327 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
7328 CHECK(calls->process_pending_events_meth != NULL);
7330 LDKEventsProvider ret = {
7331 .this_arg = (void*) calls,
7332 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7333 .free = LDKEventsProvider_JCalls_free,
7337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7338 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7339 *res_ptr = LDKEventsProvider_init(env, clz, o);
7340 return (uint64_t)res_ptr;
7342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
7343 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
7344 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
7345 if (handler_conv.free == LDKEventHandler_JCalls_free) {
7346 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7347 LDKEventHandler_JCalls_cloned(&handler_conv);
7349 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7352 typedef struct LDKListen_JCalls {
7353 atomic_size_t refcnt;
7356 jmethodID block_connected_meth;
7357 jmethodID block_disconnected_meth;
7359 static void LDKListen_JCalls_free(void* this_arg) {
7360 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7361 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7363 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7364 if (get_jenv_res == JNI_EDETACHED) {
7365 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7367 DO_ASSERT(get_jenv_res == JNI_OK);
7369 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7370 if (get_jenv_res == JNI_EDETACHED) {
7371 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7376 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
7377 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7379 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7380 if (get_jenv_res == JNI_EDETACHED) {
7381 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7383 DO_ASSERT(get_jenv_res == JNI_OK);
7385 LDKu8slice block_var = block;
7386 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
7387 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
7388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7390 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
7391 if ((*env)->ExceptionCheck(env)) {
7392 (*env)->ExceptionDescribe(env);
7393 (*env)->FatalError(env, "A call to block_connected in LDKListen 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 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7400 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7402 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7403 if (get_jenv_res == JNI_EDETACHED) {
7404 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7406 DO_ASSERT(get_jenv_res == JNI_OK);
7408 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7409 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7410 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7412 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
7413 if ((*env)->ExceptionCheck(env)) {
7414 (*env)->ExceptionDescribe(env);
7415 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
7417 if (get_jenv_res == JNI_EDETACHED) {
7418 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7421 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
7422 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
7423 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7425 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
7426 jclass c = (*env)->GetObjectClass(env, o);
7428 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
7429 atomic_init(&calls->refcnt, 1);
7430 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7431 calls->o = (*env)->NewWeakGlobalRef(env, o);
7432 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
7433 CHECK(calls->block_connected_meth != NULL);
7434 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
7435 CHECK(calls->block_disconnected_meth != NULL);
7438 .this_arg = (void*) calls,
7439 .block_connected = block_connected_LDKListen_jcall,
7440 .block_disconnected = block_disconnected_LDKListen_jcall,
7441 .free = LDKListen_JCalls_free,
7445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
7446 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7447 *res_ptr = LDKListen_init(env, clz, o);
7448 return (uint64_t)res_ptr;
7450 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) {
7451 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7452 LDKu8slice block_ref;
7453 block_ref.datalen = (*env)->GetArrayLength(env, block);
7454 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
7455 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7456 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
7459 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) {
7460 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7461 unsigned char header_arr[80];
7462 CHECK((*env)->GetArrayLength(env, header) == 80);
7463 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7464 unsigned char (*header_ref)[80] = &header_arr;
7465 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7468 typedef struct LDKConfirm_JCalls {
7469 atomic_size_t refcnt;
7472 jmethodID transactions_confirmed_meth;
7473 jmethodID transaction_unconfirmed_meth;
7474 jmethodID best_block_updated_meth;
7475 jmethodID get_relevant_txids_meth;
7476 } LDKConfirm_JCalls;
7477 static void LDKConfirm_JCalls_free(void* this_arg) {
7478 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7479 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7481 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7482 if (get_jenv_res == JNI_EDETACHED) {
7483 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7485 DO_ASSERT(get_jenv_res == JNI_OK);
7487 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7488 if (get_jenv_res == JNI_EDETACHED) {
7489 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7494 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7495 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7497 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7498 if (get_jenv_res == JNI_EDETACHED) {
7499 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7501 DO_ASSERT(get_jenv_res == JNI_OK);
7503 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7504 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7505 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7506 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
7507 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
7508 for (size_t y = 0; y < txdata_var.datalen; y++) {
7509 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7510 *txdata_conv_24_ref = txdata_var.data[y];
7511 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
7513 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
7514 FREE(txdata_var.data);
7515 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7517 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
7518 if ((*env)->ExceptionCheck(env)) {
7519 (*env)->ExceptionDescribe(env);
7520 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
7522 if (get_jenv_res == JNI_EDETACHED) {
7523 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7526 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7527 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7529 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7530 if (get_jenv_res == JNI_EDETACHED) {
7531 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7533 DO_ASSERT(get_jenv_res == JNI_OK);
7535 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7536 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7537 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7539 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
7540 if ((*env)->ExceptionCheck(env)) {
7541 (*env)->ExceptionDescribe(env);
7542 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
7544 if (get_jenv_res == JNI_EDETACHED) {
7545 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7548 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7549 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7551 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7552 if (get_jenv_res == JNI_EDETACHED) {
7553 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7555 DO_ASSERT(get_jenv_res == JNI_OK);
7557 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7558 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7559 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7561 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
7562 if ((*env)->ExceptionCheck(env)) {
7563 (*env)->ExceptionDescribe(env);
7564 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
7566 if (get_jenv_res == JNI_EDETACHED) {
7567 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7570 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
7571 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7574 if (get_jenv_res == JNI_EDETACHED) {
7575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7577 DO_ASSERT(get_jenv_res == JNI_OK);
7579 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7581 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
7582 if ((*env)->ExceptionCheck(env)) {
7583 (*env)->ExceptionDescribe(env);
7584 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
7586 LDKCVec_TxidZ ret_constr;
7587 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7588 if (ret_constr.datalen > 0)
7589 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7591 ret_constr.data = NULL;
7592 for (size_t i = 0; i < ret_constr.datalen; i++) {
7593 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
7594 LDKThirtyTwoBytes ret_conv_8_ref;
7595 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
7596 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
7597 ret_constr.data[i] = ret_conv_8_ref;
7599 if (get_jenv_res == JNI_EDETACHED) {
7600 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7604 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
7605 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
7606 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7608 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
7609 jclass c = (*env)->GetObjectClass(env, o);
7611 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
7612 atomic_init(&calls->refcnt, 1);
7613 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7614 calls->o = (*env)->NewWeakGlobalRef(env, o);
7615 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
7616 CHECK(calls->transactions_confirmed_meth != NULL);
7617 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
7618 CHECK(calls->transaction_unconfirmed_meth != NULL);
7619 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
7620 CHECK(calls->best_block_updated_meth != NULL);
7621 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
7622 CHECK(calls->get_relevant_txids_meth != NULL);
7625 .this_arg = (void*) calls,
7626 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
7627 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
7628 .best_block_updated = best_block_updated_LDKConfirm_jcall,
7629 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
7630 .free = LDKConfirm_JCalls_free,
7634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
7635 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
7636 *res_ptr = LDKConfirm_init(env, clz, o);
7637 return (uint64_t)res_ptr;
7639 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) {
7640 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7641 unsigned char header_arr[80];
7642 CHECK((*env)->GetArrayLength(env, header) == 80);
7643 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7644 unsigned char (*header_ref)[80] = &header_arr;
7645 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7646 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7647 if (txdata_constr.datalen > 0)
7648 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7650 txdata_constr.data = NULL;
7651 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
7652 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7653 int64_t txdata_conv_24 = txdata_vals[y];
7654 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
7655 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
7656 txdata_constr.data[y] = txdata_conv_24_conv;
7658 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
7659 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
7662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
7663 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7664 unsigned char txid_arr[32];
7665 CHECK((*env)->GetArrayLength(env, txid) == 32);
7666 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7667 unsigned char (*txid_ref)[32] = &txid_arr;
7668 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
7671 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) {
7672 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7673 unsigned char header_arr[80];
7674 CHECK((*env)->GetArrayLength(env, header) == 80);
7675 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7676 unsigned char (*header_ref)[80] = &header_arr;
7677 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
7680 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
7681 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7682 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
7683 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
7685 for (size_t i = 0; i < ret_var.datalen; i++) {
7686 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
7687 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
7688 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
7694 typedef struct LDKPersist_JCalls {
7695 atomic_size_t refcnt;
7698 jmethodID persist_new_channel_meth;
7699 jmethodID update_persisted_channel_meth;
7700 } LDKPersist_JCalls;
7701 static void LDKPersist_JCalls_free(void* this_arg) {
7702 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7703 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7705 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7706 if (get_jenv_res == JNI_EDETACHED) {
7707 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7709 DO_ASSERT(get_jenv_res == JNI_OK);
7711 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7712 if (get_jenv_res == JNI_EDETACHED) {
7713 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7718 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
7719 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7721 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7722 if (get_jenv_res == JNI_EDETACHED) {
7723 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7725 DO_ASSERT(get_jenv_res == JNI_OK);
7727 LDKOutPoint id_var = id;
7728 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7729 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7730 uint64_t id_ref = (uint64_t)id_var.inner;
7731 if (id_var.is_owned) {
7734 LDKChannelMonitor data_var = *data;
7735 data_var = ChannelMonitor_clone(data);
7736 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7737 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7738 uint64_t data_ref = (uint64_t)data_var.inner;
7739 if (data_var.is_owned) {
7742 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7744 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
7745 if ((*env)->ExceptionCheck(env)) {
7746 (*env)->ExceptionDescribe(env);
7747 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
7749 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7750 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7751 if (get_jenv_res == JNI_EDETACHED) {
7752 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7756 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
7757 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7759 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7760 if (get_jenv_res == JNI_EDETACHED) {
7761 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7763 DO_ASSERT(get_jenv_res == JNI_OK);
7765 LDKOutPoint id_var = id;
7766 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7767 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7768 uint64_t id_ref = (uint64_t)id_var.inner;
7769 if (id_var.is_owned) {
7772 LDKChannelMonitorUpdate update_var = *update;
7773 update_var = ChannelMonitorUpdate_clone(update);
7774 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7775 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7776 uint64_t update_ref = (uint64_t)update_var.inner;
7777 if (update_var.is_owned) {
7780 LDKChannelMonitor data_var = *data;
7781 data_var = ChannelMonitor_clone(data);
7782 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7783 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7784 uint64_t data_ref = (uint64_t)data_var.inner;
7785 if (data_var.is_owned) {
7788 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7790 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
7791 if ((*env)->ExceptionCheck(env)) {
7792 (*env)->ExceptionDescribe(env);
7793 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
7795 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7796 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7797 if (get_jenv_res == JNI_EDETACHED) {
7798 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7802 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7803 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7804 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7806 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
7807 jclass c = (*env)->GetObjectClass(env, o);
7809 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7810 atomic_init(&calls->refcnt, 1);
7811 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7812 calls->o = (*env)->NewWeakGlobalRef(env, o);
7813 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
7814 CHECK(calls->persist_new_channel_meth != NULL);
7815 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
7816 CHECK(calls->update_persisted_channel_meth != NULL);
7819 .this_arg = (void*) calls,
7820 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7821 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7822 .free = LDKPersist_JCalls_free,
7826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
7827 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7828 *res_ptr = LDKPersist_init(env, clz, o);
7829 return (uint64_t)res_ptr;
7831 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) {
7832 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7833 LDKOutPoint id_conv;
7834 id_conv.inner = (void*)(id & (~1));
7835 id_conv.is_owned = (id & 1) || (id == 0);
7836 id_conv = OutPoint_clone(&id_conv);
7837 LDKChannelMonitor data_conv;
7838 data_conv.inner = (void*)(data & (~1));
7839 data_conv.is_owned = false;
7840 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7841 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
7842 return (uint64_t)ret_conv;
7845 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) {
7846 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7847 LDKOutPoint id_conv;
7848 id_conv.inner = (void*)(id & (~1));
7849 id_conv.is_owned = (id & 1) || (id == 0);
7850 id_conv = OutPoint_clone(&id_conv);
7851 LDKChannelMonitorUpdate update_conv;
7852 update_conv.inner = (void*)(update & (~1));
7853 update_conv.is_owned = false;
7854 LDKChannelMonitor data_conv;
7855 data_conv.inner = (void*)(data & (~1));
7856 data_conv.is_owned = false;
7857 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7858 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
7859 return (uint64_t)ret_conv;
7862 typedef struct LDKChannelMessageHandler_JCalls {
7863 atomic_size_t refcnt;
7866 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7867 jmethodID handle_open_channel_meth;
7868 jmethodID handle_accept_channel_meth;
7869 jmethodID handle_funding_created_meth;
7870 jmethodID handle_funding_signed_meth;
7871 jmethodID handle_funding_locked_meth;
7872 jmethodID handle_shutdown_meth;
7873 jmethodID handle_closing_signed_meth;
7874 jmethodID handle_update_add_htlc_meth;
7875 jmethodID handle_update_fulfill_htlc_meth;
7876 jmethodID handle_update_fail_htlc_meth;
7877 jmethodID handle_update_fail_malformed_htlc_meth;
7878 jmethodID handle_commitment_signed_meth;
7879 jmethodID handle_revoke_and_ack_meth;
7880 jmethodID handle_update_fee_meth;
7881 jmethodID handle_announcement_signatures_meth;
7882 jmethodID peer_disconnected_meth;
7883 jmethodID peer_connected_meth;
7884 jmethodID handle_channel_reestablish_meth;
7885 jmethodID handle_channel_update_meth;
7886 jmethodID handle_error_meth;
7887 } LDKChannelMessageHandler_JCalls;
7888 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7889 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7890 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7892 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7893 if (get_jenv_res == JNI_EDETACHED) {
7894 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7896 DO_ASSERT(get_jenv_res == JNI_OK);
7898 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7899 if (get_jenv_res == JNI_EDETACHED) {
7900 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7905 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7906 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7908 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7909 if (get_jenv_res == JNI_EDETACHED) {
7910 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7912 DO_ASSERT(get_jenv_res == JNI_OK);
7914 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7915 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7916 LDKInitFeatures their_features_var = their_features;
7917 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7918 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7919 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7920 if (their_features_var.is_owned) {
7921 their_features_ref |= 1;
7923 LDKOpenChannel msg_var = *msg;
7924 msg_var = OpenChannel_clone(msg);
7925 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7926 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7927 uint64_t msg_ref = (uint64_t)msg_var.inner;
7928 if (msg_var.is_owned) {
7931 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7933 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7934 if ((*env)->ExceptionCheck(env)) {
7935 (*env)->ExceptionDescribe(env);
7936 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
7938 if (get_jenv_res == JNI_EDETACHED) {
7939 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7942 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7943 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7945 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7946 if (get_jenv_res == JNI_EDETACHED) {
7947 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7949 DO_ASSERT(get_jenv_res == JNI_OK);
7951 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7952 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7953 LDKInitFeatures their_features_var = their_features;
7954 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7955 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7956 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7957 if (their_features_var.is_owned) {
7958 their_features_ref |= 1;
7960 LDKAcceptChannel msg_var = *msg;
7961 msg_var = AcceptChannel_clone(msg);
7962 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7963 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7964 uint64_t msg_ref = (uint64_t)msg_var.inner;
7965 if (msg_var.is_owned) {
7968 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7970 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7971 if ((*env)->ExceptionCheck(env)) {
7972 (*env)->ExceptionDescribe(env);
7973 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
7975 if (get_jenv_res == JNI_EDETACHED) {
7976 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7979 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7980 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7982 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7983 if (get_jenv_res == JNI_EDETACHED) {
7984 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7986 DO_ASSERT(get_jenv_res == JNI_OK);
7988 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7989 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7990 LDKFundingCreated msg_var = *msg;
7991 msg_var = FundingCreated_clone(msg);
7992 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7993 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7994 uint64_t msg_ref = (uint64_t)msg_var.inner;
7995 if (msg_var.is_owned) {
7998 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8000 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
8001 if ((*env)->ExceptionCheck(env)) {
8002 (*env)->ExceptionDescribe(env);
8003 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
8005 if (get_jenv_res == JNI_EDETACHED) {
8006 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8009 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8010 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8012 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8013 if (get_jenv_res == JNI_EDETACHED) {
8014 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8016 DO_ASSERT(get_jenv_res == JNI_OK);
8018 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8019 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8020 LDKFundingSigned msg_var = *msg;
8021 msg_var = FundingSigned_clone(msg);
8022 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8023 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8024 uint64_t msg_ref = (uint64_t)msg_var.inner;
8025 if (msg_var.is_owned) {
8028 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8030 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
8031 if ((*env)->ExceptionCheck(env)) {
8032 (*env)->ExceptionDescribe(env);
8033 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
8035 if (get_jenv_res == JNI_EDETACHED) {
8036 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8039 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8040 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8042 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8043 if (get_jenv_res == JNI_EDETACHED) {
8044 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8046 DO_ASSERT(get_jenv_res == JNI_OK);
8048 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8049 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8050 LDKFundingLocked msg_var = *msg;
8051 msg_var = FundingLocked_clone(msg);
8052 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8053 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8054 uint64_t msg_ref = (uint64_t)msg_var.inner;
8055 if (msg_var.is_owned) {
8058 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8060 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
8061 if ((*env)->ExceptionCheck(env)) {
8062 (*env)->ExceptionDescribe(env);
8063 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
8065 if (get_jenv_res == JNI_EDETACHED) {
8066 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8069 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8070 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8072 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8073 if (get_jenv_res == JNI_EDETACHED) {
8074 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8076 DO_ASSERT(get_jenv_res == JNI_OK);
8078 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8079 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8080 LDKInitFeatures their_features_var = *their_features;
8081 their_features_var = InitFeatures_clone(their_features);
8082 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8083 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8084 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8085 if (their_features_var.is_owned) {
8086 their_features_ref |= 1;
8088 LDKShutdown msg_var = *msg;
8089 msg_var = Shutdown_clone(msg);
8090 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8091 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8092 uint64_t msg_ref = (uint64_t)msg_var.inner;
8093 if (msg_var.is_owned) {
8096 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8098 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
8099 if ((*env)->ExceptionCheck(env)) {
8100 (*env)->ExceptionDescribe(env);
8101 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
8103 if (get_jenv_res == JNI_EDETACHED) {
8104 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8107 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8108 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8110 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8111 if (get_jenv_res == JNI_EDETACHED) {
8112 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8114 DO_ASSERT(get_jenv_res == JNI_OK);
8116 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8117 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8118 LDKClosingSigned msg_var = *msg;
8119 msg_var = ClosingSigned_clone(msg);
8120 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8121 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8122 uint64_t msg_ref = (uint64_t)msg_var.inner;
8123 if (msg_var.is_owned) {
8126 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8128 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
8129 if ((*env)->ExceptionCheck(env)) {
8130 (*env)->ExceptionDescribe(env);
8131 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
8133 if (get_jenv_res == JNI_EDETACHED) {
8134 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8137 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8138 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8140 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8141 if (get_jenv_res == JNI_EDETACHED) {
8142 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8144 DO_ASSERT(get_jenv_res == JNI_OK);
8146 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8147 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8148 LDKUpdateAddHTLC msg_var = *msg;
8149 msg_var = UpdateAddHTLC_clone(msg);
8150 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8151 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8152 uint64_t msg_ref = (uint64_t)msg_var.inner;
8153 if (msg_var.is_owned) {
8156 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8158 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
8159 if ((*env)->ExceptionCheck(env)) {
8160 (*env)->ExceptionDescribe(env);
8161 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
8163 if (get_jenv_res == JNI_EDETACHED) {
8164 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8167 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8168 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8170 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8171 if (get_jenv_res == JNI_EDETACHED) {
8172 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8174 DO_ASSERT(get_jenv_res == JNI_OK);
8176 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8177 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8178 LDKUpdateFulfillHTLC msg_var = *msg;
8179 msg_var = UpdateFulfillHTLC_clone(msg);
8180 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8181 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8182 uint64_t msg_ref = (uint64_t)msg_var.inner;
8183 if (msg_var.is_owned) {
8186 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8188 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
8189 if ((*env)->ExceptionCheck(env)) {
8190 (*env)->ExceptionDescribe(env);
8191 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
8193 if (get_jenv_res == JNI_EDETACHED) {
8194 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8197 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8198 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8200 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8201 if (get_jenv_res == JNI_EDETACHED) {
8202 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8204 DO_ASSERT(get_jenv_res == JNI_OK);
8206 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8207 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8208 LDKUpdateFailHTLC msg_var = *msg;
8209 msg_var = UpdateFailHTLC_clone(msg);
8210 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8211 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8212 uint64_t msg_ref = (uint64_t)msg_var.inner;
8213 if (msg_var.is_owned) {
8216 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8218 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
8219 if ((*env)->ExceptionCheck(env)) {
8220 (*env)->ExceptionDescribe(env);
8221 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
8223 if (get_jenv_res == JNI_EDETACHED) {
8224 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8227 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8228 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8230 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8231 if (get_jenv_res == JNI_EDETACHED) {
8232 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8234 DO_ASSERT(get_jenv_res == JNI_OK);
8236 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8237 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8238 LDKUpdateFailMalformedHTLC msg_var = *msg;
8239 msg_var = UpdateFailMalformedHTLC_clone(msg);
8240 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8241 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8242 uint64_t msg_ref = (uint64_t)msg_var.inner;
8243 if (msg_var.is_owned) {
8246 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8248 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
8249 if ((*env)->ExceptionCheck(env)) {
8250 (*env)->ExceptionDescribe(env);
8251 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
8253 if (get_jenv_res == JNI_EDETACHED) {
8254 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8257 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8258 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8260 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8261 if (get_jenv_res == JNI_EDETACHED) {
8262 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8264 DO_ASSERT(get_jenv_res == JNI_OK);
8266 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8267 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8268 LDKCommitmentSigned msg_var = *msg;
8269 msg_var = CommitmentSigned_clone(msg);
8270 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8271 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8272 uint64_t msg_ref = (uint64_t)msg_var.inner;
8273 if (msg_var.is_owned) {
8276 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8278 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
8279 if ((*env)->ExceptionCheck(env)) {
8280 (*env)->ExceptionDescribe(env);
8281 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
8283 if (get_jenv_res == JNI_EDETACHED) {
8284 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8287 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8288 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8290 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8291 if (get_jenv_res == JNI_EDETACHED) {
8292 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8294 DO_ASSERT(get_jenv_res == JNI_OK);
8296 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8297 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8298 LDKRevokeAndACK msg_var = *msg;
8299 msg_var = RevokeAndACK_clone(msg);
8300 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8301 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8302 uint64_t msg_ref = (uint64_t)msg_var.inner;
8303 if (msg_var.is_owned) {
8306 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8308 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
8309 if ((*env)->ExceptionCheck(env)) {
8310 (*env)->ExceptionDescribe(env);
8311 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
8313 if (get_jenv_res == JNI_EDETACHED) {
8314 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8317 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8318 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8320 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8321 if (get_jenv_res == JNI_EDETACHED) {
8322 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8324 DO_ASSERT(get_jenv_res == JNI_OK);
8326 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8327 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8328 LDKUpdateFee msg_var = *msg;
8329 msg_var = UpdateFee_clone(msg);
8330 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8331 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8332 uint64_t msg_ref = (uint64_t)msg_var.inner;
8333 if (msg_var.is_owned) {
8336 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8338 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
8339 if ((*env)->ExceptionCheck(env)) {
8340 (*env)->ExceptionDescribe(env);
8341 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
8343 if (get_jenv_res == JNI_EDETACHED) {
8344 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8347 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8348 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8350 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8351 if (get_jenv_res == JNI_EDETACHED) {
8352 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8354 DO_ASSERT(get_jenv_res == JNI_OK);
8356 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8357 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8358 LDKAnnouncementSignatures msg_var = *msg;
8359 msg_var = AnnouncementSignatures_clone(msg);
8360 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8361 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8362 uint64_t msg_ref = (uint64_t)msg_var.inner;
8363 if (msg_var.is_owned) {
8366 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8368 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
8369 if ((*env)->ExceptionCheck(env)) {
8370 (*env)->ExceptionDescribe(env);
8371 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
8373 if (get_jenv_res == JNI_EDETACHED) {
8374 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8377 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8378 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8380 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8381 if (get_jenv_res == JNI_EDETACHED) {
8382 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8384 DO_ASSERT(get_jenv_res == JNI_OK);
8386 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8387 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8388 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8390 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
8391 if ((*env)->ExceptionCheck(env)) {
8392 (*env)->ExceptionDescribe(env);
8393 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
8395 if (get_jenv_res == JNI_EDETACHED) {
8396 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8399 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8400 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8402 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8403 if (get_jenv_res == JNI_EDETACHED) {
8404 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8406 DO_ASSERT(get_jenv_res == JNI_OK);
8408 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8409 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8410 LDKInit msg_var = *msg;
8411 msg_var = Init_clone(msg);
8412 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8413 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8414 uint64_t msg_ref = (uint64_t)msg_var.inner;
8415 if (msg_var.is_owned) {
8418 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8420 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
8421 if ((*env)->ExceptionCheck(env)) {
8422 (*env)->ExceptionDescribe(env);
8423 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
8425 if (get_jenv_res == JNI_EDETACHED) {
8426 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8429 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8430 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8432 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8433 if (get_jenv_res == JNI_EDETACHED) {
8434 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8436 DO_ASSERT(get_jenv_res == JNI_OK);
8438 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8439 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8440 LDKChannelReestablish msg_var = *msg;
8441 msg_var = ChannelReestablish_clone(msg);
8442 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8443 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8444 uint64_t msg_ref = (uint64_t)msg_var.inner;
8445 if (msg_var.is_owned) {
8448 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8450 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
8451 if ((*env)->ExceptionCheck(env)) {
8452 (*env)->ExceptionDescribe(env);
8453 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
8455 if (get_jenv_res == JNI_EDETACHED) {
8456 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8459 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8460 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8462 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8463 if (get_jenv_res == JNI_EDETACHED) {
8464 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8466 DO_ASSERT(get_jenv_res == JNI_OK);
8468 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8469 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8470 LDKChannelUpdate msg_var = *msg;
8471 msg_var = ChannelUpdate_clone(msg);
8472 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8473 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8474 uint64_t msg_ref = (uint64_t)msg_var.inner;
8475 if (msg_var.is_owned) {
8478 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8480 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
8481 if ((*env)->ExceptionCheck(env)) {
8482 (*env)->ExceptionDescribe(env);
8483 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
8485 if (get_jenv_res == JNI_EDETACHED) {
8486 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8489 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8490 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8492 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8493 if (get_jenv_res == JNI_EDETACHED) {
8494 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8496 DO_ASSERT(get_jenv_res == JNI_OK);
8498 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8499 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8500 LDKErrorMessage msg_var = *msg;
8501 msg_var = ErrorMessage_clone(msg);
8502 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8503 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8504 uint64_t msg_ref = (uint64_t)msg_var.inner;
8505 if (msg_var.is_owned) {
8508 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8510 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
8511 if ((*env)->ExceptionCheck(env)) {
8512 (*env)->ExceptionDescribe(env);
8513 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
8515 if (get_jenv_res == JNI_EDETACHED) {
8516 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8519 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8520 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8521 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8522 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8524 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8525 jclass c = (*env)->GetObjectClass(env, o);
8527 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8528 atomic_init(&calls->refcnt, 1);
8529 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8530 calls->o = (*env)->NewWeakGlobalRef(env, o);
8531 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
8532 CHECK(calls->handle_open_channel_meth != NULL);
8533 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
8534 CHECK(calls->handle_accept_channel_meth != NULL);
8535 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
8536 CHECK(calls->handle_funding_created_meth != NULL);
8537 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
8538 CHECK(calls->handle_funding_signed_meth != NULL);
8539 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
8540 CHECK(calls->handle_funding_locked_meth != NULL);
8541 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
8542 CHECK(calls->handle_shutdown_meth != NULL);
8543 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
8544 CHECK(calls->handle_closing_signed_meth != NULL);
8545 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
8546 CHECK(calls->handle_update_add_htlc_meth != NULL);
8547 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
8548 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
8549 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
8550 CHECK(calls->handle_update_fail_htlc_meth != NULL);
8551 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
8552 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
8553 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
8554 CHECK(calls->handle_commitment_signed_meth != NULL);
8555 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
8556 CHECK(calls->handle_revoke_and_ack_meth != NULL);
8557 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
8558 CHECK(calls->handle_update_fee_meth != NULL);
8559 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
8560 CHECK(calls->handle_announcement_signatures_meth != NULL);
8561 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
8562 CHECK(calls->peer_disconnected_meth != NULL);
8563 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
8564 CHECK(calls->peer_connected_meth != NULL);
8565 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
8566 CHECK(calls->handle_channel_reestablish_meth != NULL);
8567 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
8568 CHECK(calls->handle_channel_update_meth != NULL);
8569 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
8570 CHECK(calls->handle_error_meth != NULL);
8572 LDKChannelMessageHandler ret = {
8573 .this_arg = (void*) calls,
8574 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8575 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8576 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8577 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8578 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
8579 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8580 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8581 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8582 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8583 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8584 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8585 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8586 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8587 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8588 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8589 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8590 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8591 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8592 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8593 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8594 .free = LDKChannelMessageHandler_JCalls_free,
8595 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8597 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8601 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8602 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8603 return (uint64_t)res_ptr;
8605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8606 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
8607 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8608 DO_ASSERT((res_ptr & 1) == 0);
8609 return (int64_t)(res_ptr | 1);
8611 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) {
8612 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8613 LDKPublicKey their_node_id_ref;
8614 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8615 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8616 LDKInitFeatures their_features_conv;
8617 their_features_conv.inner = (void*)(their_features & (~1));
8618 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8619 their_features_conv = InitFeatures_clone(&their_features_conv);
8620 LDKOpenChannel msg_conv;
8621 msg_conv.inner = (void*)(msg & (~1));
8622 msg_conv.is_owned = false;
8623 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8626 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) {
8627 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8628 LDKPublicKey their_node_id_ref;
8629 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8630 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8631 LDKInitFeatures their_features_conv;
8632 their_features_conv.inner = (void*)(their_features & (~1));
8633 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8634 their_features_conv = InitFeatures_clone(&their_features_conv);
8635 LDKAcceptChannel msg_conv;
8636 msg_conv.inner = (void*)(msg & (~1));
8637 msg_conv.is_owned = false;
8638 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8641 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) {
8642 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8643 LDKPublicKey their_node_id_ref;
8644 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8645 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8646 LDKFundingCreated msg_conv;
8647 msg_conv.inner = (void*)(msg & (~1));
8648 msg_conv.is_owned = false;
8649 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8652 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) {
8653 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8654 LDKPublicKey their_node_id_ref;
8655 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8656 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8657 LDKFundingSigned msg_conv;
8658 msg_conv.inner = (void*)(msg & (~1));
8659 msg_conv.is_owned = false;
8660 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8663 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) {
8664 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8665 LDKPublicKey their_node_id_ref;
8666 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8667 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8668 LDKFundingLocked msg_conv;
8669 msg_conv.inner = (void*)(msg & (~1));
8670 msg_conv.is_owned = false;
8671 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8674 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) {
8675 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8676 LDKPublicKey their_node_id_ref;
8677 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8678 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8679 LDKInitFeatures their_features_conv;
8680 their_features_conv.inner = (void*)(their_features & (~1));
8681 their_features_conv.is_owned = false;
8682 LDKShutdown msg_conv;
8683 msg_conv.inner = (void*)(msg & (~1));
8684 msg_conv.is_owned = false;
8685 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8688 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) {
8689 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8690 LDKPublicKey their_node_id_ref;
8691 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8692 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8693 LDKClosingSigned msg_conv;
8694 msg_conv.inner = (void*)(msg & (~1));
8695 msg_conv.is_owned = false;
8696 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8699 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) {
8700 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8701 LDKPublicKey their_node_id_ref;
8702 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8703 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8704 LDKUpdateAddHTLC msg_conv;
8705 msg_conv.inner = (void*)(msg & (~1));
8706 msg_conv.is_owned = false;
8707 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8710 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) {
8711 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8712 LDKPublicKey their_node_id_ref;
8713 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8714 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8715 LDKUpdateFulfillHTLC msg_conv;
8716 msg_conv.inner = (void*)(msg & (~1));
8717 msg_conv.is_owned = false;
8718 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8721 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) {
8722 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8723 LDKPublicKey their_node_id_ref;
8724 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8725 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8726 LDKUpdateFailHTLC msg_conv;
8727 msg_conv.inner = (void*)(msg & (~1));
8728 msg_conv.is_owned = false;
8729 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8732 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) {
8733 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8734 LDKPublicKey their_node_id_ref;
8735 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8736 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8737 LDKUpdateFailMalformedHTLC msg_conv;
8738 msg_conv.inner = (void*)(msg & (~1));
8739 msg_conv.is_owned = false;
8740 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8743 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) {
8744 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8745 LDKPublicKey their_node_id_ref;
8746 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8747 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8748 LDKCommitmentSigned msg_conv;
8749 msg_conv.inner = (void*)(msg & (~1));
8750 msg_conv.is_owned = false;
8751 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8754 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) {
8755 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8756 LDKPublicKey their_node_id_ref;
8757 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8758 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8759 LDKRevokeAndACK msg_conv;
8760 msg_conv.inner = (void*)(msg & (~1));
8761 msg_conv.is_owned = false;
8762 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8765 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) {
8766 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8767 LDKPublicKey their_node_id_ref;
8768 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8769 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8770 LDKUpdateFee msg_conv;
8771 msg_conv.inner = (void*)(msg & (~1));
8772 msg_conv.is_owned = false;
8773 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8776 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) {
8777 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8778 LDKPublicKey their_node_id_ref;
8779 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8780 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8781 LDKAnnouncementSignatures msg_conv;
8782 msg_conv.inner = (void*)(msg & (~1));
8783 msg_conv.is_owned = false;
8784 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8787 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) {
8788 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8789 LDKPublicKey their_node_id_ref;
8790 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8791 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8792 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8795 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) {
8796 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8797 LDKPublicKey their_node_id_ref;
8798 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8799 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8801 msg_conv.inner = (void*)(msg & (~1));
8802 msg_conv.is_owned = false;
8803 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8806 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) {
8807 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8808 LDKPublicKey their_node_id_ref;
8809 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8810 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8811 LDKChannelReestablish msg_conv;
8812 msg_conv.inner = (void*)(msg & (~1));
8813 msg_conv.is_owned = false;
8814 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8817 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) {
8818 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8819 LDKPublicKey their_node_id_ref;
8820 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8821 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8822 LDKChannelUpdate msg_conv;
8823 msg_conv.inner = (void*)(msg & (~1));
8824 msg_conv.is_owned = false;
8825 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8828 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) {
8829 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8830 LDKPublicKey their_node_id_ref;
8831 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8832 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8833 LDKErrorMessage msg_conv;
8834 msg_conv.inner = (void*)(msg & (~1));
8835 msg_conv.is_owned = false;
8836 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8839 typedef struct LDKRoutingMessageHandler_JCalls {
8840 atomic_size_t refcnt;
8843 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8844 jmethodID handle_node_announcement_meth;
8845 jmethodID handle_channel_announcement_meth;
8846 jmethodID handle_channel_update_meth;
8847 jmethodID get_next_channel_announcements_meth;
8848 jmethodID get_next_node_announcements_meth;
8849 jmethodID sync_routing_table_meth;
8850 jmethodID handle_reply_channel_range_meth;
8851 jmethodID handle_reply_short_channel_ids_end_meth;
8852 jmethodID handle_query_channel_range_meth;
8853 jmethodID handle_query_short_channel_ids_meth;
8854 } LDKRoutingMessageHandler_JCalls;
8855 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8856 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8857 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8859 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8860 if (get_jenv_res == JNI_EDETACHED) {
8861 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8863 DO_ASSERT(get_jenv_res == JNI_OK);
8865 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8866 if (get_jenv_res == JNI_EDETACHED) {
8867 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8872 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8873 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8875 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8876 if (get_jenv_res == JNI_EDETACHED) {
8877 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8879 DO_ASSERT(get_jenv_res == JNI_OK);
8881 LDKNodeAnnouncement msg_var = *msg;
8882 msg_var = NodeAnnouncement_clone(msg);
8883 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8884 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8885 uint64_t msg_ref = (uint64_t)msg_var.inner;
8886 if (msg_var.is_owned) {
8889 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8891 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
8892 if ((*env)->ExceptionCheck(env)) {
8893 (*env)->ExceptionDescribe(env);
8894 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8896 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8897 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8898 if (get_jenv_res == JNI_EDETACHED) {
8899 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8903 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8904 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8906 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8907 if (get_jenv_res == JNI_EDETACHED) {
8908 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8910 DO_ASSERT(get_jenv_res == JNI_OK);
8912 LDKChannelAnnouncement msg_var = *msg;
8913 msg_var = ChannelAnnouncement_clone(msg);
8914 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8915 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8916 uint64_t msg_ref = (uint64_t)msg_var.inner;
8917 if (msg_var.is_owned) {
8920 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8922 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
8923 if ((*env)->ExceptionCheck(env)) {
8924 (*env)->ExceptionDescribe(env);
8925 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8927 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8928 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8929 if (get_jenv_res == JNI_EDETACHED) {
8930 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8934 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8935 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8937 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8938 if (get_jenv_res == JNI_EDETACHED) {
8939 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8941 DO_ASSERT(get_jenv_res == JNI_OK);
8943 LDKChannelUpdate msg_var = *msg;
8944 msg_var = ChannelUpdate_clone(msg);
8945 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8946 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8947 uint64_t msg_ref = (uint64_t)msg_var.inner;
8948 if (msg_var.is_owned) {
8951 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8953 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
8954 if ((*env)->ExceptionCheck(env)) {
8955 (*env)->ExceptionDescribe(env);
8956 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8958 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8959 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8960 if (get_jenv_res == JNI_EDETACHED) {
8961 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8965 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8966 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8968 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8969 if (get_jenv_res == JNI_EDETACHED) {
8970 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8972 DO_ASSERT(get_jenv_res == JNI_OK);
8974 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8976 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
8977 if ((*env)->ExceptionCheck(env)) {
8978 (*env)->ExceptionDescribe(env);
8979 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8981 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8982 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8983 if (ret_constr.datalen > 0)
8984 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8986 ret_constr.data = NULL;
8987 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8988 for (size_t l = 0; l < ret_constr.datalen; l++) {
8989 int64_t ret_conv_63 = ret_vals[l];
8990 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
8991 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
8992 ret_constr.data[l] = ret_conv_63_conv;
8994 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8995 if (get_jenv_res == JNI_EDETACHED) {
8996 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9000 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9001 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9003 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9004 if (get_jenv_res == JNI_EDETACHED) {
9005 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9007 DO_ASSERT(get_jenv_res == JNI_OK);
9009 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
9010 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
9011 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9013 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
9014 if ((*env)->ExceptionCheck(env)) {
9015 (*env)->ExceptionDescribe(env);
9016 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9018 LDKCVec_NodeAnnouncementZ ret_constr;
9019 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9020 if (ret_constr.datalen > 0)
9021 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9023 ret_constr.data = NULL;
9024 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9025 for (size_t s = 0; s < ret_constr.datalen; s++) {
9026 int64_t ret_conv_18 = ret_vals[s];
9027 LDKNodeAnnouncement ret_conv_18_conv;
9028 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9029 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9030 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
9031 ret_constr.data[s] = ret_conv_18_conv;
9033 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9034 if (get_jenv_res == JNI_EDETACHED) {
9035 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9039 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9040 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9042 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9043 if (get_jenv_res == JNI_EDETACHED) {
9044 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9046 DO_ASSERT(get_jenv_res == JNI_OK);
9048 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9049 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9050 LDKInit init_var = *init;
9051 init_var = Init_clone(init);
9052 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9053 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9054 uint64_t init_ref = (uint64_t)init_var.inner;
9055 if (init_var.is_owned) {
9058 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9060 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
9061 if ((*env)->ExceptionCheck(env)) {
9062 (*env)->ExceptionDescribe(env);
9063 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
9065 if (get_jenv_res == JNI_EDETACHED) {
9066 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9069 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9070 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9072 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9073 if (get_jenv_res == JNI_EDETACHED) {
9074 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9076 DO_ASSERT(get_jenv_res == JNI_OK);
9078 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9079 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9080 LDKReplyChannelRange msg_var = msg;
9081 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9082 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9083 uint64_t msg_ref = (uint64_t)msg_var.inner;
9084 if (msg_var.is_owned) {
9087 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9089 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
9090 if ((*env)->ExceptionCheck(env)) {
9091 (*env)->ExceptionDescribe(env);
9092 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9094 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9095 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9096 if (get_jenv_res == JNI_EDETACHED) {
9097 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9101 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9102 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9104 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9105 if (get_jenv_res == JNI_EDETACHED) {
9106 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9108 DO_ASSERT(get_jenv_res == JNI_OK);
9110 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9111 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9112 LDKReplyShortChannelIdsEnd msg_var = msg;
9113 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9114 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9115 uint64_t msg_ref = (uint64_t)msg_var.inner;
9116 if (msg_var.is_owned) {
9119 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9121 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
9122 if ((*env)->ExceptionCheck(env)) {
9123 (*env)->ExceptionDescribe(env);
9124 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
9126 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9127 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9128 if (get_jenv_res == JNI_EDETACHED) {
9129 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9133 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9134 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9136 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9137 if (get_jenv_res == JNI_EDETACHED) {
9138 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9140 DO_ASSERT(get_jenv_res == JNI_OK);
9142 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9143 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9144 LDKQueryChannelRange msg_var = msg;
9145 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9146 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9147 uint64_t msg_ref = (uint64_t)msg_var.inner;
9148 if (msg_var.is_owned) {
9151 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9153 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
9154 if ((*env)->ExceptionCheck(env)) {
9155 (*env)->ExceptionDescribe(env);
9156 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9158 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9159 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9160 if (get_jenv_res == JNI_EDETACHED) {
9161 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9165 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9166 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9168 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9169 if (get_jenv_res == JNI_EDETACHED) {
9170 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9172 DO_ASSERT(get_jenv_res == JNI_OK);
9174 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9175 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9176 LDKQueryShortChannelIds msg_var = msg;
9177 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9178 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9179 uint64_t msg_ref = (uint64_t)msg_var.inner;
9180 if (msg_var.is_owned) {
9183 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9185 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
9186 if ((*env)->ExceptionCheck(env)) {
9187 (*env)->ExceptionDescribe(env);
9188 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
9190 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9191 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9192 if (get_jenv_res == JNI_EDETACHED) {
9193 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9197 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9198 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9199 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9200 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9202 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9203 jclass c = (*env)->GetObjectClass(env, o);
9205 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9206 atomic_init(&calls->refcnt, 1);
9207 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9208 calls->o = (*env)->NewWeakGlobalRef(env, o);
9209 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
9210 CHECK(calls->handle_node_announcement_meth != NULL);
9211 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
9212 CHECK(calls->handle_channel_announcement_meth != NULL);
9213 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
9214 CHECK(calls->handle_channel_update_meth != NULL);
9215 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
9216 CHECK(calls->get_next_channel_announcements_meth != NULL);
9217 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
9218 CHECK(calls->get_next_node_announcements_meth != NULL);
9219 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
9220 CHECK(calls->sync_routing_table_meth != NULL);
9221 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
9222 CHECK(calls->handle_reply_channel_range_meth != NULL);
9223 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
9224 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
9225 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
9226 CHECK(calls->handle_query_channel_range_meth != NULL);
9227 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
9228 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
9230 LDKRoutingMessageHandler ret = {
9231 .this_arg = (void*) calls,
9232 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9233 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9234 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9235 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9236 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9237 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9238 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9239 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9240 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9241 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9242 .free = LDKRoutingMessageHandler_JCalls_free,
9243 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9245 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9249 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9250 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9251 return (uint64_t)res_ptr;
9253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9254 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
9255 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9256 DO_ASSERT((res_ptr & 1) == 0);
9257 return (int64_t)(res_ptr | 1);
9259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9260 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9261 LDKNodeAnnouncement msg_conv;
9262 msg_conv.inner = (void*)(msg & (~1));
9263 msg_conv.is_owned = false;
9264 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9265 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9266 return (uint64_t)ret_conv;
9269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9270 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9271 LDKChannelAnnouncement msg_conv;
9272 msg_conv.inner = (void*)(msg & (~1));
9273 msg_conv.is_owned = false;
9274 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9275 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9276 return (uint64_t)ret_conv;
9279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9280 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9281 LDKChannelUpdate msg_conv;
9282 msg_conv.inner = (void*)(msg & (~1));
9283 msg_conv.is_owned = false;
9284 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9285 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9286 return (uint64_t)ret_conv;
9289 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) {
9290 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9291 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9292 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9293 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9294 for (size_t l = 0; l < ret_var.datalen; l++) {
9295 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9296 *ret_conv_63_ref = ret_var.data[l];
9297 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
9299 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9304 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) {
9305 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9306 LDKPublicKey starting_point_ref;
9307 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
9308 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
9309 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9310 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9311 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9312 for (size_t s = 0; s < ret_var.datalen; s++) {
9313 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9314 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9315 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9316 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
9317 if (ret_conv_18_var.is_owned) {
9318 ret_conv_18_ref |= 1;
9320 ret_arr_ptr[s] = ret_conv_18_ref;
9322 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9327 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) {
9328 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9329 LDKPublicKey their_node_id_ref;
9330 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9331 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9333 init_conv.inner = (void*)(init & (~1));
9334 init_conv.is_owned = false;
9335 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9338 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) {
9339 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9340 LDKPublicKey their_node_id_ref;
9341 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9342 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9343 LDKReplyChannelRange msg_conv;
9344 msg_conv.inner = (void*)(msg & (~1));
9345 msg_conv.is_owned = (msg & 1) || (msg == 0);
9346 msg_conv = ReplyChannelRange_clone(&msg_conv);
9347 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9348 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9349 return (uint64_t)ret_conv;
9352 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) {
9353 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9354 LDKPublicKey their_node_id_ref;
9355 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9356 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9357 LDKReplyShortChannelIdsEnd msg_conv;
9358 msg_conv.inner = (void*)(msg & (~1));
9359 msg_conv.is_owned = (msg & 1) || (msg == 0);
9360 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9361 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9362 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9363 return (uint64_t)ret_conv;
9366 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) {
9367 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9368 LDKPublicKey their_node_id_ref;
9369 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9370 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9371 LDKQueryChannelRange msg_conv;
9372 msg_conv.inner = (void*)(msg & (~1));
9373 msg_conv.is_owned = (msg & 1) || (msg == 0);
9374 msg_conv = QueryChannelRange_clone(&msg_conv);
9375 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9376 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9377 return (uint64_t)ret_conv;
9380 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) {
9381 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9382 LDKPublicKey their_node_id_ref;
9383 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9384 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9385 LDKQueryShortChannelIds msg_conv;
9386 msg_conv.inner = (void*)(msg & (~1));
9387 msg_conv.is_owned = (msg & 1) || (msg == 0);
9388 msg_conv = QueryShortChannelIds_clone(&msg_conv);
9389 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9390 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9391 return (uint64_t)ret_conv;
9394 typedef struct LDKCustomMessageReader_JCalls {
9395 atomic_size_t refcnt;
9398 jmethodID read_meth;
9399 } LDKCustomMessageReader_JCalls;
9400 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9401 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9402 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9404 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9405 if (get_jenv_res == JNI_EDETACHED) {
9406 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9408 DO_ASSERT(get_jenv_res == JNI_OK);
9410 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9411 if (get_jenv_res == JNI_EDETACHED) {
9412 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9417 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9418 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9420 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9421 if (get_jenv_res == JNI_EDETACHED) {
9422 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9424 DO_ASSERT(get_jenv_res == JNI_OK);
9426 LDKu8slice buffer_var = buffer;
9427 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
9428 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
9429 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9431 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
9432 if ((*env)->ExceptionCheck(env)) {
9433 (*env)->ExceptionDescribe(env);
9434 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
9436 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
9437 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
9438 if (get_jenv_res == JNI_EDETACHED) {
9439 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9443 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9444 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9445 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9447 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
9448 jclass c = (*env)->GetObjectClass(env, o);
9450 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9451 atomic_init(&calls->refcnt, 1);
9452 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9453 calls->o = (*env)->NewWeakGlobalRef(env, o);
9454 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
9455 CHECK(calls->read_meth != NULL);
9457 LDKCustomMessageReader ret = {
9458 .this_arg = (void*) calls,
9459 .read = read_LDKCustomMessageReader_jcall,
9460 .free = LDKCustomMessageReader_JCalls_free,
9464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
9465 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9466 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
9467 return (uint64_t)res_ptr;
9469 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) {
9470 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
9471 LDKu8slice buffer_ref;
9472 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
9473 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
9474 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9475 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9476 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
9477 return (uint64_t)ret_conv;
9480 typedef struct LDKCustomMessageHandler_JCalls {
9481 atomic_size_t refcnt;
9484 LDKCustomMessageReader_JCalls* CustomMessageReader;
9485 jmethodID handle_custom_message_meth;
9486 jmethodID get_and_clear_pending_msg_meth;
9487 } LDKCustomMessageHandler_JCalls;
9488 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9489 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9490 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9492 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9493 if (get_jenv_res == JNI_EDETACHED) {
9494 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9496 DO_ASSERT(get_jenv_res == JNI_OK);
9498 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9499 if (get_jenv_res == JNI_EDETACHED) {
9500 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9505 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9506 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9508 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9509 if (get_jenv_res == JNI_EDETACHED) {
9510 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9512 DO_ASSERT(get_jenv_res == JNI_OK);
9514 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
9516 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
9517 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
9518 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9520 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
9521 if ((*env)->ExceptionCheck(env)) {
9522 (*env)->ExceptionDescribe(env);
9523 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
9525 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9526 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9527 if (get_jenv_res == JNI_EDETACHED) {
9528 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9532 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9533 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9535 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9536 if (get_jenv_res == JNI_EDETACHED) {
9537 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9539 DO_ASSERT(get_jenv_res == JNI_OK);
9541 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9543 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
9544 if ((*env)->ExceptionCheck(env)) {
9545 (*env)->ExceptionDescribe(env);
9546 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
9548 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9549 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9550 if (ret_constr.datalen > 0)
9551 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9553 ret_constr.data = NULL;
9554 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9555 for (size_t y = 0; y < ret_constr.datalen; y++) {
9556 int64_t ret_conv_24 = ret_vals[y];
9557 LDKC2Tuple_PublicKeyTypeZ ret_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1);
9558 ret_conv_24_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1));
9559 ret_constr.data[y] = ret_conv_24_conv;
9561 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9562 if (get_jenv_res == JNI_EDETACHED) {
9563 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9567 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9568 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9569 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9570 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9572 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9573 jclass c = (*env)->GetObjectClass(env, o);
9575 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9576 atomic_init(&calls->refcnt, 1);
9577 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9578 calls->o = (*env)->NewWeakGlobalRef(env, o);
9579 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
9580 CHECK(calls->handle_custom_message_meth != NULL);
9581 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
9582 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
9584 LDKCustomMessageHandler ret = {
9585 .this_arg = (void*) calls,
9586 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9587 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9588 .free = LDKCustomMessageHandler_JCalls_free,
9589 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
9591 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9595 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9596 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
9597 return (uint64_t)res_ptr;
9599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
9600 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
9601 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
9602 DO_ASSERT((res_ptr & 1) == 0);
9603 return (int64_t)(res_ptr | 1);
9605 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) {
9606 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9607 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
9608 if (msg_conv.free == LDKType_JCalls_free) {
9609 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9610 LDKType_JCalls_cloned(&msg_conv);
9612 LDKPublicKey sender_node_id_ref;
9613 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
9614 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
9615 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9616 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9617 return (uint64_t)ret_conv;
9620 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
9621 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9622 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9623 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9624 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9625 for (size_t y = 0; y < ret_var.datalen; y++) {
9626 LDKC2Tuple_PublicKeyTypeZ* ret_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9627 *ret_conv_24_ref = ret_var.data[y];
9628 ret_arr_ptr[y] = (uint64_t)ret_conv_24_ref;
9630 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9635 typedef struct LDKSocketDescriptor_JCalls {
9636 atomic_size_t refcnt;
9639 jmethodID send_data_meth;
9640 jmethodID disconnect_socket_meth;
9642 jmethodID hash_meth;
9643 } LDKSocketDescriptor_JCalls;
9644 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
9645 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9646 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9648 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9649 if (get_jenv_res == JNI_EDETACHED) {
9650 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9652 DO_ASSERT(get_jenv_res == JNI_OK);
9654 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9655 if (get_jenv_res == JNI_EDETACHED) {
9656 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9661 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
9662 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9664 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9665 if (get_jenv_res == JNI_EDETACHED) {
9666 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9668 DO_ASSERT(get_jenv_res == JNI_OK);
9670 LDKu8slice data_var = data;
9671 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
9672 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
9673 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9675 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
9676 if ((*env)->ExceptionCheck(env)) {
9677 (*env)->ExceptionDescribe(env);
9678 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
9680 if (get_jenv_res == JNI_EDETACHED) {
9681 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9685 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
9686 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9688 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9689 if (get_jenv_res == JNI_EDETACHED) {
9690 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9692 DO_ASSERT(get_jenv_res == JNI_OK);
9694 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9696 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
9697 if ((*env)->ExceptionCheck(env)) {
9698 (*env)->ExceptionDescribe(env);
9699 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
9701 if (get_jenv_res == JNI_EDETACHED) {
9702 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9705 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
9706 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9708 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9709 if (get_jenv_res == JNI_EDETACHED) {
9710 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9712 DO_ASSERT(get_jenv_res == JNI_OK);
9714 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9715 *other_arg_clone = SocketDescriptor_clone(other_arg);
9716 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9718 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
9719 if ((*env)->ExceptionCheck(env)) {
9720 (*env)->ExceptionDescribe(env);
9721 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
9723 if (get_jenv_res == JNI_EDETACHED) {
9724 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9728 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
9729 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9731 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9732 if (get_jenv_res == JNI_EDETACHED) {
9733 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9735 DO_ASSERT(get_jenv_res == JNI_OK);
9737 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9739 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
9740 if ((*env)->ExceptionCheck(env)) {
9741 (*env)->ExceptionDescribe(env);
9742 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
9744 if (get_jenv_res == JNI_EDETACHED) {
9745 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9749 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
9750 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
9751 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9753 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
9754 jclass c = (*env)->GetObjectClass(env, o);
9756 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
9757 atomic_init(&calls->refcnt, 1);
9758 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9759 calls->o = (*env)->NewWeakGlobalRef(env, o);
9760 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
9761 CHECK(calls->send_data_meth != NULL);
9762 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
9763 CHECK(calls->disconnect_socket_meth != NULL);
9764 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
9765 CHECK(calls->eq_meth != NULL);
9766 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
9767 CHECK(calls->hash_meth != NULL);
9769 LDKSocketDescriptor ret = {
9770 .this_arg = (void*) calls,
9771 .send_data = send_data_LDKSocketDescriptor_jcall,
9772 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
9773 .eq = eq_LDKSocketDescriptor_jcall,
9774 .hash = hash_LDKSocketDescriptor_jcall,
9775 .cloned = LDKSocketDescriptor_JCalls_cloned,
9776 .free = LDKSocketDescriptor_JCalls_free,
9780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
9781 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9782 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
9783 return (uint64_t)res_ptr;
9785 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) {
9786 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9787 LDKu8slice data_ref;
9788 data_ref.datalen = (*env)->GetArrayLength(env, data);
9789 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
9790 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
9791 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
9795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
9796 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9797 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
9800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
9801 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9802 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
9806 typedef struct LDKChannelManagerPersister_JCalls {
9807 atomic_size_t refcnt;
9810 jmethodID persist_manager_meth;
9811 } LDKChannelManagerPersister_JCalls;
9812 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
9813 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
9814 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9816 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9817 if (get_jenv_res == JNI_EDETACHED) {
9818 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9820 DO_ASSERT(get_jenv_res == JNI_OK);
9822 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9823 if (get_jenv_res == JNI_EDETACHED) {
9824 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9829 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9830 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
9832 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9833 if (get_jenv_res == JNI_EDETACHED) {
9834 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9836 DO_ASSERT(get_jenv_res == JNI_OK);
9838 LDKChannelManager channel_manager_var = *channel_manager;
9839 // Warning: we may need a move here but no clone is available for LDKChannelManager
9840 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9841 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9842 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
9843 if (channel_manager_var.is_owned) {
9844 channel_manager_ref |= 1;
9846 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9848 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
9849 if ((*env)->ExceptionCheck(env)) {
9850 (*env)->ExceptionDescribe(env);
9851 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
9853 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
9854 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
9855 if (get_jenv_res == JNI_EDETACHED) {
9856 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9860 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
9861 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
9862 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9864 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
9865 jclass c = (*env)->GetObjectClass(env, o);
9867 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
9868 atomic_init(&calls->refcnt, 1);
9869 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9870 calls->o = (*env)->NewWeakGlobalRef(env, o);
9871 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
9872 CHECK(calls->persist_manager_meth != NULL);
9874 LDKChannelManagerPersister ret = {
9875 .this_arg = (void*) calls,
9876 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
9877 .free = LDKChannelManagerPersister_JCalls_free,
9881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
9882 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
9883 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
9884 return (uint64_t)res_ptr;
9886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
9887 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
9888 LDKChannelManager channel_manager_conv;
9889 channel_manager_conv.inner = (void*)(channel_manager & (~1));
9890 channel_manager_conv.is_owned = false;
9891 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9892 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9893 return (uint64_t)ret_conv;
9896 static jclass LDKFallback_SegWitProgram_class = NULL;
9897 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
9898 static jclass LDKFallback_PubKeyHash_class = NULL;
9899 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
9900 static jclass LDKFallback_ScriptHash_class = NULL;
9901 static jmethodID LDKFallback_ScriptHash_meth = NULL;
9902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
9903 LDKFallback_SegWitProgram_class =
9904 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
9905 CHECK(LDKFallback_SegWitProgram_class != NULL);
9906 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
9907 CHECK(LDKFallback_SegWitProgram_meth != NULL);
9908 LDKFallback_PubKeyHash_class =
9909 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
9910 CHECK(LDKFallback_PubKeyHash_class != NULL);
9911 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
9912 CHECK(LDKFallback_PubKeyHash_meth != NULL);
9913 LDKFallback_ScriptHash_class =
9914 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
9915 CHECK(LDKFallback_ScriptHash_class != NULL);
9916 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
9917 CHECK(LDKFallback_ScriptHash_meth != NULL);
9919 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9920 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9922 case LDKFallback_SegWitProgram: {
9923 uint8_t version_val = obj->seg_wit_program.version._0;
9924 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9925 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
9926 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
9927 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
9929 case LDKFallback_PubKeyHash: {
9930 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
9931 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
9932 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
9934 case LDKFallback_ScriptHash: {
9935 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
9936 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
9937 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
9942 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9943 LDKStr ret_str = _ldk_get_compiled_version();
9944 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9949 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9950 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
9951 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9957 LDKTransaction _res_ref;
9958 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9959 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
9960 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9961 _res_ref.data_is_owned = true;
9962 Transaction_free(_res_ref);
9965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
9966 LDKCVec_u8Z script_pubkey_ref;
9967 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9968 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
9969 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
9970 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9971 *ret_ref = TxOut_new(script_pubkey_ref, value);
9972 return (uint64_t)ret_ref;
9975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
9976 if ((_res & 1) != 0) return;
9977 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
9979 TxOut_free(_res_conv);
9982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9983 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
9984 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9985 *ret_ref = TxOut_clone(orig_conv);
9986 return (uint64_t)ret_ref;
9989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
9990 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
9994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9996 CHECK((*env)->GetArrayLength(env, o) == 32);
9997 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
9998 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9999 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10000 return (uint64_t)ret_conv;
10003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10004 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10005 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10006 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10007 return (uint64_t)ret_conv;
10010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10011 if ((_res & 1) != 0) return;
10012 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
10014 CResult_SecretKeyErrorZ_free(_res_conv);
10017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10018 LDKPublicKey o_ref;
10019 CHECK((*env)->GetArrayLength(env, o) == 33);
10020 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
10021 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10022 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10023 return (uint64_t)ret_conv;
10026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10027 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10028 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10029 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10030 return (uint64_t)ret_conv;
10033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10034 if ((_res & 1) != 0) return;
10035 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
10037 CResult_PublicKeyErrorZ_free(_res_conv);
10040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10041 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
10042 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10043 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10044 return (uint64_t)ret_conv;
10047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10048 LDKTxCreationKeys o_conv;
10049 o_conv.inner = (void*)(o & (~1));
10050 o_conv.is_owned = (o & 1) || (o == 0);
10051 o_conv = TxCreationKeys_clone(&o_conv);
10052 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10053 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10054 return (uint64_t)ret_conv;
10057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10058 LDKDecodeError e_conv;
10059 e_conv.inner = (void*)(e & (~1));
10060 e_conv.is_owned = (e & 1) || (e == 0);
10061 e_conv = DecodeError_clone(&e_conv);
10062 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10063 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10064 return (uint64_t)ret_conv;
10067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10068 if ((_res & 1) != 0) return;
10069 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10071 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10075 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
10076 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10077 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10078 return (uint64_t)ret_conv;
10081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10082 LDKChannelPublicKeys o_conv;
10083 o_conv.inner = (void*)(o & (~1));
10084 o_conv.is_owned = (o & 1) || (o == 0);
10085 o_conv = ChannelPublicKeys_clone(&o_conv);
10086 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10087 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10088 return (uint64_t)ret_conv;
10091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10092 LDKDecodeError e_conv;
10093 e_conv.inner = (void*)(e & (~1));
10094 e_conv.is_owned = (e & 1) || (e == 0);
10095 e_conv = DecodeError_clone(&e_conv);
10096 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10097 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10098 return (uint64_t)ret_conv;
10101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10102 if ((_res & 1) != 0) return;
10103 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10105 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10109 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
10110 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10111 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10112 return (uint64_t)ret_conv;
10115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10116 LDKTxCreationKeys o_conv;
10117 o_conv.inner = (void*)(o & (~1));
10118 o_conv.is_owned = (o & 1) || (o == 0);
10119 o_conv = TxCreationKeys_clone(&o_conv);
10120 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10121 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10122 return (uint64_t)ret_conv;
10125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10126 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10127 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10128 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10129 return (uint64_t)ret_conv;
10132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10133 if ((_res & 1) != 0) return;
10134 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
10136 CResult_TxCreationKeysErrorZ_free(_res_conv);
10139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10140 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
10141 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10142 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10143 return (uint64_t)ret_conv;
10146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
10147 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10148 *ret_copy = COption_u32Z_some(o);
10149 uint64_t ret_ref = (uint64_t)ret_copy;
10153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
10154 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10155 *ret_copy = COption_u32Z_none();
10156 uint64_t ret_ref = (uint64_t)ret_copy;
10160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10161 if ((_res & 1) != 0) return;
10162 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
10164 COption_u32Z_free(_res_conv);
10167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10168 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
10169 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10170 *ret_copy = COption_u32Z_clone(orig_conv);
10171 uint64_t ret_ref = (uint64_t)ret_copy;
10175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10176 LDKHTLCOutputInCommitment o_conv;
10177 o_conv.inner = (void*)(o & (~1));
10178 o_conv.is_owned = (o & 1) || (o == 0);
10179 o_conv = HTLCOutputInCommitment_clone(&o_conv);
10180 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10181 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10182 return (uint64_t)ret_conv;
10185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10186 LDKDecodeError e_conv;
10187 e_conv.inner = (void*)(e & (~1));
10188 e_conv.is_owned = (e & 1) || (e == 0);
10189 e_conv = DecodeError_clone(&e_conv);
10190 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10191 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10192 return (uint64_t)ret_conv;
10195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10196 if ((_res & 1) != 0) return;
10197 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
10199 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10203 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
10204 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10205 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10206 return (uint64_t)ret_conv;
10209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10210 LDKCounterpartyChannelTransactionParameters o_conv;
10211 o_conv.inner = (void*)(o & (~1));
10212 o_conv.is_owned = (o & 1) || (o == 0);
10213 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10214 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10215 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10216 return (uint64_t)ret_conv;
10219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10220 LDKDecodeError e_conv;
10221 e_conv.inner = (void*)(e & (~1));
10222 e_conv.is_owned = (e & 1) || (e == 0);
10223 e_conv = DecodeError_clone(&e_conv);
10224 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10225 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10226 return (uint64_t)ret_conv;
10229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10230 if ((_res & 1) != 0) return;
10231 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10233 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10237 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10238 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10239 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10240 return (uint64_t)ret_conv;
10243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10244 LDKChannelTransactionParameters o_conv;
10245 o_conv.inner = (void*)(o & (~1));
10246 o_conv.is_owned = (o & 1) || (o == 0);
10247 o_conv = ChannelTransactionParameters_clone(&o_conv);
10248 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10249 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10250 return (uint64_t)ret_conv;
10253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10254 LDKDecodeError e_conv;
10255 e_conv.inner = (void*)(e & (~1));
10256 e_conv.is_owned = (e & 1) || (e == 0);
10257 e_conv = DecodeError_clone(&e_conv);
10258 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10259 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10260 return (uint64_t)ret_conv;
10263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10264 if ((_res & 1) != 0) return;
10265 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10267 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10271 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10272 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10273 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10274 return (uint64_t)ret_conv;
10277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10278 LDKCVec_SignatureZ _res_constr;
10279 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10280 if (_res_constr.datalen > 0)
10281 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10283 _res_constr.data = NULL;
10284 for (size_t i = 0; i < _res_constr.datalen; i++) {
10285 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10286 LDKSignature _res_conv_8_ref;
10287 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
10288 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
10289 _res_constr.data[i] = _res_conv_8_ref;
10291 CVec_SignatureZ_free(_res_constr);
10294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10295 LDKHolderCommitmentTransaction o_conv;
10296 o_conv.inner = (void*)(o & (~1));
10297 o_conv.is_owned = (o & 1) || (o == 0);
10298 o_conv = HolderCommitmentTransaction_clone(&o_conv);
10299 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10300 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
10301 return (uint64_t)ret_conv;
10304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10305 LDKDecodeError e_conv;
10306 e_conv.inner = (void*)(e & (~1));
10307 e_conv.is_owned = (e & 1) || (e == 0);
10308 e_conv = DecodeError_clone(&e_conv);
10309 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10310 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
10311 return (uint64_t)ret_conv;
10314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10315 if ((_res & 1) != 0) return;
10316 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10318 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
10321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10322 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10323 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10324 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10325 return (uint64_t)ret_conv;
10328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10329 LDKBuiltCommitmentTransaction o_conv;
10330 o_conv.inner = (void*)(o & (~1));
10331 o_conv.is_owned = (o & 1) || (o == 0);
10332 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
10333 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10334 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
10335 return (uint64_t)ret_conv;
10338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10339 LDKDecodeError e_conv;
10340 e_conv.inner = (void*)(e & (~1));
10341 e_conv.is_owned = (e & 1) || (e == 0);
10342 e_conv = DecodeError_clone(&e_conv);
10343 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10344 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
10345 return (uint64_t)ret_conv;
10348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10349 if ((_res & 1) != 0) return;
10350 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10352 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
10355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10356 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10357 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10358 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10359 return (uint64_t)ret_conv;
10362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10363 LDKTrustedClosingTransaction o_conv;
10364 o_conv.inner = (void*)(o & (~1));
10365 o_conv.is_owned = (o & 1) || (o == 0);
10366 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
10367 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10368 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
10369 return (uint64_t)ret_conv;
10372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10373 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10374 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
10375 return (uint64_t)ret_conv;
10378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10379 if ((_res & 1) != 0) return;
10380 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
10382 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
10385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10386 LDKCommitmentTransaction o_conv;
10387 o_conv.inner = (void*)(o & (~1));
10388 o_conv.is_owned = (o & 1) || (o == 0);
10389 o_conv = CommitmentTransaction_clone(&o_conv);
10390 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10391 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
10392 return (uint64_t)ret_conv;
10395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10396 LDKDecodeError e_conv;
10397 e_conv.inner = (void*)(e & (~1));
10398 e_conv.is_owned = (e & 1) || (e == 0);
10399 e_conv = DecodeError_clone(&e_conv);
10400 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10401 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
10402 return (uint64_t)ret_conv;
10405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10406 if ((_res & 1) != 0) return;
10407 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10409 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
10412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10413 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
10414 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10415 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
10416 return (uint64_t)ret_conv;
10419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10420 LDKTrustedCommitmentTransaction o_conv;
10421 o_conv.inner = (void*)(o & (~1));
10422 o_conv.is_owned = (o & 1) || (o == 0);
10423 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
10424 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10425 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
10426 return (uint64_t)ret_conv;
10429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10430 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10431 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
10432 return (uint64_t)ret_conv;
10435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10436 if ((_res & 1) != 0) return;
10437 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
10439 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
10442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10443 LDKCVec_SignatureZ o_constr;
10444 o_constr.datalen = (*env)->GetArrayLength(env, o);
10445 if (o_constr.datalen > 0)
10446 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10448 o_constr.data = NULL;
10449 for (size_t i = 0; i < o_constr.datalen; i++) {
10450 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10451 LDKSignature o_conv_8_ref;
10452 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
10453 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
10454 o_constr.data[i] = o_conv_8_ref;
10456 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10457 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
10458 return (uint64_t)ret_conv;
10461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
10462 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10463 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
10464 return (uint64_t)ret_conv;
10467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10468 if ((_res & 1) != 0) return;
10469 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
10471 CResult_CVec_SignatureZNoneZ_free(_res_conv);
10474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10475 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
10476 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10477 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
10478 return (uint64_t)ret_conv;
10481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10482 LDKShutdownScript o_conv;
10483 o_conv.inner = (void*)(o & (~1));
10484 o_conv.is_owned = (o & 1) || (o == 0);
10485 o_conv = ShutdownScript_clone(&o_conv);
10486 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10487 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
10488 return (uint64_t)ret_conv;
10491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10492 LDKDecodeError e_conv;
10493 e_conv.inner = (void*)(e & (~1));
10494 e_conv.is_owned = (e & 1) || (e == 0);
10495 e_conv = DecodeError_clone(&e_conv);
10496 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10497 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
10498 return (uint64_t)ret_conv;
10501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10502 if ((_res & 1) != 0) return;
10503 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
10505 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
10508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10509 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
10510 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10511 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
10512 return (uint64_t)ret_conv;
10515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10516 LDKShutdownScript o_conv;
10517 o_conv.inner = (void*)(o & (~1));
10518 o_conv.is_owned = (o & 1) || (o == 0);
10519 o_conv = ShutdownScript_clone(&o_conv);
10520 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10521 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
10522 return (uint64_t)ret_conv;
10525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10526 LDKInvalidShutdownScript e_conv;
10527 e_conv.inner = (void*)(e & (~1));
10528 e_conv.is_owned = (e & 1) || (e == 0);
10529 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
10530 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10531 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
10532 return (uint64_t)ret_conv;
10535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10536 if ((_res & 1) != 0) return;
10537 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
10539 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
10542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
10543 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10544 *ret_conv = CResult_NoneErrorZ_ok();
10545 return (uint64_t)ret_conv;
10548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10549 LDKIOError e_conv = LDKIOError_from_java(env, e);
10550 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10551 *ret_conv = CResult_NoneErrorZ_err(e_conv);
10552 return (uint64_t)ret_conv;
10555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10556 if ((_res & 1) != 0) return;
10557 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
10559 CResult_NoneErrorZ_free(_res_conv);
10562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10563 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
10564 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10565 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
10566 return (uint64_t)ret_conv;
10569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10570 LDKRouteHop o_conv;
10571 o_conv.inner = (void*)(o & (~1));
10572 o_conv.is_owned = (o & 1) || (o == 0);
10573 o_conv = RouteHop_clone(&o_conv);
10574 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10575 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
10576 return (uint64_t)ret_conv;
10579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10580 LDKDecodeError e_conv;
10581 e_conv.inner = (void*)(e & (~1));
10582 e_conv.is_owned = (e & 1) || (e == 0);
10583 e_conv = DecodeError_clone(&e_conv);
10584 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10585 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
10586 return (uint64_t)ret_conv;
10589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10590 if ((_res & 1) != 0) return;
10591 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
10593 CResult_RouteHopDecodeErrorZ_free(_res_conv);
10596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10597 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
10598 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10599 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
10600 return (uint64_t)ret_conv;
10603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10604 LDKCVec_RouteHopZ _res_constr;
10605 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10606 if (_res_constr.datalen > 0)
10607 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10609 _res_constr.data = NULL;
10610 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10611 for (size_t k = 0; k < _res_constr.datalen; k++) {
10612 int64_t _res_conv_10 = _res_vals[k];
10613 LDKRouteHop _res_conv_10_conv;
10614 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
10615 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
10616 _res_constr.data[k] = _res_conv_10_conv;
10618 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10619 CVec_RouteHopZ_free(_res_constr);
10622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10623 LDKCVec_CVec_RouteHopZZ _res_constr;
10624 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10625 if (_res_constr.datalen > 0)
10626 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
10628 _res_constr.data = NULL;
10629 for (size_t m = 0; m < _res_constr.datalen; m++) {
10630 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
10631 LDKCVec_RouteHopZ _res_conv_12_constr;
10632 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
10633 if (_res_conv_12_constr.datalen > 0)
10634 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10636 _res_conv_12_constr.data = NULL;
10637 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
10638 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
10639 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
10640 LDKRouteHop _res_conv_12_conv_10_conv;
10641 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
10642 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
10643 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
10645 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
10646 _res_constr.data[m] = _res_conv_12_constr;
10648 CVec_CVec_RouteHopZZ_free(_res_constr);
10651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10653 o_conv.inner = (void*)(o & (~1));
10654 o_conv.is_owned = (o & 1) || (o == 0);
10655 o_conv = Route_clone(&o_conv);
10656 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10657 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
10658 return (uint64_t)ret_conv;
10661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10662 LDKDecodeError e_conv;
10663 e_conv.inner = (void*)(e & (~1));
10664 e_conv.is_owned = (e & 1) || (e == 0);
10665 e_conv = DecodeError_clone(&e_conv);
10666 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10667 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
10668 return (uint64_t)ret_conv;
10671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10672 if ((_res & 1) != 0) return;
10673 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
10675 CResult_RouteDecodeErrorZ_free(_res_conv);
10678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10679 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
10680 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10681 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
10682 return (uint64_t)ret_conv;
10685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
10686 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10687 *ret_copy = COption_u64Z_some(o);
10688 uint64_t ret_ref = (uint64_t)ret_copy;
10692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
10693 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10694 *ret_copy = COption_u64Z_none();
10695 uint64_t ret_ref = (uint64_t)ret_copy;
10699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10700 if ((_res & 1) != 0) return;
10701 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
10703 COption_u64Z_free(_res_conv);
10706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10707 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
10708 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10709 *ret_copy = COption_u64Z_clone(orig_conv);
10710 uint64_t ret_ref = (uint64_t)ret_copy;
10714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10715 LDKCVec_ChannelDetailsZ _res_constr;
10716 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10717 if (_res_constr.datalen > 0)
10718 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10720 _res_constr.data = NULL;
10721 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10722 for (size_t q = 0; q < _res_constr.datalen; q++) {
10723 int64_t _res_conv_16 = _res_vals[q];
10724 LDKChannelDetails _res_conv_16_conv;
10725 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10726 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10727 _res_constr.data[q] = _res_conv_16_conv;
10729 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10730 CVec_ChannelDetailsZ_free(_res_constr);
10733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10734 LDKCVec_RouteHintZ _res_constr;
10735 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10736 if (_res_constr.datalen > 0)
10737 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
10739 _res_constr.data = NULL;
10740 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10741 for (size_t l = 0; l < _res_constr.datalen; l++) {
10742 int64_t _res_conv_11 = _res_vals[l];
10743 LDKRouteHint _res_conv_11_conv;
10744 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
10745 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
10746 _res_constr.data[l] = _res_conv_11_conv;
10748 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10749 CVec_RouteHintZ_free(_res_constr);
10752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10754 o_conv.inner = (void*)(o & (~1));
10755 o_conv.is_owned = (o & 1) || (o == 0);
10756 o_conv = Route_clone(&o_conv);
10757 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10758 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
10759 return (uint64_t)ret_conv;
10762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10763 LDKLightningError e_conv;
10764 e_conv.inner = (void*)(e & (~1));
10765 e_conv.is_owned = (e & 1) || (e == 0);
10766 e_conv = LightningError_clone(&e_conv);
10767 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10768 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
10769 return (uint64_t)ret_conv;
10772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10773 if ((_res & 1) != 0) return;
10774 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
10776 CResult_RouteLightningErrorZ_free(_res_conv);
10779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10780 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
10781 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10782 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
10783 return (uint64_t)ret_conv;
10786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10787 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
10788 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
10789 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10790 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
10791 return (uint64_t)ret_conv;
10794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10795 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
10796 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10797 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
10798 return (uint64_t)ret_conv;
10801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10802 if ((_res & 1) != 0) return;
10803 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
10805 CResult_TxOutAccessErrorZ_free(_res_conv);
10808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10809 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
10810 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10811 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
10812 return (uint64_t)ret_conv;
10815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10816 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
10817 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10818 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
10819 return (uint64_t)ret_ref;
10822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
10823 LDKTransaction b_ref;
10824 b_ref.datalen = (*env)->GetArrayLength(env, b);
10825 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
10826 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10827 b_ref.data_is_owned = true;
10828 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10829 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
10830 return (uint64_t)ret_ref;
10833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10834 if ((_res & 1) != 0) return;
10835 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
10837 C2Tuple_usizeTransactionZ_free(_res_conv);
10840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10841 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
10842 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10843 if (_res_constr.datalen > 0)
10844 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10846 _res_constr.data = NULL;
10847 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10848 for (size_t y = 0; y < _res_constr.datalen; y++) {
10849 int64_t _res_conv_24 = _res_vals[y];
10850 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
10851 FREE((void*)_res_conv_24);
10852 _res_constr.data[y] = _res_conv_24_conv;
10854 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10855 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
10858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10859 LDKCVec_TxidZ _res_constr;
10860 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10861 if (_res_constr.datalen > 0)
10862 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10864 _res_constr.data = NULL;
10865 for (size_t i = 0; i < _res_constr.datalen; i++) {
10866 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10867 LDKThirtyTwoBytes _res_conv_8_ref;
10868 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
10869 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
10870 _res_constr.data[i] = _res_conv_8_ref;
10872 CVec_TxidZ_free(_res_constr);
10875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
10876 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10877 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
10878 return (uint64_t)ret_conv;
10881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
10882 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
10883 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10884 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
10885 return (uint64_t)ret_conv;
10888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10889 if ((_res & 1) != 0) return;
10890 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
10892 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
10895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10896 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
10897 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10898 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
10899 return (uint64_t)ret_conv;
10902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10903 LDKCVec_MonitorEventZ _res_constr;
10904 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10905 if (_res_constr.datalen > 0)
10906 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10908 _res_constr.data = NULL;
10909 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10910 for (size_t o = 0; o < _res_constr.datalen; o++) {
10911 int64_t _res_conv_14 = _res_vals[o];
10912 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
10913 FREE((void*)_res_conv_14);
10914 _res_constr.data[o] = _res_conv_14_conv;
10916 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10917 CVec_MonitorEventZ_free(_res_constr);
10920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
10921 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
10922 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
10923 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10924 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
10925 uint64_t ret_ref = (uint64_t)ret_copy;
10929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
10930 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10931 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
10932 uint64_t ret_ref = (uint64_t)ret_copy;
10936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10937 if ((_res & 1) != 0) return;
10938 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
10940 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
10943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10944 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
10945 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10946 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
10947 uint64_t ret_ref = (uint64_t)ret_copy;
10951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
10952 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
10953 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
10954 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10955 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
10956 uint64_t ret_ref = (uint64_t)ret_copy;
10960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
10961 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10962 *ret_copy = COption_NetworkUpdateZ_none();
10963 uint64_t ret_ref = (uint64_t)ret_copy;
10967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10968 if ((_res & 1) != 0) return;
10969 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
10971 COption_NetworkUpdateZ_free(_res_conv);
10974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10975 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
10976 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10977 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
10978 uint64_t ret_ref = (uint64_t)ret_copy;
10982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10983 LDKCVec_SpendableOutputDescriptorZ _res_constr;
10984 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10985 if (_res_constr.datalen > 0)
10986 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10988 _res_constr.data = NULL;
10989 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10990 for (size_t b = 0; b < _res_constr.datalen; b++) {
10991 int64_t _res_conv_27 = _res_vals[b];
10992 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
10993 FREE((void*)_res_conv_27);
10994 _res_constr.data[b] = _res_conv_27_conv;
10996 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10997 CVec_SpendableOutputDescriptorZ_free(_res_constr);
11000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11001 LDKCVec_MessageSendEventZ _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(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11006 _res_constr.data = NULL;
11007 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11008 for (size_t s = 0; s < _res_constr.datalen; s++) {
11009 int64_t _res_conv_18 = _res_vals[s];
11010 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
11011 FREE((void*)_res_conv_18);
11012 _res_constr.data[s] = _res_conv_18_conv;
11014 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11015 CVec_MessageSendEventZ_free(_res_constr);
11018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11019 LDKInitFeatures o_conv;
11020 o_conv.inner = (void*)(o & (~1));
11021 o_conv.is_owned = (o & 1) || (o == 0);
11022 o_conv = InitFeatures_clone(&o_conv);
11023 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11024 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
11025 return (uint64_t)ret_conv;
11028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11029 LDKDecodeError e_conv;
11030 e_conv.inner = (void*)(e & (~1));
11031 e_conv.is_owned = (e & 1) || (e == 0);
11032 e_conv = DecodeError_clone(&e_conv);
11033 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11034 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
11035 return (uint64_t)ret_conv;
11038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11039 if ((_res & 1) != 0) return;
11040 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11042 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
11045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11046 LDKNodeFeatures o_conv;
11047 o_conv.inner = (void*)(o & (~1));
11048 o_conv.is_owned = (o & 1) || (o == 0);
11049 o_conv = NodeFeatures_clone(&o_conv);
11050 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11051 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
11052 return (uint64_t)ret_conv;
11055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11056 LDKDecodeError e_conv;
11057 e_conv.inner = (void*)(e & (~1));
11058 e_conv.is_owned = (e & 1) || (e == 0);
11059 e_conv = DecodeError_clone(&e_conv);
11060 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11061 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
11062 return (uint64_t)ret_conv;
11065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11066 if ((_res & 1) != 0) return;
11067 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11069 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
11072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11073 LDKChannelFeatures o_conv;
11074 o_conv.inner = (void*)(o & (~1));
11075 o_conv.is_owned = (o & 1) || (o == 0);
11076 o_conv = ChannelFeatures_clone(&o_conv);
11077 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11078 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
11079 return (uint64_t)ret_conv;
11082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11083 LDKDecodeError e_conv;
11084 e_conv.inner = (void*)(e & (~1));
11085 e_conv.is_owned = (e & 1) || (e == 0);
11086 e_conv = DecodeError_clone(&e_conv);
11087 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11088 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
11089 return (uint64_t)ret_conv;
11092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11093 if ((_res & 1) != 0) return;
11094 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11096 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
11099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11100 LDKInvoiceFeatures o_conv;
11101 o_conv.inner = (void*)(o & (~1));
11102 o_conv.is_owned = (o & 1) || (o == 0);
11103 o_conv = InvoiceFeatures_clone(&o_conv);
11104 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11105 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
11106 return (uint64_t)ret_conv;
11109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11110 LDKDecodeError e_conv;
11111 e_conv.inner = (void*)(e & (~1));
11112 e_conv.is_owned = (e & 1) || (e == 0);
11113 e_conv = DecodeError_clone(&e_conv);
11114 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11115 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
11116 return (uint64_t)ret_conv;
11119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11120 if ((_res & 1) != 0) return;
11121 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11123 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
11126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11127 LDKDelayedPaymentOutputDescriptor o_conv;
11128 o_conv.inner = (void*)(o & (~1));
11129 o_conv.is_owned = (o & 1) || (o == 0);
11130 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
11131 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11132 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11133 return (uint64_t)ret_conv;
11136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11137 LDKDecodeError e_conv;
11138 e_conv.inner = (void*)(e & (~1));
11139 e_conv.is_owned = (e & 1) || (e == 0);
11140 e_conv = DecodeError_clone(&e_conv);
11141 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11142 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11143 return (uint64_t)ret_conv;
11146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11147 if ((_res & 1) != 0) return;
11148 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11150 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11154 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11155 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11156 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11157 return (uint64_t)ret_conv;
11160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11161 LDKStaticPaymentOutputDescriptor o_conv;
11162 o_conv.inner = (void*)(o & (~1));
11163 o_conv.is_owned = (o & 1) || (o == 0);
11164 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
11165 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11166 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11167 return (uint64_t)ret_conv;
11170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11171 LDKDecodeError e_conv;
11172 e_conv.inner = (void*)(e & (~1));
11173 e_conv.is_owned = (e & 1) || (e == 0);
11174 e_conv = DecodeError_clone(&e_conv);
11175 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11176 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11177 return (uint64_t)ret_conv;
11180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11181 if ((_res & 1) != 0) return;
11182 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11184 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11188 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11189 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11190 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11191 return (uint64_t)ret_conv;
11194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11195 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
11196 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
11197 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11198 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
11199 return (uint64_t)ret_conv;
11202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11203 LDKDecodeError e_conv;
11204 e_conv.inner = (void*)(e & (~1));
11205 e_conv.is_owned = (e & 1) || (e == 0);
11206 e_conv = DecodeError_clone(&e_conv);
11207 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11208 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
11209 return (uint64_t)ret_conv;
11212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11213 if ((_res & 1) != 0) return;
11214 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11216 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
11219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11220 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
11221 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11222 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
11223 return (uint64_t)ret_conv;
11226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
11227 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11228 *ret_conv = CResult_NoneNoneZ_ok();
11229 return (uint64_t)ret_conv;
11232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
11233 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11234 *ret_conv = CResult_NoneNoneZ_err();
11235 return (uint64_t)ret_conv;
11238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11239 if ((_res & 1) != 0) return;
11240 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
11242 CResult_NoneNoneZ_free(_res_conv);
11245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11246 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11247 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11248 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11249 return (uint64_t)ret_conv;
11252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11253 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
11254 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11255 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
11256 return (uint64_t)ret_ref;
11259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
11260 LDKSignature a_ref;
11261 CHECK((*env)->GetArrayLength(env, a) == 64);
11262 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
11263 LDKCVec_SignatureZ b_constr;
11264 b_constr.datalen = (*env)->GetArrayLength(env, b);
11265 if (b_constr.datalen > 0)
11266 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11268 b_constr.data = NULL;
11269 for (size_t i = 0; i < b_constr.datalen; i++) {
11270 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
11271 LDKSignature b_conv_8_ref;
11272 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
11273 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
11274 b_constr.data[i] = b_conv_8_ref;
11276 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11277 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
11278 return (uint64_t)ret_ref;
11281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11282 if ((_res & 1) != 0) return;
11283 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
11285 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
11288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11289 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
11290 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
11291 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11292 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
11293 return (uint64_t)ret_conv;
11296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
11297 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11298 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
11299 return (uint64_t)ret_conv;
11302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11303 if ((_res & 1) != 0) return;
11304 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
11306 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
11309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11310 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
11311 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11312 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
11313 return (uint64_t)ret_conv;
11316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11317 LDKSignature o_ref;
11318 CHECK((*env)->GetArrayLength(env, o) == 64);
11319 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
11320 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11321 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
11322 return (uint64_t)ret_conv;
11325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11326 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11327 *ret_conv = CResult_SignatureNoneZ_err();
11328 return (uint64_t)ret_conv;
11331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11332 if ((_res & 1) != 0) return;
11333 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
11335 CResult_SignatureNoneZ_free(_res_conv);
11338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11339 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
11340 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11341 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
11342 return (uint64_t)ret_conv;
11345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11346 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
11347 if (o_conv.free == LDKSign_JCalls_free) {
11348 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11349 LDKSign_JCalls_cloned(&o_conv);
11351 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11352 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
11353 return (uint64_t)ret_conv;
11356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11357 LDKDecodeError e_conv;
11358 e_conv.inner = (void*)(e & (~1));
11359 e_conv.is_owned = (e & 1) || (e == 0);
11360 e_conv = DecodeError_clone(&e_conv);
11361 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11362 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
11363 return (uint64_t)ret_conv;
11366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11367 if ((_res & 1) != 0) return;
11368 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
11370 CResult_SignDecodeErrorZ_free(_res_conv);
11373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11374 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
11375 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11376 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
11377 return (uint64_t)ret_conv;
11380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
11381 LDKCVec_u8Z _res_ref;
11382 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
11383 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11384 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
11385 CVec_u8Z_free(_res_ref);
11388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
11389 LDKRecoverableSignature arg_ref;
11390 CHECK((*env)->GetArrayLength(env, arg) == 68);
11391 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
11392 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11393 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
11394 return (uint64_t)ret_conv;
11397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11398 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11399 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
11400 return (uint64_t)ret_conv;
11403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11404 if ((_res & 1) != 0) return;
11405 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
11407 CResult_RecoverableSignatureNoneZ_free(_res_conv);
11410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11411 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
11412 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11413 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
11414 return (uint64_t)ret_conv;
11417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11418 LDKCVec_CVec_u8ZZ _res_constr;
11419 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11420 if (_res_constr.datalen > 0)
11421 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11423 _res_constr.data = NULL;
11424 for (size_t i = 0; i < _res_constr.datalen; i++) {
11425 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11426 LDKCVec_u8Z _res_conv_8_ref;
11427 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11428 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11429 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11430 _res_constr.data[i] = _res_conv_8_ref;
11432 CVec_CVec_u8ZZ_free(_res_constr);
11435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
11436 LDKCVec_CVec_u8ZZ o_constr;
11437 o_constr.datalen = (*env)->GetArrayLength(env, o);
11438 if (o_constr.datalen > 0)
11439 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11441 o_constr.data = NULL;
11442 for (size_t i = 0; i < o_constr.datalen; i++) {
11443 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
11444 LDKCVec_u8Z o_conv_8_ref;
11445 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
11446 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11447 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
11448 o_constr.data[i] = o_conv_8_ref;
11450 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11451 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
11452 return (uint64_t)ret_conv;
11455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
11456 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11457 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
11458 return (uint64_t)ret_conv;
11461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11462 if ((_res & 1) != 0) return;
11463 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
11465 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
11468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11469 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
11470 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11471 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
11472 return (uint64_t)ret_conv;
11475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11476 LDKInMemorySigner o_conv;
11477 o_conv.inner = (void*)(o & (~1));
11478 o_conv.is_owned = (o & 1) || (o == 0);
11479 o_conv = InMemorySigner_clone(&o_conv);
11480 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11481 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
11482 return (uint64_t)ret_conv;
11485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11486 LDKDecodeError e_conv;
11487 e_conv.inner = (void*)(e & (~1));
11488 e_conv.is_owned = (e & 1) || (e == 0);
11489 e_conv = DecodeError_clone(&e_conv);
11490 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11491 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
11492 return (uint64_t)ret_conv;
11495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11496 if ((_res & 1) != 0) return;
11497 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
11499 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
11502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11503 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
11504 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11505 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
11506 return (uint64_t)ret_conv;
11509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11510 LDKCVec_TxOutZ _res_constr;
11511 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11512 if (_res_constr.datalen > 0)
11513 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11515 _res_constr.data = NULL;
11516 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11517 for (size_t h = 0; h < _res_constr.datalen; h++) {
11518 int64_t _res_conv_7 = _res_vals[h];
11519 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
11520 FREE((void*)_res_conv_7);
11521 _res_constr.data[h] = _res_conv_7_conv;
11523 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11524 CVec_TxOutZ_free(_res_constr);
11527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11528 LDKTransaction o_ref;
11529 o_ref.datalen = (*env)->GetArrayLength(env, o);
11530 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
11531 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11532 o_ref.data_is_owned = true;
11533 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11534 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
11535 return (uint64_t)ret_conv;
11538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
11539 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11540 *ret_conv = CResult_TransactionNoneZ_err();
11541 return (uint64_t)ret_conv;
11544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11545 if ((_res & 1) != 0) return;
11546 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
11548 CResult_TransactionNoneZ_free(_res_conv);
11551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11552 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
11553 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11554 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
11555 return (uint64_t)ret_conv;
11558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
11559 LDKThirtyTwoBytes a_ref;
11560 CHECK((*env)->GetArrayLength(env, a) == 32);
11561 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11562 LDKChannelMonitor b_conv;
11563 b_conv.inner = (void*)(b & (~1));
11564 b_conv.is_owned = (b & 1) || (b == 0);
11565 b_conv = ChannelMonitor_clone(&b_conv);
11566 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
11567 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
11568 return (uint64_t)ret_ref;
11571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11572 if ((_res & 1) != 0) return;
11573 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
11575 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
11578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11579 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
11580 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11581 if (_res_constr.datalen > 0)
11582 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11584 _res_constr.data = NULL;
11585 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11586 for (size_t i = 0; i < _res_constr.datalen; i++) {
11587 int64_t _res_conv_34 = _res_vals[i];
11588 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
11589 FREE((void*)_res_conv_34);
11590 _res_constr.data[i] = _res_conv_34_conv;
11592 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11593 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
11596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
11597 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
11598 o_constr.datalen = (*env)->GetArrayLength(env, o);
11599 if (o_constr.datalen > 0)
11600 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11602 o_constr.data = NULL;
11603 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
11604 for (size_t i = 0; i < o_constr.datalen; i++) {
11605 int64_t o_conv_34 = o_vals[i];
11606 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
11607 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
11608 o_constr.data[i] = o_conv_34_conv;
11610 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
11611 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11612 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
11613 return (uint64_t)ret_conv;
11616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11617 LDKIOError e_conv = LDKIOError_from_java(env, e);
11618 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11619 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
11620 return (uint64_t)ret_conv;
11623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11624 if ((_res & 1) != 0) return;
11625 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
11627 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
11630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
11631 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11632 *ret_copy = COption_u16Z_some(o);
11633 uint64_t ret_ref = (uint64_t)ret_copy;
11637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
11638 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11639 *ret_copy = COption_u16Z_none();
11640 uint64_t ret_ref = (uint64_t)ret_copy;
11644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11645 if ((_res & 1) != 0) return;
11646 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
11648 COption_u16Z_free(_res_conv);
11651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11652 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
11653 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11654 *ret_copy = COption_u16Z_clone(orig_conv);
11655 uint64_t ret_ref = (uint64_t)ret_copy;
11659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
11660 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11661 *ret_conv = CResult_NoneAPIErrorZ_ok();
11662 return (uint64_t)ret_conv;
11665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11666 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
11667 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11668 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11669 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
11670 return (uint64_t)ret_conv;
11673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11674 if ((_res & 1) != 0) return;
11675 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
11677 CResult_NoneAPIErrorZ_free(_res_conv);
11680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11681 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
11682 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11683 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
11684 return (uint64_t)ret_conv;
11687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11688 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11689 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11690 if (_res_constr.datalen > 0)
11691 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11693 _res_constr.data = NULL;
11694 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11695 for (size_t w = 0; w < _res_constr.datalen; w++) {
11696 int64_t _res_conv_22 = _res_vals[w];
11697 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
11698 FREE((void*)_res_conv_22);
11699 _res_constr.data[w] = _res_conv_22_conv;
11701 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11702 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11706 LDKCVec_APIErrorZ _res_constr;
11707 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11708 if (_res_constr.datalen > 0)
11709 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11711 _res_constr.data = NULL;
11712 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11713 for (size_t k = 0; k < _res_constr.datalen; k++) {
11714 int64_t _res_conv_10 = _res_vals[k];
11715 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
11716 FREE((void*)_res_conv_10);
11717 _res_constr.data[k] = _res_conv_10_conv;
11719 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11720 CVec_APIErrorZ_free(_res_constr);
11723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
11724 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11725 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
11726 return (uint64_t)ret_conv;
11729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11730 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
11731 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11732 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11733 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
11734 return (uint64_t)ret_conv;
11737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11738 if ((_res & 1) != 0) return;
11739 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
11741 CResult_NonePaymentSendFailureZ_free(_res_conv);
11744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11745 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
11746 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11747 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
11748 return (uint64_t)ret_conv;
11751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11752 LDKThirtyTwoBytes o_ref;
11753 CHECK((*env)->GetArrayLength(env, o) == 32);
11754 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
11755 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11756 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
11757 return (uint64_t)ret_conv;
11760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11761 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
11762 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11763 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11764 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
11765 return (uint64_t)ret_conv;
11768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11769 if ((_res & 1) != 0) return;
11770 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
11772 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
11775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11776 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
11777 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11778 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
11779 return (uint64_t)ret_conv;
11782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11783 LDKCVec_NetAddressZ _res_constr;
11784 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11785 if (_res_constr.datalen > 0)
11786 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11788 _res_constr.data = NULL;
11789 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11790 for (size_t m = 0; m < _res_constr.datalen; m++) {
11791 int64_t _res_conv_12 = _res_vals[m];
11792 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
11793 FREE((void*)_res_conv_12);
11794 _res_constr.data[m] = _res_conv_12_conv;
11796 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11797 CVec_NetAddressZ_free(_res_constr);
11800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11801 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
11802 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11803 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
11804 return (uint64_t)ret_ref;
11807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
11808 LDKThirtyTwoBytes a_ref;
11809 CHECK((*env)->GetArrayLength(env, a) == 32);
11810 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11811 LDKThirtyTwoBytes b_ref;
11812 CHECK((*env)->GetArrayLength(env, b) == 32);
11813 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
11814 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11815 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
11816 return (uint64_t)ret_ref;
11819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11820 if ((_res & 1) != 0) return;
11821 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
11823 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
11826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11827 LDKThirtyTwoBytes o_ref;
11828 CHECK((*env)->GetArrayLength(env, o) == 32);
11829 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
11830 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11831 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
11832 return (uint64_t)ret_conv;
11835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11836 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
11837 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11838 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11839 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
11840 return (uint64_t)ret_conv;
11843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11844 if ((_res & 1) != 0) return;
11845 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
11847 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
11850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11851 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
11852 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11853 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
11854 return (uint64_t)ret_conv;
11857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11858 LDKCVec_ChannelMonitorZ _res_constr;
11859 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11860 if (_res_constr.datalen > 0)
11861 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11863 _res_constr.data = NULL;
11864 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11865 for (size_t q = 0; q < _res_constr.datalen; q++) {
11866 int64_t _res_conv_16 = _res_vals[q];
11867 LDKChannelMonitor _res_conv_16_conv;
11868 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11869 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11870 _res_constr.data[q] = _res_conv_16_conv;
11872 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11873 CVec_ChannelMonitorZ_free(_res_constr);
11876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
11877 LDKThirtyTwoBytes a_ref;
11878 CHECK((*env)->GetArrayLength(env, a) == 32);
11879 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11880 LDKChannelManager b_conv;
11881 b_conv.inner = (void*)(b & (~1));
11882 b_conv.is_owned = (b & 1) || (b == 0);
11883 // Warning: we need a move here but no clone is available for LDKChannelManager
11884 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
11885 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
11886 return (uint64_t)ret_ref;
11889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11890 if ((_res & 1) != 0) return;
11891 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
11893 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
11896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11897 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
11898 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
11899 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11900 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
11901 return (uint64_t)ret_conv;
11904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11905 LDKDecodeError e_conv;
11906 e_conv.inner = (void*)(e & (~1));
11907 e_conv.is_owned = (e & 1) || (e == 0);
11908 e_conv = DecodeError_clone(&e_conv);
11909 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11910 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
11911 return (uint64_t)ret_conv;
11914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11915 if ((_res & 1) != 0) return;
11916 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11918 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
11921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11922 LDKChannelConfig o_conv;
11923 o_conv.inner = (void*)(o & (~1));
11924 o_conv.is_owned = (o & 1) || (o == 0);
11925 o_conv = ChannelConfig_clone(&o_conv);
11926 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11927 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
11928 return (uint64_t)ret_conv;
11931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11932 LDKDecodeError e_conv;
11933 e_conv.inner = (void*)(e & (~1));
11934 e_conv.is_owned = (e & 1) || (e == 0);
11935 e_conv = DecodeError_clone(&e_conv);
11936 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11937 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
11938 return (uint64_t)ret_conv;
11941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11942 if ((_res & 1) != 0) return;
11943 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
11945 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
11948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11949 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
11950 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11951 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
11952 return (uint64_t)ret_conv;
11955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11956 LDKOutPoint o_conv;
11957 o_conv.inner = (void*)(o & (~1));
11958 o_conv.is_owned = (o & 1) || (o == 0);
11959 o_conv = OutPoint_clone(&o_conv);
11960 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11961 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
11962 return (uint64_t)ret_conv;
11965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11966 LDKDecodeError e_conv;
11967 e_conv.inner = (void*)(e & (~1));
11968 e_conv.is_owned = (e & 1) || (e == 0);
11969 e_conv = DecodeError_clone(&e_conv);
11970 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11971 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
11972 return (uint64_t)ret_conv;
11975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11976 if ((_res & 1) != 0) return;
11977 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
11979 CResult_OutPointDecodeErrorZ_free(_res_conv);
11982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11983 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
11984 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11985 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
11986 return (uint64_t)ret_conv;
11989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11990 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
11991 if (o_conv.free == LDKType_JCalls_free) {
11992 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11993 LDKType_JCalls_cloned(&o_conv);
11995 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11996 *ret_copy = COption_TypeZ_some(o_conv);
11997 uint64_t ret_ref = (uint64_t)ret_copy;
12001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
12002 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12003 *ret_copy = COption_TypeZ_none();
12004 uint64_t ret_ref = (uint64_t)ret_copy;
12008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12009 if ((_res & 1) != 0) return;
12010 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
12012 COption_TypeZ_free(_res_conv);
12015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12016 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
12017 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12018 *ret_copy = COption_TypeZ_clone(orig_conv);
12019 uint64_t ret_ref = (uint64_t)ret_copy;
12023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12024 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
12025 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
12026 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12027 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
12028 return (uint64_t)ret_conv;
12031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12032 LDKDecodeError e_conv;
12033 e_conv.inner = (void*)(e & (~1));
12034 e_conv.is_owned = (e & 1) || (e == 0);
12035 e_conv = DecodeError_clone(&e_conv);
12036 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12037 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
12038 return (uint64_t)ret_conv;
12041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12042 if ((_res & 1) != 0) return;
12043 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12045 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
12048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12049 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
12050 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12051 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
12052 return (uint64_t)ret_conv;
12055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
12056 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
12057 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12058 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
12059 return (uint64_t)ret_conv;
12062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
12063 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12064 *ret_conv = CResult_SiPrefixNoneZ_err();
12065 return (uint64_t)ret_conv;
12068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12069 if ((_res & 1) != 0) return;
12070 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
12072 CResult_SiPrefixNoneZ_free(_res_conv);
12075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12076 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
12077 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12078 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
12079 return (uint64_t)ret_conv;
12082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12084 o_conv.inner = (void*)(o & (~1));
12085 o_conv.is_owned = (o & 1) || (o == 0);
12086 o_conv = Invoice_clone(&o_conv);
12087 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12088 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
12089 return (uint64_t)ret_conv;
12092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12093 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12094 *ret_conv = CResult_InvoiceNoneZ_err();
12095 return (uint64_t)ret_conv;
12098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12099 if ((_res & 1) != 0) return;
12100 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
12102 CResult_InvoiceNoneZ_free(_res_conv);
12105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12106 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
12107 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12108 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
12109 return (uint64_t)ret_conv;
12112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12113 LDKSignedRawInvoice o_conv;
12114 o_conv.inner = (void*)(o & (~1));
12115 o_conv.is_owned = (o & 1) || (o == 0);
12116 o_conv = SignedRawInvoice_clone(&o_conv);
12117 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12118 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
12119 return (uint64_t)ret_conv;
12122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12123 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12124 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
12125 return (uint64_t)ret_conv;
12128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12129 if ((_res & 1) != 0) return;
12130 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
12132 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
12135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12136 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
12137 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12138 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
12139 return (uint64_t)ret_conv;
12142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12143 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
12144 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12145 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
12146 return (uint64_t)ret_ref;
12149 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) {
12150 LDKRawInvoice a_conv;
12151 a_conv.inner = (void*)(a & (~1));
12152 a_conv.is_owned = (a & 1) || (a == 0);
12153 a_conv = RawInvoice_clone(&a_conv);
12154 LDKThirtyTwoBytes b_ref;
12155 CHECK((*env)->GetArrayLength(env, b) == 32);
12156 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
12157 LDKInvoiceSignature c_conv;
12158 c_conv.inner = (void*)(c & (~1));
12159 c_conv.is_owned = (c & 1) || (c == 0);
12160 c_conv = InvoiceSignature_clone(&c_conv);
12161 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12162 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
12163 return (uint64_t)ret_ref;
12166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12167 if ((_res & 1) != 0) return;
12168 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
12170 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
12173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12174 LDKPayeePubKey o_conv;
12175 o_conv.inner = (void*)(o & (~1));
12176 o_conv.is_owned = (o & 1) || (o == 0);
12177 o_conv = PayeePubKey_clone(&o_conv);
12178 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12179 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
12180 return (uint64_t)ret_conv;
12183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12184 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
12185 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12186 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
12187 return (uint64_t)ret_conv;
12190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12191 if ((_res & 1) != 0) return;
12192 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
12194 CResult_PayeePubKeyErrorZ_free(_res_conv);
12197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12198 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
12199 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12200 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
12201 return (uint64_t)ret_conv;
12204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12205 LDKCVec_PrivateRouteZ _res_constr;
12206 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12207 if (_res_constr.datalen > 0)
12208 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
12210 _res_constr.data = NULL;
12211 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12212 for (size_t o = 0; o < _res_constr.datalen; o++) {
12213 int64_t _res_conv_14 = _res_vals[o];
12214 LDKPrivateRoute _res_conv_14_conv;
12215 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12216 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12217 _res_constr.data[o] = _res_conv_14_conv;
12219 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12220 CVec_PrivateRouteZ_free(_res_constr);
12223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12224 LDKPositiveTimestamp o_conv;
12225 o_conv.inner = (void*)(o & (~1));
12226 o_conv.is_owned = (o & 1) || (o == 0);
12227 o_conv = PositiveTimestamp_clone(&o_conv);
12228 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12229 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
12230 return (uint64_t)ret_conv;
12233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12234 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12235 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12236 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
12237 return (uint64_t)ret_conv;
12240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12241 if ((_res & 1) != 0) return;
12242 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
12244 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
12247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12248 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
12249 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12250 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
12251 return (uint64_t)ret_conv;
12254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
12255 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12256 *ret_conv = CResult_NoneSemanticErrorZ_ok();
12257 return (uint64_t)ret_conv;
12260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12261 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12262 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12263 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
12264 return (uint64_t)ret_conv;
12267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12268 if ((_res & 1) != 0) return;
12269 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
12271 CResult_NoneSemanticErrorZ_free(_res_conv);
12274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12275 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
12276 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12277 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
12278 return (uint64_t)ret_conv;
12281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12283 o_conv.inner = (void*)(o & (~1));
12284 o_conv.is_owned = (o & 1) || (o == 0);
12285 o_conv = Invoice_clone(&o_conv);
12286 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12287 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
12288 return (uint64_t)ret_conv;
12291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12292 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12293 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12294 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
12295 return (uint64_t)ret_conv;
12298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12299 if ((_res & 1) != 0) return;
12300 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
12302 CResult_InvoiceSemanticErrorZ_free(_res_conv);
12305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12306 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
12307 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12308 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
12309 return (uint64_t)ret_conv;
12312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12313 LDKDescription o_conv;
12314 o_conv.inner = (void*)(o & (~1));
12315 o_conv.is_owned = (o & 1) || (o == 0);
12316 o_conv = Description_clone(&o_conv);
12317 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12318 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
12319 return (uint64_t)ret_conv;
12322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12323 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12324 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12325 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
12326 return (uint64_t)ret_conv;
12329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12330 if ((_res & 1) != 0) return;
12331 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
12333 CResult_DescriptionCreationErrorZ_free(_res_conv);
12336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12337 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
12338 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12339 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
12340 return (uint64_t)ret_conv;
12343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12344 LDKExpiryTime o_conv;
12345 o_conv.inner = (void*)(o & (~1));
12346 o_conv.is_owned = (o & 1) || (o == 0);
12347 o_conv = ExpiryTime_clone(&o_conv);
12348 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12349 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
12350 return (uint64_t)ret_conv;
12353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12354 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12355 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12356 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
12357 return (uint64_t)ret_conv;
12360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12361 if ((_res & 1) != 0) return;
12362 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
12364 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
12367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12368 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
12369 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12370 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
12371 return (uint64_t)ret_conv;
12374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12375 LDKPrivateRoute o_conv;
12376 o_conv.inner = (void*)(o & (~1));
12377 o_conv.is_owned = (o & 1) || (o == 0);
12378 o_conv = PrivateRoute_clone(&o_conv);
12379 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12380 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
12381 return (uint64_t)ret_conv;
12384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12385 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12386 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12387 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
12388 return (uint64_t)ret_conv;
12391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12392 if ((_res & 1) != 0) return;
12393 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
12395 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
12398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12399 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
12400 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12401 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
12402 return (uint64_t)ret_conv;
12405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
12406 LDKStr o_conv = java_to_owned_str(env, o);
12407 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12408 *ret_conv = CResult_StringErrorZ_ok(o_conv);
12409 return (uint64_t)ret_conv;
12412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12413 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
12414 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12415 *ret_conv = CResult_StringErrorZ_err(e_conv);
12416 return (uint64_t)ret_conv;
12419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12420 if ((_res & 1) != 0) return;
12421 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
12423 CResult_StringErrorZ_free(_res_conv);
12426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12427 LDKChannelMonitorUpdate o_conv;
12428 o_conv.inner = (void*)(o & (~1));
12429 o_conv.is_owned = (o & 1) || (o == 0);
12430 o_conv = ChannelMonitorUpdate_clone(&o_conv);
12431 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12432 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
12433 return (uint64_t)ret_conv;
12436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12437 LDKDecodeError e_conv;
12438 e_conv.inner = (void*)(e & (~1));
12439 e_conv.is_owned = (e & 1) || (e == 0);
12440 e_conv = DecodeError_clone(&e_conv);
12441 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12442 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
12443 return (uint64_t)ret_conv;
12446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12447 if ((_res & 1) != 0) return;
12448 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12450 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
12453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12454 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
12455 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12456 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
12457 return (uint64_t)ret_conv;
12460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12461 LDKHTLCUpdate o_conv;
12462 o_conv.inner = (void*)(o & (~1));
12463 o_conv.is_owned = (o & 1) || (o == 0);
12464 o_conv = HTLCUpdate_clone(&o_conv);
12465 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12466 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
12467 return (uint64_t)ret_conv;
12470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12471 LDKDecodeError e_conv;
12472 e_conv.inner = (void*)(e & (~1));
12473 e_conv.is_owned = (e & 1) || (e == 0);
12474 e_conv = DecodeError_clone(&e_conv);
12475 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12476 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
12477 return (uint64_t)ret_conv;
12480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12481 if ((_res & 1) != 0) return;
12482 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12484 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
12487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12488 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
12489 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12490 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
12491 return (uint64_t)ret_conv;
12494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
12495 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12496 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
12497 return (uint64_t)ret_conv;
12500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12501 LDKMonitorUpdateError e_conv;
12502 e_conv.inner = (void*)(e & (~1));
12503 e_conv.is_owned = (e & 1) || (e == 0);
12504 e_conv = MonitorUpdateError_clone(&e_conv);
12505 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12506 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
12507 return (uint64_t)ret_conv;
12510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12511 if ((_res & 1) != 0) return;
12512 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
12514 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
12517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12518 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
12519 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12520 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
12521 return (uint64_t)ret_conv;
12524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12525 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
12526 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12527 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
12528 return (uint64_t)ret_ref;
12531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
12532 LDKOutPoint a_conv;
12533 a_conv.inner = (void*)(a & (~1));
12534 a_conv.is_owned = (a & 1) || (a == 0);
12535 a_conv = OutPoint_clone(&a_conv);
12537 b_ref.datalen = (*env)->GetArrayLength(env, b);
12538 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12539 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
12540 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12541 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
12542 return (uint64_t)ret_ref;
12545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12546 if ((_res & 1) != 0) return;
12547 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
12549 C2Tuple_OutPointScriptZ_free(_res_conv);
12552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12553 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
12554 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12555 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
12556 return (uint64_t)ret_ref;
12559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
12561 b_ref.datalen = (*env)->GetArrayLength(env, b);
12562 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12563 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
12564 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12565 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
12566 return (uint64_t)ret_ref;
12569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12570 if ((_res & 1) != 0) return;
12571 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
12573 C2Tuple_u32ScriptZ_free(_res_conv);
12576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12577 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
12578 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12579 if (_res_constr.datalen > 0)
12580 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12582 _res_constr.data = NULL;
12583 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12584 for (size_t b = 0; b < _res_constr.datalen; b++) {
12585 int64_t _res_conv_27 = _res_vals[b];
12586 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
12587 FREE((void*)_res_conv_27);
12588 _res_constr.data[b] = _res_conv_27_conv;
12590 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12591 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
12594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12595 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
12596 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12597 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
12598 return (uint64_t)ret_ref;
12601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
12602 LDKThirtyTwoBytes a_ref;
12603 CHECK((*env)->GetArrayLength(env, a) == 32);
12604 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12605 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
12606 b_constr.datalen = (*env)->GetArrayLength(env, b);
12607 if (b_constr.datalen > 0)
12608 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12610 b_constr.data = NULL;
12611 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
12612 for (size_t b = 0; b < b_constr.datalen; b++) {
12613 int64_t b_conv_27 = b_vals[b];
12614 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
12615 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
12616 b_constr.data[b] = b_conv_27_conv;
12618 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
12619 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12620 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
12621 return (uint64_t)ret_ref;
12624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12625 if ((_res & 1) != 0) return;
12626 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
12628 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
12631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12632 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
12633 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12634 if (_res_constr.datalen > 0)
12635 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
12637 _res_constr.data = NULL;
12638 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12639 for (size_t v = 0; v < _res_constr.datalen; v++) {
12640 int64_t _res_conv_47 = _res_vals[v];
12641 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
12642 FREE((void*)_res_conv_47);
12643 _res_constr.data[v] = _res_conv_47_conv;
12645 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12646 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
12649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12650 LDKCVec_EventZ _res_constr;
12651 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12652 if (_res_constr.datalen > 0)
12653 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
12655 _res_constr.data = NULL;
12656 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12657 for (size_t h = 0; h < _res_constr.datalen; h++) {
12658 int64_t _res_conv_7 = _res_vals[h];
12659 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
12660 FREE((void*)_res_conv_7);
12661 _res_constr.data[h] = _res_conv_7_conv;
12663 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12664 CVec_EventZ_free(_res_constr);
12667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12668 LDKCVec_TransactionZ _res_constr;
12669 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12670 if (_res_constr.datalen > 0)
12671 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
12673 _res_constr.data = NULL;
12674 for (size_t i = 0; i < _res_constr.datalen; i++) {
12675 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
12676 LDKTransaction _res_conv_8_ref;
12677 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
12678 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
12679 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
12680 _res_conv_8_ref.data_is_owned = true;
12681 _res_constr.data[i] = _res_conv_8_ref;
12683 CVec_TransactionZ_free(_res_constr);
12686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12687 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
12688 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12689 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
12690 return (uint64_t)ret_ref;
12693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
12694 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
12695 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
12696 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12697 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
12698 return (uint64_t)ret_ref;
12701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12702 if ((_res & 1) != 0) return;
12703 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
12705 C2Tuple_u32TxOutZ_free(_res_conv);
12708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12709 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
12710 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12711 if (_res_constr.datalen > 0)
12712 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12714 _res_constr.data = NULL;
12715 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12716 for (size_t a = 0; a < _res_constr.datalen; a++) {
12717 int64_t _res_conv_26 = _res_vals[a];
12718 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
12719 FREE((void*)_res_conv_26);
12720 _res_constr.data[a] = _res_conv_26_conv;
12722 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12723 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
12726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12727 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
12728 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12729 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
12730 return (uint64_t)ret_ref;
12733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
12734 LDKThirtyTwoBytes a_ref;
12735 CHECK((*env)->GetArrayLength(env, a) == 32);
12736 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12737 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
12738 b_constr.datalen = (*env)->GetArrayLength(env, b);
12739 if (b_constr.datalen > 0)
12740 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12742 b_constr.data = NULL;
12743 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
12744 for (size_t a = 0; a < b_constr.datalen; a++) {
12745 int64_t b_conv_26 = b_vals[a];
12746 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
12747 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
12748 b_constr.data[a] = b_conv_26_conv;
12750 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
12751 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12752 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
12753 return (uint64_t)ret_ref;
12756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12757 if ((_res & 1) != 0) return;
12758 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
12760 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
12763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12764 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
12765 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12766 if (_res_constr.datalen > 0)
12767 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
12769 _res_constr.data = NULL;
12770 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12771 for (size_t u = 0; u < _res_constr.datalen; u++) {
12772 int64_t _res_conv_46 = _res_vals[u];
12773 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
12774 FREE((void*)_res_conv_46);
12775 _res_constr.data[u] = _res_conv_46_conv;
12777 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12778 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
12781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12782 LDKCVec_BalanceZ _res_constr;
12783 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12784 if (_res_constr.datalen > 0)
12785 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
12787 _res_constr.data = NULL;
12788 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12789 for (size_t j = 0; j < _res_constr.datalen; j++) {
12790 int64_t _res_conv_9 = _res_vals[j];
12791 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
12792 FREE((void*)_res_conv_9);
12793 _res_constr.data[j] = _res_conv_9_conv;
12795 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12796 CVec_BalanceZ_free(_res_constr);
12799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12800 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
12801 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
12802 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12803 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
12804 return (uint64_t)ret_conv;
12807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12808 LDKDecodeError e_conv;
12809 e_conv.inner = (void*)(e & (~1));
12810 e_conv.is_owned = (e & 1) || (e == 0);
12811 e_conv = DecodeError_clone(&e_conv);
12812 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12813 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
12814 return (uint64_t)ret_conv;
12817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12818 if ((_res & 1) != 0) return;
12819 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12821 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
12824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
12825 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12826 *ret_conv = CResult_NoneLightningErrorZ_ok();
12827 return (uint64_t)ret_conv;
12830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12831 LDKLightningError e_conv;
12832 e_conv.inner = (void*)(e & (~1));
12833 e_conv.is_owned = (e & 1) || (e == 0);
12834 e_conv = LightningError_clone(&e_conv);
12835 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12836 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
12837 return (uint64_t)ret_conv;
12840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12841 if ((_res & 1) != 0) return;
12842 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
12844 CResult_NoneLightningErrorZ_free(_res_conv);
12847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12848 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
12849 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12850 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
12851 return (uint64_t)ret_conv;
12854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12855 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
12856 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12857 *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
12858 return (uint64_t)ret_ref;
12861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12862 LDKPublicKey a_ref;
12863 CHECK((*env)->GetArrayLength(env, a) == 33);
12864 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
12865 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
12866 if (b_conv.free == LDKType_JCalls_free) {
12867 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12868 LDKType_JCalls_cloned(&b_conv);
12870 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12871 *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
12872 return (uint64_t)ret_ref;
12875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12876 if ((_res & 1) != 0) return;
12877 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
12879 C2Tuple_PublicKeyTypeZ_free(_res_conv);
12882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12883 LDKCVec_C2Tuple_PublicKeyTypeZZ _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_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12888 _res_constr.data = NULL;
12889 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12890 for (size_t y = 0; y < _res_constr.datalen; y++) {
12891 int64_t _res_conv_24 = _res_vals[y];
12892 LDKC2Tuple_PublicKeyTypeZ _res_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_24) & ~1);
12893 FREE((void*)_res_conv_24);
12894 _res_constr.data[y] = _res_conv_24_conv;
12896 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12897 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
12900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
12901 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12902 *ret_conv = CResult_boolLightningErrorZ_ok(o);
12903 return (uint64_t)ret_conv;
12906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12907 LDKLightningError e_conv;
12908 e_conv.inner = (void*)(e & (~1));
12909 e_conv.is_owned = (e & 1) || (e == 0);
12910 e_conv = LightningError_clone(&e_conv);
12911 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12912 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
12913 return (uint64_t)ret_conv;
12916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12917 if ((_res & 1) != 0) return;
12918 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
12920 CResult_boolLightningErrorZ_free(_res_conv);
12923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12924 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
12925 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12926 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
12927 return (uint64_t)ret_conv;
12930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12931 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
12932 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12933 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
12934 return (uint64_t)ret_ref;
12937 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) {
12938 LDKChannelAnnouncement a_conv;
12939 a_conv.inner = (void*)(a & (~1));
12940 a_conv.is_owned = (a & 1) || (a == 0);
12941 a_conv = ChannelAnnouncement_clone(&a_conv);
12942 LDKChannelUpdate b_conv;
12943 b_conv.inner = (void*)(b & (~1));
12944 b_conv.is_owned = (b & 1) || (b == 0);
12945 b_conv = ChannelUpdate_clone(&b_conv);
12946 LDKChannelUpdate c_conv;
12947 c_conv.inner = (void*)(c & (~1));
12948 c_conv.is_owned = (c & 1) || (c == 0);
12949 c_conv = ChannelUpdate_clone(&c_conv);
12950 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12951 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
12952 return (uint64_t)ret_ref;
12955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12956 if ((_res & 1) != 0) return;
12957 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
12959 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
12962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12963 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
12964 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12965 if (_res_constr.datalen > 0)
12966 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
12968 _res_constr.data = NULL;
12969 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12970 for (size_t l = 0; l < _res_constr.datalen; l++) {
12971 int64_t _res_conv_63 = _res_vals[l];
12972 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
12973 FREE((void*)_res_conv_63);
12974 _res_constr.data[l] = _res_conv_63_conv;
12976 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12977 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
12980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12981 LDKCVec_NodeAnnouncementZ _res_constr;
12982 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12983 if (_res_constr.datalen > 0)
12984 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12986 _res_constr.data = NULL;
12987 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12988 for (size_t s = 0; s < _res_constr.datalen; s++) {
12989 int64_t _res_conv_18 = _res_vals[s];
12990 LDKNodeAnnouncement _res_conv_18_conv;
12991 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
12992 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
12993 _res_constr.data[s] = _res_conv_18_conv;
12995 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12996 CVec_NodeAnnouncementZ_free(_res_constr);
12999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13000 LDKCVec_PublicKeyZ _res_constr;
13001 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13002 if (_res_constr.datalen > 0)
13003 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13005 _res_constr.data = NULL;
13006 for (size_t i = 0; i < _res_constr.datalen; i++) {
13007 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13008 LDKPublicKey _res_conv_8_ref;
13009 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
13010 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
13011 _res_constr.data[i] = _res_conv_8_ref;
13013 CVec_PublicKeyZ_free(_res_constr);
13016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13018 o_ref.datalen = (*env)->GetArrayLength(env, o);
13019 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13020 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
13021 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13022 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13023 return (uint64_t)ret_conv;
13026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13027 LDKPeerHandleError e_conv;
13028 e_conv.inner = (void*)(e & (~1));
13029 e_conv.is_owned = (e & 1) || (e == 0);
13030 e_conv = PeerHandleError_clone(&e_conv);
13031 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13032 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13033 return (uint64_t)ret_conv;
13036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13037 if ((_res & 1) != 0) return;
13038 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13040 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13044 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13045 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13046 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13047 return (uint64_t)ret_conv;
13050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
13051 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13052 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13053 return (uint64_t)ret_conv;
13056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13057 LDKPeerHandleError e_conv;
13058 e_conv.inner = (void*)(e & (~1));
13059 e_conv.is_owned = (e & 1) || (e == 0);
13060 e_conv = PeerHandleError_clone(&e_conv);
13061 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13062 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13063 return (uint64_t)ret_conv;
13066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13067 if ((_res & 1) != 0) return;
13068 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13070 CResult_NonePeerHandleErrorZ_free(_res_conv);
13073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13074 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13075 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13076 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13077 return (uint64_t)ret_conv;
13080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13081 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13082 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13083 return (uint64_t)ret_conv;
13086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13087 LDKPeerHandleError e_conv;
13088 e_conv.inner = (void*)(e & (~1));
13089 e_conv.is_owned = (e & 1) || (e == 0);
13090 e_conv = PeerHandleError_clone(&e_conv);
13091 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13092 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
13093 return (uint64_t)ret_conv;
13096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13097 if ((_res & 1) != 0) return;
13098 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13100 CResult_boolPeerHandleErrorZ_free(_res_conv);
13103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13104 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
13105 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13106 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
13107 return (uint64_t)ret_conv;
13110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13111 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
13112 if (o_conv.free == LDKAccess_JCalls_free) {
13113 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13114 LDKAccess_JCalls_cloned(&o_conv);
13116 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13117 *ret_copy = COption_AccessZ_some(o_conv);
13118 uint64_t ret_ref = (uint64_t)ret_copy;
13122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
13123 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13124 *ret_copy = COption_AccessZ_none();
13125 uint64_t ret_ref = (uint64_t)ret_copy;
13129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13130 if ((_res & 1) != 0) return;
13131 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
13133 COption_AccessZ_free(_res_conv);
13136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13137 LDKDirectionalChannelInfo o_conv;
13138 o_conv.inner = (void*)(o & (~1));
13139 o_conv.is_owned = (o & 1) || (o == 0);
13140 o_conv = DirectionalChannelInfo_clone(&o_conv);
13141 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13142 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
13143 return (uint64_t)ret_conv;
13146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13147 LDKDecodeError e_conv;
13148 e_conv.inner = (void*)(e & (~1));
13149 e_conv.is_owned = (e & 1) || (e == 0);
13150 e_conv = DecodeError_clone(&e_conv);
13151 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13152 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
13153 return (uint64_t)ret_conv;
13156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13157 if ((_res & 1) != 0) return;
13158 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13160 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
13163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13164 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
13165 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13166 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
13167 return (uint64_t)ret_conv;
13170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13171 LDKChannelInfo o_conv;
13172 o_conv.inner = (void*)(o & (~1));
13173 o_conv.is_owned = (o & 1) || (o == 0);
13174 o_conv = ChannelInfo_clone(&o_conv);
13175 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13176 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13177 return (uint64_t)ret_conv;
13180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13181 LDKDecodeError e_conv;
13182 e_conv.inner = (void*)(e & (~1));
13183 e_conv.is_owned = (e & 1) || (e == 0);
13184 e_conv = DecodeError_clone(&e_conv);
13185 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13186 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13187 return (uint64_t)ret_conv;
13190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13191 if ((_res & 1) != 0) return;
13192 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13194 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13198 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
13199 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13200 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13201 return (uint64_t)ret_conv;
13204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13205 LDKRoutingFees o_conv;
13206 o_conv.inner = (void*)(o & (~1));
13207 o_conv.is_owned = (o & 1) || (o == 0);
13208 o_conv = RoutingFees_clone(&o_conv);
13209 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13210 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13211 return (uint64_t)ret_conv;
13214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13215 LDKDecodeError e_conv;
13216 e_conv.inner = (void*)(e & (~1));
13217 e_conv.is_owned = (e & 1) || (e == 0);
13218 e_conv = DecodeError_clone(&e_conv);
13219 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13220 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13221 return (uint64_t)ret_conv;
13224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13225 if ((_res & 1) != 0) return;
13226 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
13228 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13232 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
13233 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13234 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13235 return (uint64_t)ret_conv;
13238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13239 LDKNodeAnnouncementInfo o_conv;
13240 o_conv.inner = (void*)(o & (~1));
13241 o_conv.is_owned = (o & 1) || (o == 0);
13242 o_conv = NodeAnnouncementInfo_clone(&o_conv);
13243 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13244 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13245 return (uint64_t)ret_conv;
13248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13249 LDKDecodeError e_conv;
13250 e_conv.inner = (void*)(e & (~1));
13251 e_conv.is_owned = (e & 1) || (e == 0);
13252 e_conv = DecodeError_clone(&e_conv);
13253 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13254 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13255 return (uint64_t)ret_conv;
13258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13259 if ((_res & 1) != 0) return;
13260 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13262 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13266 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
13267 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13268 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13269 return (uint64_t)ret_conv;
13272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13273 LDKCVec_u64Z _res_constr;
13274 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13275 if (_res_constr.datalen > 0)
13276 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13278 _res_constr.data = NULL;
13279 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13280 for (size_t g = 0; g < _res_constr.datalen; g++) {
13281 int64_t _res_conv_6 = _res_vals[g];
13282 _res_constr.data[g] = _res_conv_6;
13284 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13285 CVec_u64Z_free(_res_constr);
13288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13289 LDKNodeInfo o_conv;
13290 o_conv.inner = (void*)(o & (~1));
13291 o_conv.is_owned = (o & 1) || (o == 0);
13292 o_conv = NodeInfo_clone(&o_conv);
13293 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13294 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13295 return (uint64_t)ret_conv;
13298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13299 LDKDecodeError e_conv;
13300 e_conv.inner = (void*)(e & (~1));
13301 e_conv.is_owned = (e & 1) || (e == 0);
13302 e_conv = DecodeError_clone(&e_conv);
13303 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13304 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13305 return (uint64_t)ret_conv;
13308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13309 if ((_res & 1) != 0) return;
13310 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13312 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13316 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
13317 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13318 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13319 return (uint64_t)ret_conv;
13322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13323 LDKNetworkGraph o_conv;
13324 o_conv.inner = (void*)(o & (~1));
13325 o_conv.is_owned = (o & 1) || (o == 0);
13326 // Warning: we need a move here but no clone is available for LDKNetworkGraph
13327 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13328 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13329 return (uint64_t)ret_conv;
13332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13333 LDKDecodeError e_conv;
13334 e_conv.inner = (void*)(e & (~1));
13335 e_conv.is_owned = (e & 1) || (e == 0);
13336 e_conv = DecodeError_clone(&e_conv);
13337 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13338 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13339 return (uint64_t)ret_conv;
13342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13343 if ((_res & 1) != 0) return;
13344 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
13346 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
13350 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
13351 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13352 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13353 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
13354 return (uint64_t)ret_conv;
13357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
13358 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13359 *ret_conv = CResult_NetAddressu8Z_err(e);
13360 return (uint64_t)ret_conv;
13363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
13364 if ((_res & 1) != 0) return;
13365 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
13367 CResult_NetAddressu8Z_free(_res_conv);
13370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13371 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
13372 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13373 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
13374 return (uint64_t)ret_conv;
13377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13378 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
13379 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
13380 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13381 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
13382 return (uint64_t)ret_conv;
13385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13386 LDKDecodeError e_conv;
13387 e_conv.inner = (void*)(e & (~1));
13388 e_conv.is_owned = (e & 1) || (e == 0);
13389 e_conv = DecodeError_clone(&e_conv);
13390 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13391 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
13392 return (uint64_t)ret_conv;
13395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13396 if ((_res & 1) != 0) return;
13397 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
13399 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
13402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13403 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
13404 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13405 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
13406 return (uint64_t)ret_conv;
13409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13410 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
13411 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13412 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13413 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
13414 return (uint64_t)ret_conv;
13417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13418 LDKDecodeError e_conv;
13419 e_conv.inner = (void*)(e & (~1));
13420 e_conv.is_owned = (e & 1) || (e == 0);
13421 e_conv = DecodeError_clone(&e_conv);
13422 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13423 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
13424 return (uint64_t)ret_conv;
13427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13428 if ((_res & 1) != 0) return;
13429 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
13431 CResult_NetAddressDecodeErrorZ_free(_res_conv);
13434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13435 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
13436 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13437 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
13438 return (uint64_t)ret_conv;
13441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13442 LDKCVec_UpdateAddHTLCZ _res_constr;
13443 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13444 if (_res_constr.datalen > 0)
13445 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13447 _res_constr.data = NULL;
13448 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13449 for (size_t p = 0; p < _res_constr.datalen; p++) {
13450 int64_t _res_conv_15 = _res_vals[p];
13451 LDKUpdateAddHTLC _res_conv_15_conv;
13452 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
13453 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
13454 _res_constr.data[p] = _res_conv_15_conv;
13456 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13457 CVec_UpdateAddHTLCZ_free(_res_constr);
13460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13461 LDKCVec_UpdateFulfillHTLCZ _res_constr;
13462 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13463 if (_res_constr.datalen > 0)
13464 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13466 _res_constr.data = NULL;
13467 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13468 for (size_t t = 0; t < _res_constr.datalen; t++) {
13469 int64_t _res_conv_19 = _res_vals[t];
13470 LDKUpdateFulfillHTLC _res_conv_19_conv;
13471 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
13472 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
13473 _res_constr.data[t] = _res_conv_19_conv;
13475 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13476 CVec_UpdateFulfillHTLCZ_free(_res_constr);
13479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13480 LDKCVec_UpdateFailHTLCZ _res_constr;
13481 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13482 if (_res_constr.datalen > 0)
13483 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13485 _res_constr.data = NULL;
13486 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13487 for (size_t q = 0; q < _res_constr.datalen; q++) {
13488 int64_t _res_conv_16 = _res_vals[q];
13489 LDKUpdateFailHTLC _res_conv_16_conv;
13490 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
13491 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
13492 _res_constr.data[q] = _res_conv_16_conv;
13494 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13495 CVec_UpdateFailHTLCZ_free(_res_constr);
13498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13499 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
13500 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13501 if (_res_constr.datalen > 0)
13502 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13504 _res_constr.data = NULL;
13505 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13506 for (size_t z = 0; z < _res_constr.datalen; z++) {
13507 int64_t _res_conv_25 = _res_vals[z];
13508 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
13509 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
13510 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
13511 _res_constr.data[z] = _res_conv_25_conv;
13513 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13514 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
13517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13518 LDKAcceptChannel o_conv;
13519 o_conv.inner = (void*)(o & (~1));
13520 o_conv.is_owned = (o & 1) || (o == 0);
13521 o_conv = AcceptChannel_clone(&o_conv);
13522 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13523 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
13524 return (uint64_t)ret_conv;
13527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13528 LDKDecodeError e_conv;
13529 e_conv.inner = (void*)(e & (~1));
13530 e_conv.is_owned = (e & 1) || (e == 0);
13531 e_conv = DecodeError_clone(&e_conv);
13532 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13533 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
13534 return (uint64_t)ret_conv;
13537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13538 if ((_res & 1) != 0) return;
13539 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
13541 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
13544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13545 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
13546 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13547 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
13548 return (uint64_t)ret_conv;
13551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13552 LDKAnnouncementSignatures o_conv;
13553 o_conv.inner = (void*)(o & (~1));
13554 o_conv.is_owned = (o & 1) || (o == 0);
13555 o_conv = AnnouncementSignatures_clone(&o_conv);
13556 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13557 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
13558 return (uint64_t)ret_conv;
13561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13562 LDKDecodeError e_conv;
13563 e_conv.inner = (void*)(e & (~1));
13564 e_conv.is_owned = (e & 1) || (e == 0);
13565 e_conv = DecodeError_clone(&e_conv);
13566 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13567 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
13568 return (uint64_t)ret_conv;
13571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13572 if ((_res & 1) != 0) return;
13573 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
13575 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
13578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13579 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
13580 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13581 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
13582 return (uint64_t)ret_conv;
13585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13586 LDKChannelReestablish o_conv;
13587 o_conv.inner = (void*)(o & (~1));
13588 o_conv.is_owned = (o & 1) || (o == 0);
13589 o_conv = ChannelReestablish_clone(&o_conv);
13590 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13591 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
13592 return (uint64_t)ret_conv;
13595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13596 LDKDecodeError e_conv;
13597 e_conv.inner = (void*)(e & (~1));
13598 e_conv.is_owned = (e & 1) || (e == 0);
13599 e_conv = DecodeError_clone(&e_conv);
13600 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13601 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
13602 return (uint64_t)ret_conv;
13605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13606 if ((_res & 1) != 0) return;
13607 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
13609 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
13612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13613 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
13614 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13615 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
13616 return (uint64_t)ret_conv;
13619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13620 LDKClosingSigned o_conv;
13621 o_conv.inner = (void*)(o & (~1));
13622 o_conv.is_owned = (o & 1) || (o == 0);
13623 o_conv = ClosingSigned_clone(&o_conv);
13624 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13625 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
13626 return (uint64_t)ret_conv;
13629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13630 LDKDecodeError e_conv;
13631 e_conv.inner = (void*)(e & (~1));
13632 e_conv.is_owned = (e & 1) || (e == 0);
13633 e_conv = DecodeError_clone(&e_conv);
13634 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13635 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
13636 return (uint64_t)ret_conv;
13639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13640 if ((_res & 1) != 0) return;
13641 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13643 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
13646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13647 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
13648 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13649 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
13650 return (uint64_t)ret_conv;
13653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13654 LDKClosingSignedFeeRange o_conv;
13655 o_conv.inner = (void*)(o & (~1));
13656 o_conv.is_owned = (o & 1) || (o == 0);
13657 o_conv = ClosingSignedFeeRange_clone(&o_conv);
13658 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13659 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
13660 return (uint64_t)ret_conv;
13663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13664 LDKDecodeError e_conv;
13665 e_conv.inner = (void*)(e & (~1));
13666 e_conv.is_owned = (e & 1) || (e == 0);
13667 e_conv = DecodeError_clone(&e_conv);
13668 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13669 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
13670 return (uint64_t)ret_conv;
13673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13674 if ((_res & 1) != 0) return;
13675 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13677 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
13680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13681 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
13682 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13683 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
13684 return (uint64_t)ret_conv;
13687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13688 LDKCommitmentSigned o_conv;
13689 o_conv.inner = (void*)(o & (~1));
13690 o_conv.is_owned = (o & 1) || (o == 0);
13691 o_conv = CommitmentSigned_clone(&o_conv);
13692 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13693 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
13694 return (uint64_t)ret_conv;
13697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13698 LDKDecodeError e_conv;
13699 e_conv.inner = (void*)(e & (~1));
13700 e_conv.is_owned = (e & 1) || (e == 0);
13701 e_conv = DecodeError_clone(&e_conv);
13702 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13703 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
13704 return (uint64_t)ret_conv;
13707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13708 if ((_res & 1) != 0) return;
13709 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13711 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
13714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13715 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
13716 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13717 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
13718 return (uint64_t)ret_conv;
13721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13722 LDKFundingCreated o_conv;
13723 o_conv.inner = (void*)(o & (~1));
13724 o_conv.is_owned = (o & 1) || (o == 0);
13725 o_conv = FundingCreated_clone(&o_conv);
13726 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13727 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
13728 return (uint64_t)ret_conv;
13731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13732 LDKDecodeError e_conv;
13733 e_conv.inner = (void*)(e & (~1));
13734 e_conv.is_owned = (e & 1) || (e == 0);
13735 e_conv = DecodeError_clone(&e_conv);
13736 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13737 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
13738 return (uint64_t)ret_conv;
13741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13742 if ((_res & 1) != 0) return;
13743 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13745 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
13748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13749 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
13750 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13751 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
13752 return (uint64_t)ret_conv;
13755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13756 LDKFundingSigned o_conv;
13757 o_conv.inner = (void*)(o & (~1));
13758 o_conv.is_owned = (o & 1) || (o == 0);
13759 o_conv = FundingSigned_clone(&o_conv);
13760 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13761 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
13762 return (uint64_t)ret_conv;
13765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13766 LDKDecodeError e_conv;
13767 e_conv.inner = (void*)(e & (~1));
13768 e_conv.is_owned = (e & 1) || (e == 0);
13769 e_conv = DecodeError_clone(&e_conv);
13770 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13771 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
13772 return (uint64_t)ret_conv;
13775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13776 if ((_res & 1) != 0) return;
13777 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13779 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
13782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13783 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
13784 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13785 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
13786 return (uint64_t)ret_conv;
13789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13790 LDKFundingLocked o_conv;
13791 o_conv.inner = (void*)(o & (~1));
13792 o_conv.is_owned = (o & 1) || (o == 0);
13793 o_conv = FundingLocked_clone(&o_conv);
13794 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13795 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
13796 return (uint64_t)ret_conv;
13799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13800 LDKDecodeError e_conv;
13801 e_conv.inner = (void*)(e & (~1));
13802 e_conv.is_owned = (e & 1) || (e == 0);
13803 e_conv = DecodeError_clone(&e_conv);
13804 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13805 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
13806 return (uint64_t)ret_conv;
13809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13810 if ((_res & 1) != 0) return;
13811 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13813 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
13816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13817 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
13818 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13819 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
13820 return (uint64_t)ret_conv;
13823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13825 o_conv.inner = (void*)(o & (~1));
13826 o_conv.is_owned = (o & 1) || (o == 0);
13827 o_conv = Init_clone(&o_conv);
13828 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13829 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
13830 return (uint64_t)ret_conv;
13833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13834 LDKDecodeError e_conv;
13835 e_conv.inner = (void*)(e & (~1));
13836 e_conv.is_owned = (e & 1) || (e == 0);
13837 e_conv = DecodeError_clone(&e_conv);
13838 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13839 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
13840 return (uint64_t)ret_conv;
13843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13844 if ((_res & 1) != 0) return;
13845 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
13847 CResult_InitDecodeErrorZ_free(_res_conv);
13850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13851 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
13852 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13853 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
13854 return (uint64_t)ret_conv;
13857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13858 LDKOpenChannel o_conv;
13859 o_conv.inner = (void*)(o & (~1));
13860 o_conv.is_owned = (o & 1) || (o == 0);
13861 o_conv = OpenChannel_clone(&o_conv);
13862 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13863 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
13864 return (uint64_t)ret_conv;
13867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13868 LDKDecodeError e_conv;
13869 e_conv.inner = (void*)(e & (~1));
13870 e_conv.is_owned = (e & 1) || (e == 0);
13871 e_conv = DecodeError_clone(&e_conv);
13872 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13873 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
13874 return (uint64_t)ret_conv;
13877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13878 if ((_res & 1) != 0) return;
13879 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
13881 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
13884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13885 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
13886 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13887 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
13888 return (uint64_t)ret_conv;
13891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13892 LDKRevokeAndACK o_conv;
13893 o_conv.inner = (void*)(o & (~1));
13894 o_conv.is_owned = (o & 1) || (o == 0);
13895 o_conv = RevokeAndACK_clone(&o_conv);
13896 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13897 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
13898 return (uint64_t)ret_conv;
13901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13902 LDKDecodeError e_conv;
13903 e_conv.inner = (void*)(e & (~1));
13904 e_conv.is_owned = (e & 1) || (e == 0);
13905 e_conv = DecodeError_clone(&e_conv);
13906 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13907 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
13908 return (uint64_t)ret_conv;
13911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13912 if ((_res & 1) != 0) return;
13913 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
13915 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
13918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13919 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
13920 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13921 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
13922 return (uint64_t)ret_conv;
13925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13926 LDKShutdown o_conv;
13927 o_conv.inner = (void*)(o & (~1));
13928 o_conv.is_owned = (o & 1) || (o == 0);
13929 o_conv = Shutdown_clone(&o_conv);
13930 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13931 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
13932 return (uint64_t)ret_conv;
13935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13936 LDKDecodeError e_conv;
13937 e_conv.inner = (void*)(e & (~1));
13938 e_conv.is_owned = (e & 1) || (e == 0);
13939 e_conv = DecodeError_clone(&e_conv);
13940 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13941 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
13942 return (uint64_t)ret_conv;
13945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13946 if ((_res & 1) != 0) return;
13947 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
13949 CResult_ShutdownDecodeErrorZ_free(_res_conv);
13952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13953 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
13954 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13955 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
13956 return (uint64_t)ret_conv;
13959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13960 LDKUpdateFailHTLC o_conv;
13961 o_conv.inner = (void*)(o & (~1));
13962 o_conv.is_owned = (o & 1) || (o == 0);
13963 o_conv = UpdateFailHTLC_clone(&o_conv);
13964 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13965 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
13966 return (uint64_t)ret_conv;
13969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13970 LDKDecodeError e_conv;
13971 e_conv.inner = (void*)(e & (~1));
13972 e_conv.is_owned = (e & 1) || (e == 0);
13973 e_conv = DecodeError_clone(&e_conv);
13974 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13975 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
13976 return (uint64_t)ret_conv;
13979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13980 if ((_res & 1) != 0) return;
13981 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
13983 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
13986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13987 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
13988 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13989 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
13990 return (uint64_t)ret_conv;
13993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13994 LDKUpdateFailMalformedHTLC o_conv;
13995 o_conv.inner = (void*)(o & (~1));
13996 o_conv.is_owned = (o & 1) || (o == 0);
13997 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
13998 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
13999 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
14000 return (uint64_t)ret_conv;
14003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14004 LDKDecodeError e_conv;
14005 e_conv.inner = (void*)(e & (~1));
14006 e_conv.is_owned = (e & 1) || (e == 0);
14007 e_conv = DecodeError_clone(&e_conv);
14008 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14009 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
14010 return (uint64_t)ret_conv;
14013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14014 if ((_res & 1) != 0) return;
14015 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14017 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
14020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14021 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
14022 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14023 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
14024 return (uint64_t)ret_conv;
14027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14028 LDKUpdateFee o_conv;
14029 o_conv.inner = (void*)(o & (~1));
14030 o_conv.is_owned = (o & 1) || (o == 0);
14031 o_conv = UpdateFee_clone(&o_conv);
14032 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14033 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
14034 return (uint64_t)ret_conv;
14037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14038 LDKDecodeError e_conv;
14039 e_conv.inner = (void*)(e & (~1));
14040 e_conv.is_owned = (e & 1) || (e == 0);
14041 e_conv = DecodeError_clone(&e_conv);
14042 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14043 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
14044 return (uint64_t)ret_conv;
14047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14048 if ((_res & 1) != 0) return;
14049 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14051 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14055 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14056 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14057 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14058 return (uint64_t)ret_conv;
14061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14062 LDKUpdateFulfillHTLC o_conv;
14063 o_conv.inner = (void*)(o & (~1));
14064 o_conv.is_owned = (o & 1) || (o == 0);
14065 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14066 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14067 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14068 return (uint64_t)ret_conv;
14071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14072 LDKDecodeError e_conv;
14073 e_conv.inner = (void*)(e & (~1));
14074 e_conv.is_owned = (e & 1) || (e == 0);
14075 e_conv = DecodeError_clone(&e_conv);
14076 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14077 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14078 return (uint64_t)ret_conv;
14081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14082 if ((_res & 1) != 0) return;
14083 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14085 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14089 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
14090 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14091 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
14092 return (uint64_t)ret_conv;
14095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14096 LDKUpdateAddHTLC o_conv;
14097 o_conv.inner = (void*)(o & (~1));
14098 o_conv.is_owned = (o & 1) || (o == 0);
14099 o_conv = UpdateAddHTLC_clone(&o_conv);
14100 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14101 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
14102 return (uint64_t)ret_conv;
14105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14106 LDKDecodeError e_conv;
14107 e_conv.inner = (void*)(e & (~1));
14108 e_conv.is_owned = (e & 1) || (e == 0);
14109 e_conv = DecodeError_clone(&e_conv);
14110 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14111 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
14112 return (uint64_t)ret_conv;
14115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14116 if ((_res & 1) != 0) return;
14117 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14119 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
14122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14123 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
14124 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14125 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
14126 return (uint64_t)ret_conv;
14129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14131 o_conv.inner = (void*)(o & (~1));
14132 o_conv.is_owned = (o & 1) || (o == 0);
14133 o_conv = Ping_clone(&o_conv);
14134 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14135 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
14136 return (uint64_t)ret_conv;
14139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14140 LDKDecodeError e_conv;
14141 e_conv.inner = (void*)(e & (~1));
14142 e_conv.is_owned = (e & 1) || (e == 0);
14143 e_conv = DecodeError_clone(&e_conv);
14144 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14145 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
14146 return (uint64_t)ret_conv;
14149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14150 if ((_res & 1) != 0) return;
14151 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
14153 CResult_PingDecodeErrorZ_free(_res_conv);
14156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14157 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
14158 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14159 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
14160 return (uint64_t)ret_conv;
14163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14165 o_conv.inner = (void*)(o & (~1));
14166 o_conv.is_owned = (o & 1) || (o == 0);
14167 o_conv = Pong_clone(&o_conv);
14168 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14169 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
14170 return (uint64_t)ret_conv;
14173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14174 LDKDecodeError e_conv;
14175 e_conv.inner = (void*)(e & (~1));
14176 e_conv.is_owned = (e & 1) || (e == 0);
14177 e_conv = DecodeError_clone(&e_conv);
14178 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14179 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
14180 return (uint64_t)ret_conv;
14183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14184 if ((_res & 1) != 0) return;
14185 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
14187 CResult_PongDecodeErrorZ_free(_res_conv);
14190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14191 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
14192 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14193 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
14194 return (uint64_t)ret_conv;
14197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14198 LDKUnsignedChannelAnnouncement o_conv;
14199 o_conv.inner = (void*)(o & (~1));
14200 o_conv.is_owned = (o & 1) || (o == 0);
14201 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
14202 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14203 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
14204 return (uint64_t)ret_conv;
14207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14208 LDKDecodeError e_conv;
14209 e_conv.inner = (void*)(e & (~1));
14210 e_conv.is_owned = (e & 1) || (e == 0);
14211 e_conv = DecodeError_clone(&e_conv);
14212 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14213 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
14214 return (uint64_t)ret_conv;
14217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14218 if ((_res & 1) != 0) return;
14219 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14221 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
14224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14225 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14226 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14227 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14228 return (uint64_t)ret_conv;
14231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14232 LDKChannelAnnouncement o_conv;
14233 o_conv.inner = (void*)(o & (~1));
14234 o_conv.is_owned = (o & 1) || (o == 0);
14235 o_conv = ChannelAnnouncement_clone(&o_conv);
14236 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14237 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
14238 return (uint64_t)ret_conv;
14241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14242 LDKDecodeError e_conv;
14243 e_conv.inner = (void*)(e & (~1));
14244 e_conv.is_owned = (e & 1) || (e == 0);
14245 e_conv = DecodeError_clone(&e_conv);
14246 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14247 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14248 return (uint64_t)ret_conv;
14251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14252 if ((_res & 1) != 0) return;
14253 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14255 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14259 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14260 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14261 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14262 return (uint64_t)ret_conv;
14265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14266 LDKUnsignedChannelUpdate o_conv;
14267 o_conv.inner = (void*)(o & (~1));
14268 o_conv.is_owned = (o & 1) || (o == 0);
14269 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14270 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14271 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14272 return (uint64_t)ret_conv;
14275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14276 LDKDecodeError e_conv;
14277 e_conv.inner = (void*)(e & (~1));
14278 e_conv.is_owned = (e & 1) || (e == 0);
14279 e_conv = DecodeError_clone(&e_conv);
14280 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14281 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14282 return (uint64_t)ret_conv;
14285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14286 if ((_res & 1) != 0) return;
14287 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
14289 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14293 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14294 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14295 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14296 return (uint64_t)ret_conv;
14299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14300 LDKChannelUpdate o_conv;
14301 o_conv.inner = (void*)(o & (~1));
14302 o_conv.is_owned = (o & 1) || (o == 0);
14303 o_conv = ChannelUpdate_clone(&o_conv);
14304 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14305 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14306 return (uint64_t)ret_conv;
14309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14310 LDKDecodeError e_conv;
14311 e_conv.inner = (void*)(e & (~1));
14312 e_conv.is_owned = (e & 1) || (e == 0);
14313 e_conv = DecodeError_clone(&e_conv);
14314 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14315 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14316 return (uint64_t)ret_conv;
14319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14320 if ((_res & 1) != 0) return;
14321 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
14323 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
14326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14327 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
14328 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14329 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
14330 return (uint64_t)ret_conv;
14333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14334 LDKErrorMessage o_conv;
14335 o_conv.inner = (void*)(o & (~1));
14336 o_conv.is_owned = (o & 1) || (o == 0);
14337 o_conv = ErrorMessage_clone(&o_conv);
14338 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14339 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
14340 return (uint64_t)ret_conv;
14343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14344 LDKDecodeError e_conv;
14345 e_conv.inner = (void*)(e & (~1));
14346 e_conv.is_owned = (e & 1) || (e == 0);
14347 e_conv = DecodeError_clone(&e_conv);
14348 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14349 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
14350 return (uint64_t)ret_conv;
14353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14354 if ((_res & 1) != 0) return;
14355 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
14357 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
14360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14361 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
14362 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14363 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
14364 return (uint64_t)ret_conv;
14367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14368 LDKUnsignedNodeAnnouncement o_conv;
14369 o_conv.inner = (void*)(o & (~1));
14370 o_conv.is_owned = (o & 1) || (o == 0);
14371 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
14372 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14373 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
14374 return (uint64_t)ret_conv;
14377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14378 LDKDecodeError e_conv;
14379 e_conv.inner = (void*)(e & (~1));
14380 e_conv.is_owned = (e & 1) || (e == 0);
14381 e_conv = DecodeError_clone(&e_conv);
14382 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14383 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
14384 return (uint64_t)ret_conv;
14387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14388 if ((_res & 1) != 0) return;
14389 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14391 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
14394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14395 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
14396 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14397 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
14398 return (uint64_t)ret_conv;
14401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14402 LDKNodeAnnouncement o_conv;
14403 o_conv.inner = (void*)(o & (~1));
14404 o_conv.is_owned = (o & 1) || (o == 0);
14405 o_conv = NodeAnnouncement_clone(&o_conv);
14406 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14407 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
14408 return (uint64_t)ret_conv;
14411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14412 LDKDecodeError e_conv;
14413 e_conv.inner = (void*)(e & (~1));
14414 e_conv.is_owned = (e & 1) || (e == 0);
14415 e_conv = DecodeError_clone(&e_conv);
14416 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14417 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
14418 return (uint64_t)ret_conv;
14421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14422 if ((_res & 1) != 0) return;
14423 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14425 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
14428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14429 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
14430 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14431 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
14432 return (uint64_t)ret_conv;
14435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14436 LDKQueryShortChannelIds o_conv;
14437 o_conv.inner = (void*)(o & (~1));
14438 o_conv.is_owned = (o & 1) || (o == 0);
14439 o_conv = QueryShortChannelIds_clone(&o_conv);
14440 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14441 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
14442 return (uint64_t)ret_conv;
14445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14446 LDKDecodeError e_conv;
14447 e_conv.inner = (void*)(e & (~1));
14448 e_conv.is_owned = (e & 1) || (e == 0);
14449 e_conv = DecodeError_clone(&e_conv);
14450 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14451 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
14452 return (uint64_t)ret_conv;
14455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14456 if ((_res & 1) != 0) return;
14457 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
14459 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
14462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14463 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
14464 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14465 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
14466 return (uint64_t)ret_conv;
14469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14470 LDKReplyShortChannelIdsEnd o_conv;
14471 o_conv.inner = (void*)(o & (~1));
14472 o_conv.is_owned = (o & 1) || (o == 0);
14473 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
14474 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14475 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
14476 return (uint64_t)ret_conv;
14479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14480 LDKDecodeError e_conv;
14481 e_conv.inner = (void*)(e & (~1));
14482 e_conv.is_owned = (e & 1) || (e == 0);
14483 e_conv = DecodeError_clone(&e_conv);
14484 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14485 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
14486 return (uint64_t)ret_conv;
14489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14490 if ((_res & 1) != 0) return;
14491 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
14493 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
14496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14497 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
14498 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14499 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
14500 return (uint64_t)ret_conv;
14503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14504 LDKQueryChannelRange o_conv;
14505 o_conv.inner = (void*)(o & (~1));
14506 o_conv.is_owned = (o & 1) || (o == 0);
14507 o_conv = QueryChannelRange_clone(&o_conv);
14508 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14509 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
14510 return (uint64_t)ret_conv;
14513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14514 LDKDecodeError e_conv;
14515 e_conv.inner = (void*)(e & (~1));
14516 e_conv.is_owned = (e & 1) || (e == 0);
14517 e_conv = DecodeError_clone(&e_conv);
14518 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14519 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
14520 return (uint64_t)ret_conv;
14523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14524 if ((_res & 1) != 0) return;
14525 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14527 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
14530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14531 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
14532 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14533 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
14534 return (uint64_t)ret_conv;
14537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14538 LDKReplyChannelRange o_conv;
14539 o_conv.inner = (void*)(o & (~1));
14540 o_conv.is_owned = (o & 1) || (o == 0);
14541 o_conv = ReplyChannelRange_clone(&o_conv);
14542 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14543 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
14544 return (uint64_t)ret_conv;
14547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14548 LDKDecodeError e_conv;
14549 e_conv.inner = (void*)(e & (~1));
14550 e_conv.is_owned = (e & 1) || (e == 0);
14551 e_conv = DecodeError_clone(&e_conv);
14552 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14553 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
14554 return (uint64_t)ret_conv;
14557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14558 if ((_res & 1) != 0) return;
14559 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14561 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
14564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14565 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
14566 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14567 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
14568 return (uint64_t)ret_conv;
14571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14572 LDKGossipTimestampFilter o_conv;
14573 o_conv.inner = (void*)(o & (~1));
14574 o_conv.is_owned = (o & 1) || (o == 0);
14575 o_conv = GossipTimestampFilter_clone(&o_conv);
14576 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14577 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
14578 return (uint64_t)ret_conv;
14581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14582 LDKDecodeError e_conv;
14583 e_conv.inner = (void*)(e & (~1));
14584 e_conv.is_owned = (e & 1) || (e == 0);
14585 e_conv = DecodeError_clone(&e_conv);
14586 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14587 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
14588 return (uint64_t)ret_conv;
14591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14592 if ((_res & 1) != 0) return;
14593 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
14595 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
14598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14599 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
14600 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14601 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
14602 return (uint64_t)ret_conv;
14605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14607 o_conv.inner = (void*)(o & (~1));
14608 o_conv.is_owned = (o & 1) || (o == 0);
14609 o_conv = Invoice_clone(&o_conv);
14610 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14611 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
14612 return (uint64_t)ret_conv;
14615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14616 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
14617 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
14618 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14619 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
14620 return (uint64_t)ret_conv;
14623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14624 if ((_res & 1) != 0) return;
14625 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
14627 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
14630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14631 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
14632 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14633 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
14634 return (uint64_t)ret_conv;
14637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14638 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
14639 if (o_conv.free == LDKFilter_JCalls_free) {
14640 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14641 LDKFilter_JCalls_cloned(&o_conv);
14643 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
14644 *ret_copy = COption_FilterZ_some(o_conv);
14645 uint64_t ret_ref = (uint64_t)ret_copy;
14649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
14650 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
14651 *ret_copy = COption_FilterZ_none();
14652 uint64_t ret_ref = (uint64_t)ret_copy;
14656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14657 if ((_res & 1) != 0) return;
14658 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
14660 COption_FilterZ_free(_res_conv);
14663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14664 if ((this_ptr & 1) != 0) return;
14665 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
14666 FREE((void*)this_ptr);
14667 PaymentPurpose_free(this_ptr_conv);
14670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14671 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
14672 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14673 *ret_copy = PaymentPurpose_clone(orig_conv);
14674 uint64_t ret_ref = (uint64_t)ret_copy;
14678 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) {
14679 LDKThirtyTwoBytes payment_preimage_ref;
14680 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14681 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14682 LDKThirtyTwoBytes payment_secret_ref;
14683 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14684 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14685 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14686 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
14687 uint64_t ret_ref = (uint64_t)ret_copy;
14691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
14692 LDKThirtyTwoBytes a_ref;
14693 CHECK((*env)->GetArrayLength(env, a) == 32);
14694 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
14695 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14696 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
14697 uint64_t ret_ref = (uint64_t)ret_copy;
14701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14702 if ((this_ptr & 1) != 0) return;
14703 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
14704 FREE((void*)this_ptr);
14705 ClosureReason_free(this_ptr_conv);
14708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14709 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
14710 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14711 *ret_copy = ClosureReason_clone(orig_conv);
14712 uint64_t ret_ref = (uint64_t)ret_copy;
14716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
14717 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
14718 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14719 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
14720 uint64_t ret_ref = (uint64_t)ret_copy;
14724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
14725 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14726 *ret_copy = ClosureReason_holder_force_closed();
14727 uint64_t ret_ref = (uint64_t)ret_copy;
14731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
14732 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14733 *ret_copy = ClosureReason_cooperative_closure();
14734 uint64_t ret_ref = (uint64_t)ret_copy;
14738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
14739 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14740 *ret_copy = ClosureReason_commitment_tx_confirmed();
14741 uint64_t ret_ref = (uint64_t)ret_copy;
14745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
14746 LDKStr err_conv = java_to_owned_str(env, err);
14747 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14748 *ret_copy = ClosureReason_processing_error(err_conv);
14749 uint64_t ret_ref = (uint64_t)ret_copy;
14753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
14754 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14755 *ret_copy = ClosureReason_disconnected_peer();
14756 uint64_t ret_ref = (uint64_t)ret_copy;
14760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
14761 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14762 *ret_copy = ClosureReason_outdated_channel_manager();
14763 uint64_t ret_ref = (uint64_t)ret_copy;
14767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
14768 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
14769 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
14770 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14771 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14772 CVec_u8Z_free(ret_var);
14776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14777 if ((this_ptr & 1) != 0) return;
14778 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
14779 FREE((void*)this_ptr);
14780 Event_free(this_ptr_conv);
14783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14784 LDKEvent* orig_conv = (LDKEvent*)orig;
14785 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14786 *ret_copy = Event_clone(orig_conv);
14787 uint64_t ret_ref = (uint64_t)ret_copy;
14791 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) {
14792 LDKThirtyTwoBytes temporary_channel_id_ref;
14793 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
14794 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
14795 LDKCVec_u8Z output_script_ref;
14796 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
14797 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
14798 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
14799 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14800 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
14801 uint64_t ret_ref = (uint64_t)ret_copy;
14805 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) {
14806 LDKThirtyTwoBytes payment_hash_ref;
14807 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14808 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14809 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
14810 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
14811 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14812 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
14813 uint64_t ret_ref = (uint64_t)ret_copy;
14817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) {
14818 LDKThirtyTwoBytes payment_preimage_ref;
14819 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14820 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14821 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14822 *ret_copy = Event_payment_sent(payment_preimage_ref);
14823 uint64_t ret_ref = (uint64_t)ret_copy;
14827 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) {
14828 LDKThirtyTwoBytes payment_hash_ref;
14829 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14830 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14831 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
14832 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
14833 LDKCVec_RouteHopZ path_constr;
14834 path_constr.datalen = (*env)->GetArrayLength(env, path);
14835 if (path_constr.datalen > 0)
14836 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14838 path_constr.data = NULL;
14839 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
14840 for (size_t k = 0; k < path_constr.datalen; k++) {
14841 int64_t path_conv_10 = path_vals[k];
14842 LDKRouteHop path_conv_10_conv;
14843 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
14844 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
14845 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
14846 path_constr.data[k] = path_conv_10_conv;
14848 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
14849 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14850 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
14851 uint64_t ret_ref = (uint64_t)ret_copy;
14855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
14856 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14857 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
14858 uint64_t ret_ref = (uint64_t)ret_copy;
14862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
14863 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
14864 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
14865 if (outputs_constr.datalen > 0)
14866 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14868 outputs_constr.data = NULL;
14869 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
14870 for (size_t b = 0; b < outputs_constr.datalen; b++) {
14871 int64_t outputs_conv_27 = outputs_vals[b];
14872 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
14873 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
14874 outputs_constr.data[b] = outputs_conv_27_conv;
14876 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
14877 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14878 *ret_copy = Event_spendable_outputs(outputs_constr);
14879 uint64_t ret_ref = (uint64_t)ret_copy;
14883 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) {
14884 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
14885 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
14886 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14887 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
14888 uint64_t ret_ref = (uint64_t)ret_copy;
14892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t reason) {
14893 LDKThirtyTwoBytes channel_id_ref;
14894 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
14895 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
14896 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
14897 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
14898 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14899 *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
14900 uint64_t ret_ref = (uint64_t)ret_copy;
14904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
14905 LDKEvent* obj_conv = (LDKEvent*)obj;
14906 LDKCVec_u8Z ret_var = Event_write(obj_conv);
14907 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14908 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14909 CVec_u8Z_free(ret_var);
14913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14914 if ((this_ptr & 1) != 0) return;
14915 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
14916 FREE((void*)this_ptr);
14917 MessageSendEvent_free(this_ptr_conv);
14920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14921 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
14922 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14923 *ret_copy = MessageSendEvent_clone(orig_conv);
14924 uint64_t ret_ref = (uint64_t)ret_copy;
14928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14929 LDKPublicKey node_id_ref;
14930 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14931 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14932 LDKAcceptChannel msg_conv;
14933 msg_conv.inner = (void*)(msg & (~1));
14934 msg_conv.is_owned = (msg & 1) || (msg == 0);
14935 msg_conv = AcceptChannel_clone(&msg_conv);
14936 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14937 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
14938 uint64_t ret_ref = (uint64_t)ret_copy;
14942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14943 LDKPublicKey node_id_ref;
14944 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14945 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14946 LDKOpenChannel msg_conv;
14947 msg_conv.inner = (void*)(msg & (~1));
14948 msg_conv.is_owned = (msg & 1) || (msg == 0);
14949 msg_conv = OpenChannel_clone(&msg_conv);
14950 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14951 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
14952 uint64_t ret_ref = (uint64_t)ret_copy;
14956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14957 LDKPublicKey node_id_ref;
14958 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14959 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14960 LDKFundingCreated msg_conv;
14961 msg_conv.inner = (void*)(msg & (~1));
14962 msg_conv.is_owned = (msg & 1) || (msg == 0);
14963 msg_conv = FundingCreated_clone(&msg_conv);
14964 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14965 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
14966 uint64_t ret_ref = (uint64_t)ret_copy;
14970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14971 LDKPublicKey node_id_ref;
14972 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14973 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14974 LDKFundingSigned msg_conv;
14975 msg_conv.inner = (void*)(msg & (~1));
14976 msg_conv.is_owned = (msg & 1) || (msg == 0);
14977 msg_conv = FundingSigned_clone(&msg_conv);
14978 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14979 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
14980 uint64_t ret_ref = (uint64_t)ret_copy;
14984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14985 LDKPublicKey node_id_ref;
14986 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14987 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14988 LDKFundingLocked msg_conv;
14989 msg_conv.inner = (void*)(msg & (~1));
14990 msg_conv.is_owned = (msg & 1) || (msg == 0);
14991 msg_conv = FundingLocked_clone(&msg_conv);
14992 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14993 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
14994 uint64_t ret_ref = (uint64_t)ret_copy;
14998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14999 LDKPublicKey node_id_ref;
15000 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15001 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15002 LDKAnnouncementSignatures msg_conv;
15003 msg_conv.inner = (void*)(msg & (~1));
15004 msg_conv.is_owned = (msg & 1) || (msg == 0);
15005 msg_conv = AnnouncementSignatures_clone(&msg_conv);
15006 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15007 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
15008 uint64_t ret_ref = (uint64_t)ret_copy;
15012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
15013 LDKPublicKey node_id_ref;
15014 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15015 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15016 LDKCommitmentUpdate updates_conv;
15017 updates_conv.inner = (void*)(updates & (~1));
15018 updates_conv.is_owned = (updates & 1) || (updates == 0);
15019 updates_conv = CommitmentUpdate_clone(&updates_conv);
15020 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15021 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
15022 uint64_t ret_ref = (uint64_t)ret_copy;
15026 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) {
15027 LDKPublicKey node_id_ref;
15028 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15029 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15030 LDKRevokeAndACK msg_conv;
15031 msg_conv.inner = (void*)(msg & (~1));
15032 msg_conv.is_owned = (msg & 1) || (msg == 0);
15033 msg_conv = RevokeAndACK_clone(&msg_conv);
15034 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15035 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
15036 uint64_t ret_ref = (uint64_t)ret_copy;
15040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15041 LDKPublicKey node_id_ref;
15042 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15043 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15044 LDKClosingSigned msg_conv;
15045 msg_conv.inner = (void*)(msg & (~1));
15046 msg_conv.is_owned = (msg & 1) || (msg == 0);
15047 msg_conv = ClosingSigned_clone(&msg_conv);
15048 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15049 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
15050 uint64_t ret_ref = (uint64_t)ret_copy;
15054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15055 LDKPublicKey node_id_ref;
15056 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15057 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15058 LDKShutdown msg_conv;
15059 msg_conv.inner = (void*)(msg & (~1));
15060 msg_conv.is_owned = (msg & 1) || (msg == 0);
15061 msg_conv = Shutdown_clone(&msg_conv);
15062 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15063 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
15064 uint64_t ret_ref = (uint64_t)ret_copy;
15068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15069 LDKPublicKey node_id_ref;
15070 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15071 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15072 LDKChannelReestablish msg_conv;
15073 msg_conv.inner = (void*)(msg & (~1));
15074 msg_conv.is_owned = (msg & 1) || (msg == 0);
15075 msg_conv = ChannelReestablish_clone(&msg_conv);
15076 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15077 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
15078 uint64_t ret_ref = (uint64_t)ret_copy;
15082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
15083 LDKChannelAnnouncement msg_conv;
15084 msg_conv.inner = (void*)(msg & (~1));
15085 msg_conv.is_owned = (msg & 1) || (msg == 0);
15086 msg_conv = ChannelAnnouncement_clone(&msg_conv);
15087 LDKChannelUpdate update_msg_conv;
15088 update_msg_conv.inner = (void*)(update_msg & (~1));
15089 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
15090 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
15091 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15092 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
15093 uint64_t ret_ref = (uint64_t)ret_copy;
15097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
15098 LDKNodeAnnouncement msg_conv;
15099 msg_conv.inner = (void*)(msg & (~1));
15100 msg_conv.is_owned = (msg & 1) || (msg == 0);
15101 msg_conv = NodeAnnouncement_clone(&msg_conv);
15102 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15103 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
15104 uint64_t ret_ref = (uint64_t)ret_copy;
15108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
15109 LDKChannelUpdate msg_conv;
15110 msg_conv.inner = (void*)(msg & (~1));
15111 msg_conv.is_owned = (msg & 1) || (msg == 0);
15112 msg_conv = ChannelUpdate_clone(&msg_conv);
15113 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15114 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
15115 uint64_t ret_ref = (uint64_t)ret_copy;
15119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15120 LDKPublicKey node_id_ref;
15121 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15122 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15123 LDKChannelUpdate msg_conv;
15124 msg_conv.inner = (void*)(msg & (~1));
15125 msg_conv.is_owned = (msg & 1) || (msg == 0);
15126 msg_conv = ChannelUpdate_clone(&msg_conv);
15127 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15128 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
15129 uint64_t ret_ref = (uint64_t)ret_copy;
15133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
15134 LDKPublicKey node_id_ref;
15135 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15136 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15137 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
15138 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
15139 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15140 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
15141 uint64_t ret_ref = (uint64_t)ret_copy;
15145 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) {
15146 LDKPublicKey node_id_ref;
15147 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15148 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15149 LDKQueryChannelRange msg_conv;
15150 msg_conv.inner = (void*)(msg & (~1));
15151 msg_conv.is_owned = (msg & 1) || (msg == 0);
15152 msg_conv = QueryChannelRange_clone(&msg_conv);
15153 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15154 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
15155 uint64_t ret_ref = (uint64_t)ret_copy;
15159 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) {
15160 LDKPublicKey node_id_ref;
15161 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15162 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15163 LDKQueryShortChannelIds msg_conv;
15164 msg_conv.inner = (void*)(msg & (~1));
15165 msg_conv.is_owned = (msg & 1) || (msg == 0);
15166 msg_conv = QueryShortChannelIds_clone(&msg_conv);
15167 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15168 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
15169 uint64_t ret_ref = (uint64_t)ret_copy;
15173 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) {
15174 LDKPublicKey node_id_ref;
15175 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15176 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15177 LDKReplyChannelRange msg_conv;
15178 msg_conv.inner = (void*)(msg & (~1));
15179 msg_conv.is_owned = (msg & 1) || (msg == 0);
15180 msg_conv = ReplyChannelRange_clone(&msg_conv);
15181 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15182 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
15183 uint64_t ret_ref = (uint64_t)ret_copy;
15187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15188 if ((this_ptr & 1) != 0) return;
15189 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
15190 FREE((void*)this_ptr);
15191 MessageSendEventsProvider_free(this_ptr_conv);
15194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15195 if ((this_ptr & 1) != 0) return;
15196 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
15197 FREE((void*)this_ptr);
15198 EventsProvider_free(this_ptr_conv);
15201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15202 if ((this_ptr & 1) != 0) return;
15203 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
15204 FREE((void*)this_ptr);
15205 EventHandler_free(this_ptr_conv);
15208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15209 if ((this_ptr & 1) != 0) return;
15210 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
15211 FREE((void*)this_ptr);
15212 APIError_free(this_ptr_conv);
15215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15216 LDKAPIError* orig_conv = (LDKAPIError*)orig;
15217 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15218 *ret_copy = APIError_clone(orig_conv);
15219 uint64_t ret_ref = (uint64_t)ret_copy;
15223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
15224 LDKStr err_conv = java_to_owned_str(env, err);
15225 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15226 *ret_copy = APIError_apimisuse_error(err_conv);
15227 uint64_t ret_ref = (uint64_t)ret_copy;
15231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
15232 LDKStr err_conv = java_to_owned_str(env, err);
15233 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15234 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
15235 uint64_t ret_ref = (uint64_t)ret_copy;
15239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
15240 LDKStr err_conv = java_to_owned_str(env, err);
15241 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15242 *ret_copy = APIError_route_error(err_conv);
15243 uint64_t ret_ref = (uint64_t)ret_copy;
15247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
15248 LDKStr err_conv = java_to_owned_str(env, err);
15249 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15250 *ret_copy = APIError_channel_unavailable(err_conv);
15251 uint64_t ret_ref = (uint64_t)ret_copy;
15255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
15256 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15257 *ret_copy = APIError_monitor_update_failed();
15258 uint64_t ret_ref = (uint64_t)ret_copy;
15262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
15263 LDKShutdownScript script_conv;
15264 script_conv.inner = (void*)(script & (~1));
15265 script_conv.is_owned = (script & 1) || (script == 0);
15266 script_conv = ShutdownScript_clone(&script_conv);
15267 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15268 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
15269 uint64_t ret_ref = (uint64_t)ret_copy;
15273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
15274 LDKu8slice msg_ref;
15275 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15276 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15277 unsigned char sk_arr[32];
15278 CHECK((*env)->GetArrayLength(env, sk) == 32);
15279 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
15280 unsigned char (*sk_ref)[32] = &sk_arr;
15281 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
15282 *ret_conv = sign(msg_ref, sk_ref);
15283 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15284 return (uint64_t)ret_conv;
15287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
15288 LDKu8slice msg_ref;
15289 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15290 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15291 LDKStr sig_conv = java_to_owned_str(env, sig);
15292 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15293 *ret_conv = recover_pk(msg_ref, sig_conv);
15294 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15295 return (uint64_t)ret_conv;
15298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
15299 LDKu8slice msg_ref;
15300 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15301 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15302 LDKStr sig_conv = java_to_owned_str(env, sig);
15303 LDKPublicKey pk_ref;
15304 CHECK((*env)->GetArrayLength(env, pk) == 33);
15305 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
15306 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
15307 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15311 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15312 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
15313 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
15317 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
15318 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
15322 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
15323 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
15327 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
15328 jclass ret_conv = LDKLevel_to_java(env, Level_info());
15332 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
15333 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
15337 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
15338 jclass ret_conv = LDKLevel_to_java(env, Level_error());
15342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
15343 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
15344 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
15345 jboolean ret_val = Level_eq(a_conv, b_conv);
15349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
15350 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
15351 int64_t ret_val = Level_hash(o_conv);
15355 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
15356 jclass ret_conv = LDKLevel_to_java(env, Level_max());
15360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15361 if ((this_ptr & 1) != 0) return;
15362 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
15363 FREE((void*)this_ptr);
15364 Logger_free(this_ptr_conv);
15367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15368 LDKChannelHandshakeConfig this_obj_conv;
15369 this_obj_conv.inner = (void*)(this_obj & (~1));
15370 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15371 ChannelHandshakeConfig_free(this_obj_conv);
15374 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
15375 LDKChannelHandshakeConfig this_ptr_conv;
15376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15377 this_ptr_conv.is_owned = false;
15378 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
15382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15383 LDKChannelHandshakeConfig this_ptr_conv;
15384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15385 this_ptr_conv.is_owned = false;
15386 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
15389 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15390 LDKChannelHandshakeConfig this_ptr_conv;
15391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15392 this_ptr_conv.is_owned = false;
15393 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
15397 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) {
15398 LDKChannelHandshakeConfig this_ptr_conv;
15399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15400 this_ptr_conv.is_owned = false;
15401 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
15404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15405 LDKChannelHandshakeConfig this_ptr_conv;
15406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15407 this_ptr_conv.is_owned = false;
15408 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
15412 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) {
15413 LDKChannelHandshakeConfig this_ptr_conv;
15414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15415 this_ptr_conv.is_owned = false;
15416 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
15419 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) {
15420 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
15421 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15422 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15423 uint64_t ret_ref = (uint64_t)ret_var.inner;
15424 if (ret_var.is_owned) {
15430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15431 LDKChannelHandshakeConfig orig_conv;
15432 orig_conv.inner = (void*)(orig & (~1));
15433 orig_conv.is_owned = false;
15434 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
15435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15437 uint64_t ret_ref = (uint64_t)ret_var.inner;
15438 if (ret_var.is_owned) {
15444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
15445 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
15446 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15447 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15448 uint64_t ret_ref = (uint64_t)ret_var.inner;
15449 if (ret_var.is_owned) {
15455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15456 LDKChannelHandshakeLimits this_obj_conv;
15457 this_obj_conv.inner = (void*)(this_obj & (~1));
15458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15459 ChannelHandshakeLimits_free(this_obj_conv);
15462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15463 LDKChannelHandshakeLimits this_ptr_conv;
15464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15465 this_ptr_conv.is_owned = false;
15466 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
15470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15471 LDKChannelHandshakeLimits this_ptr_conv;
15472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15473 this_ptr_conv.is_owned = false;
15474 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
15477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15478 LDKChannelHandshakeLimits this_ptr_conv;
15479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15480 this_ptr_conv.is_owned = false;
15481 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
15485 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) {
15486 LDKChannelHandshakeLimits this_ptr_conv;
15487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15488 this_ptr_conv.is_owned = false;
15489 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
15492 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) {
15493 LDKChannelHandshakeLimits this_ptr_conv;
15494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15495 this_ptr_conv.is_owned = false;
15496 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
15500 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) {
15501 LDKChannelHandshakeLimits this_ptr_conv;
15502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15503 this_ptr_conv.is_owned = false;
15504 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
15507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15508 LDKChannelHandshakeLimits this_ptr_conv;
15509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15510 this_ptr_conv.is_owned = false;
15511 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
15515 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) {
15516 LDKChannelHandshakeLimits this_ptr_conv;
15517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15518 this_ptr_conv.is_owned = false;
15519 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
15522 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
15523 LDKChannelHandshakeLimits this_ptr_conv;
15524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15525 this_ptr_conv.is_owned = false;
15526 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
15530 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) {
15531 LDKChannelHandshakeLimits this_ptr_conv;
15532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15533 this_ptr_conv.is_owned = false;
15534 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
15537 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
15538 LDKChannelHandshakeLimits this_ptr_conv;
15539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15540 this_ptr_conv.is_owned = false;
15541 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
15545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15546 LDKChannelHandshakeLimits this_ptr_conv;
15547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15548 this_ptr_conv.is_owned = false;
15549 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
15552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
15553 LDKChannelHandshakeLimits this_ptr_conv;
15554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15555 this_ptr_conv.is_owned = false;
15556 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
15560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15561 LDKChannelHandshakeLimits this_ptr_conv;
15562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15563 this_ptr_conv.is_owned = false;
15564 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
15567 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15568 LDKChannelHandshakeLimits this_ptr_conv;
15569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15570 this_ptr_conv.is_owned = false;
15571 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
15575 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) {
15576 LDKChannelHandshakeLimits this_ptr_conv;
15577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15578 this_ptr_conv.is_owned = false;
15579 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
15582 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) {
15583 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);
15584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15586 uint64_t ret_ref = (uint64_t)ret_var.inner;
15587 if (ret_var.is_owned) {
15593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15594 LDKChannelHandshakeLimits orig_conv;
15595 orig_conv.inner = (void*)(orig & (~1));
15596 orig_conv.is_owned = false;
15597 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
15598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15600 uint64_t ret_ref = (uint64_t)ret_var.inner;
15601 if (ret_var.is_owned) {
15607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
15608 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
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 void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15619 LDKChannelConfig this_obj_conv;
15620 this_obj_conv.inner = (void*)(this_obj & (~1));
15621 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15622 ChannelConfig_free(this_obj_conv);
15625 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
15626 LDKChannelConfig this_ptr_conv;
15627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15628 this_ptr_conv.is_owned = false;
15629 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
15633 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) {
15634 LDKChannelConfig this_ptr_conv;
15635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15636 this_ptr_conv.is_owned = false;
15637 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
15640 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15641 LDKChannelConfig this_ptr_conv;
15642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15643 this_ptr_conv.is_owned = false;
15644 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
15648 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) {
15649 LDKChannelConfig this_ptr_conv;
15650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15651 this_ptr_conv.is_owned = false;
15652 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
15655 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15656 LDKChannelConfig this_ptr_conv;
15657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15658 this_ptr_conv.is_owned = false;
15659 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
15663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15664 LDKChannelConfig this_ptr_conv;
15665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15666 this_ptr_conv.is_owned = false;
15667 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
15670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
15671 LDKChannelConfig this_ptr_conv;
15672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15673 this_ptr_conv.is_owned = false;
15674 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
15678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15679 LDKChannelConfig this_ptr_conv;
15680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15681 this_ptr_conv.is_owned = false;
15682 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
15685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15686 LDKChannelConfig this_ptr_conv;
15687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15688 this_ptr_conv.is_owned = false;
15689 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
15693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15694 LDKChannelConfig this_ptr_conv;
15695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15696 this_ptr_conv.is_owned = false;
15697 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
15700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15701 LDKChannelConfig this_ptr_conv;
15702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15703 this_ptr_conv.is_owned = false;
15704 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
15708 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) {
15709 LDKChannelConfig this_ptr_conv;
15710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15711 this_ptr_conv.is_owned = false;
15712 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
15715 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) {
15716 LDKChannelConfig this_ptr_conv;
15717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15718 this_ptr_conv.is_owned = false;
15719 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
15723 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) {
15724 LDKChannelConfig this_ptr_conv;
15725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15726 this_ptr_conv.is_owned = false;
15727 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
15730 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) {
15731 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);
15732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15734 uint64_t ret_ref = (uint64_t)ret_var.inner;
15735 if (ret_var.is_owned) {
15741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15742 LDKChannelConfig orig_conv;
15743 orig_conv.inner = (void*)(orig & (~1));
15744 orig_conv.is_owned = false;
15745 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
15746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15748 uint64_t ret_ref = (uint64_t)ret_var.inner;
15749 if (ret_var.is_owned) {
15755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
15756 LDKChannelConfig ret_var = ChannelConfig_default();
15757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15759 uint64_t ret_ref = (uint64_t)ret_var.inner;
15760 if (ret_var.is_owned) {
15766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
15767 LDKChannelConfig obj_conv;
15768 obj_conv.inner = (void*)(obj & (~1));
15769 obj_conv.is_owned = false;
15770 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
15771 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15772 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15773 CVec_u8Z_free(ret_var);
15777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15778 LDKu8slice ser_ref;
15779 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15780 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15781 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15782 *ret_conv = ChannelConfig_read(ser_ref);
15783 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15784 return (uint64_t)ret_conv;
15787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15788 LDKUserConfig this_obj_conv;
15789 this_obj_conv.inner = (void*)(this_obj & (~1));
15790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15791 UserConfig_free(this_obj_conv);
15794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
15795 LDKUserConfig this_ptr_conv;
15796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15797 this_ptr_conv.is_owned = false;
15798 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
15799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15801 uint64_t ret_ref = (uint64_t)ret_var.inner;
15802 if (ret_var.is_owned) {
15808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15809 LDKUserConfig this_ptr_conv;
15810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15811 this_ptr_conv.is_owned = false;
15812 LDKChannelHandshakeConfig val_conv;
15813 val_conv.inner = (void*)(val & (~1));
15814 val_conv.is_owned = (val & 1) || (val == 0);
15815 val_conv = ChannelHandshakeConfig_clone(&val_conv);
15816 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
15819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
15820 LDKUserConfig this_ptr_conv;
15821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15822 this_ptr_conv.is_owned = false;
15823 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
15824 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15825 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15826 uint64_t ret_ref = (uint64_t)ret_var.inner;
15827 if (ret_var.is_owned) {
15833 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) {
15834 LDKUserConfig this_ptr_conv;
15835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15836 this_ptr_conv.is_owned = false;
15837 LDKChannelHandshakeLimits val_conv;
15838 val_conv.inner = (void*)(val & (~1));
15839 val_conv.is_owned = (val & 1) || (val == 0);
15840 val_conv = ChannelHandshakeLimits_clone(&val_conv);
15841 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
15844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
15845 LDKUserConfig this_ptr_conv;
15846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15847 this_ptr_conv.is_owned = false;
15848 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
15849 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15850 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15851 uint64_t ret_ref = (uint64_t)ret_var.inner;
15852 if (ret_var.is_owned) {
15858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15859 LDKUserConfig this_ptr_conv;
15860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15861 this_ptr_conv.is_owned = false;
15862 LDKChannelConfig val_conv;
15863 val_conv.inner = (void*)(val & (~1));
15864 val_conv.is_owned = (val & 1) || (val == 0);
15865 val_conv = ChannelConfig_clone(&val_conv);
15866 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
15869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
15870 LDKUserConfig this_ptr_conv;
15871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15872 this_ptr_conv.is_owned = false;
15873 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
15877 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) {
15878 LDKUserConfig this_ptr_conv;
15879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15880 this_ptr_conv.is_owned = false;
15881 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
15884 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) {
15885 LDKChannelHandshakeConfig own_channel_config_arg_conv;
15886 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
15887 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
15888 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
15889 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
15890 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
15891 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
15892 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
15893 LDKChannelConfig channel_options_arg_conv;
15894 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
15895 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
15896 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
15897 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);
15898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15900 uint64_t ret_ref = (uint64_t)ret_var.inner;
15901 if (ret_var.is_owned) {
15907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15908 LDKUserConfig orig_conv;
15909 orig_conv.inner = (void*)(orig & (~1));
15910 orig_conv.is_owned = false;
15911 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
15912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15914 uint64_t ret_ref = (uint64_t)ret_var.inner;
15915 if (ret_var.is_owned) {
15921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
15922 LDKUserConfig ret_var = UserConfig_default();
15923 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15924 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15925 uint64_t ret_ref = (uint64_t)ret_var.inner;
15926 if (ret_var.is_owned) {
15932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15933 LDKBestBlock this_obj_conv;
15934 this_obj_conv.inner = (void*)(this_obj & (~1));
15935 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15936 BestBlock_free(this_obj_conv);
15939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15940 LDKBestBlock orig_conv;
15941 orig_conv.inner = (void*)(orig & (~1));
15942 orig_conv.is_owned = false;
15943 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15946 uint64_t ret_ref = (uint64_t)ret_var.inner;
15947 if (ret_var.is_owned) {
15953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15954 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15955 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15958 uint64_t ret_ref = (uint64_t)ret_var.inner;
15959 if (ret_var.is_owned) {
15965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15966 LDKThirtyTwoBytes block_hash_ref;
15967 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15968 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15969 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15970 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15971 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15972 uint64_t ret_ref = (uint64_t)ret_var.inner;
15973 if (ret_var.is_owned) {
15979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15980 LDKBestBlock this_arg_conv;
15981 this_arg_conv.inner = (void*)(this_arg & (~1));
15982 this_arg_conv.is_owned = false;
15983 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15984 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15988 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15989 LDKBestBlock this_arg_conv;
15990 this_arg_conv.inner = (void*)(this_arg & (~1));
15991 this_arg_conv.is_owned = false;
15992 int32_t ret_val = BestBlock_height(&this_arg_conv);
15996 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15997 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
15998 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
16002 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
16003 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
16007 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
16008 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
16012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16013 if ((this_ptr & 1) != 0) return;
16014 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
16015 FREE((void*)this_ptr);
16016 Access_free(this_ptr_conv);
16019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16020 if ((this_ptr & 1) != 0) return;
16021 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
16022 FREE((void*)this_ptr);
16023 Listen_free(this_ptr_conv);
16026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16027 if ((this_ptr & 1) != 0) return;
16028 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
16029 FREE((void*)this_ptr);
16030 Confirm_free(this_ptr_conv);
16033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16034 if ((this_ptr & 1) != 0) return;
16035 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
16036 FREE((void*)this_ptr);
16037 Watch_free(this_ptr_conv);
16040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16041 if ((this_ptr & 1) != 0) return;
16042 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
16043 FREE((void*)this_ptr);
16044 Filter_free(this_ptr_conv);
16047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16048 LDKWatchedOutput this_obj_conv;
16049 this_obj_conv.inner = (void*)(this_obj & (~1));
16050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16051 WatchedOutput_free(this_obj_conv);
16054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16055 LDKWatchedOutput this_ptr_conv;
16056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16057 this_ptr_conv.is_owned = false;
16058 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16059 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
16063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16064 LDKWatchedOutput this_ptr_conv;
16065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16066 this_ptr_conv.is_owned = false;
16067 LDKThirtyTwoBytes val_ref;
16068 CHECK((*env)->GetArrayLength(env, val) == 32);
16069 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16070 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
16073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16074 LDKWatchedOutput this_ptr_conv;
16075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16076 this_ptr_conv.is_owned = false;
16077 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
16078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16080 uint64_t ret_ref = (uint64_t)ret_var.inner;
16081 if (ret_var.is_owned) {
16087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16088 LDKWatchedOutput this_ptr_conv;
16089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16090 this_ptr_conv.is_owned = false;
16091 LDKOutPoint val_conv;
16092 val_conv.inner = (void*)(val & (~1));
16093 val_conv.is_owned = (val & 1) || (val == 0);
16094 val_conv = OutPoint_clone(&val_conv);
16095 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
16098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16099 LDKWatchedOutput this_ptr_conv;
16100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16101 this_ptr_conv.is_owned = false;
16102 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
16103 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16104 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16109 LDKWatchedOutput this_ptr_conv;
16110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16111 this_ptr_conv.is_owned = false;
16112 LDKCVec_u8Z val_ref;
16113 val_ref.datalen = (*env)->GetArrayLength(env, val);
16114 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
16115 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
16116 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
16119 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) {
16120 LDKThirtyTwoBytes block_hash_arg_ref;
16121 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
16122 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
16123 LDKOutPoint outpoint_arg_conv;
16124 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16125 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16126 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16127 LDKCVec_u8Z script_pubkey_arg_ref;
16128 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
16129 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16130 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
16131 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
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_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16142 LDKWatchedOutput orig_conv;
16143 orig_conv.inner = (void*)(orig & (~1));
16144 orig_conv.is_owned = false;
16145 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
16146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16148 uint64_t ret_ref = (uint64_t)ret_var.inner;
16149 if (ret_var.is_owned) {
16155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
16156 LDKWatchedOutput o_conv;
16157 o_conv.inner = (void*)(o & (~1));
16158 o_conv.is_owned = false;
16159 int64_t ret_val = WatchedOutput_hash(&o_conv);
16163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16164 if ((this_ptr & 1) != 0) return;
16165 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
16166 FREE((void*)this_ptr);
16167 BroadcasterInterface_free(this_ptr_conv);
16170 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16171 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
16172 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
16176 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
16177 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
16181 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
16182 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
16186 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
16187 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
16191 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16192 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
16193 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
16194 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
16198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16199 if ((this_ptr & 1) != 0) return;
16200 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
16201 FREE((void*)this_ptr);
16202 FeeEstimator_free(this_ptr_conv);
16205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16206 LDKChainMonitor this_obj_conv;
16207 this_obj_conv.inner = (void*)(this_obj & (~1));
16208 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16209 ChainMonitor_free(this_obj_conv);
16212 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) {
16213 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
16214 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
16215 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
16216 // Manually implement clone for Java trait instances
16217 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
16218 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16219 LDKFilter_JCalls_cloned(&chain_source_conv.some);
16222 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16223 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16224 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16225 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16227 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16228 if (logger_conv.free == LDKLogger_JCalls_free) {
16229 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16230 LDKLogger_JCalls_cloned(&logger_conv);
16232 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
16233 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
16234 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16235 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
16237 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
16238 if (persister_conv.free == LDKPersist_JCalls_free) {
16239 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16240 LDKPersist_JCalls_cloned(&persister_conv);
16242 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
16243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16245 uint64_t ret_ref = (uint64_t)ret_var.inner;
16246 if (ret_var.is_owned) {
16252 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) {
16253 LDKChainMonitor this_arg_conv;
16254 this_arg_conv.inner = (void*)(this_arg & (~1));
16255 this_arg_conv.is_owned = false;
16256 LDKCVec_ChannelDetailsZ ignored_channels_constr;
16257 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
16258 if (ignored_channels_constr.datalen > 0)
16259 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16261 ignored_channels_constr.data = NULL;
16262 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
16263 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
16264 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
16265 LDKChannelDetails ignored_channels_conv_16_conv;
16266 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
16267 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
16268 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
16269 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
16271 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
16272 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
16273 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16274 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16275 for (size_t j = 0; j < ret_var.datalen; j++) {
16276 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16277 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
16278 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
16279 ret_arr_ptr[j] = ret_conv_9_ref;
16281 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16282 FREE(ret_var.data);
16286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
16287 LDKChainMonitor this_arg_conv;
16288 this_arg_conv.inner = (void*)(this_arg & (~1));
16289 this_arg_conv.is_owned = false;
16290 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
16291 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
16292 return (uint64_t)ret_ret;
16295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
16296 LDKChainMonitor this_arg_conv;
16297 this_arg_conv.inner = (void*)(this_arg & (~1));
16298 this_arg_conv.is_owned = false;
16299 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16300 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
16301 return (uint64_t)ret_ret;
16304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
16305 LDKChainMonitor this_arg_conv;
16306 this_arg_conv.inner = (void*)(this_arg & (~1));
16307 this_arg_conv.is_owned = false;
16308 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
16309 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
16310 return (uint64_t)ret_ret;
16313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16314 LDKChainMonitor this_arg_conv;
16315 this_arg_conv.inner = (void*)(this_arg & (~1));
16316 this_arg_conv.is_owned = false;
16317 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16318 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
16319 return (uint64_t)ret_ret;
16322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16323 LDKChannelMonitorUpdate this_obj_conv;
16324 this_obj_conv.inner = (void*)(this_obj & (~1));
16325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16326 ChannelMonitorUpdate_free(this_obj_conv);
16329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16330 LDKChannelMonitorUpdate this_ptr_conv;
16331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16332 this_ptr_conv.is_owned = false;
16333 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
16337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16338 LDKChannelMonitorUpdate this_ptr_conv;
16339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16340 this_ptr_conv.is_owned = false;
16341 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
16344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16345 LDKChannelMonitorUpdate orig_conv;
16346 orig_conv.inner = (void*)(orig & (~1));
16347 orig_conv.is_owned = false;
16348 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
16349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16351 uint64_t ret_ref = (uint64_t)ret_var.inner;
16352 if (ret_var.is_owned) {
16358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16359 LDKChannelMonitorUpdate obj_conv;
16360 obj_conv.inner = (void*)(obj & (~1));
16361 obj_conv.is_owned = false;
16362 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
16363 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16364 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16365 CVec_u8Z_free(ret_var);
16369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16370 LDKu8slice ser_ref;
16371 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16372 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16373 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16374 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
16375 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16376 return (uint64_t)ret_conv;
16379 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16380 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
16381 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
16385 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
16386 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
16390 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
16391 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
16395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16396 LDKMonitorUpdateError this_obj_conv;
16397 this_obj_conv.inner = (void*)(this_obj & (~1));
16398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16399 MonitorUpdateError_free(this_obj_conv);
16402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16403 LDKMonitorUpdateError orig_conv;
16404 orig_conv.inner = (void*)(orig & (~1));
16405 orig_conv.is_owned = false;
16406 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
16407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16409 uint64_t ret_ref = (uint64_t)ret_var.inner;
16410 if (ret_var.is_owned) {
16416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16417 if ((this_ptr & 1) != 0) return;
16418 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
16419 FREE((void*)this_ptr);
16420 MonitorEvent_free(this_ptr_conv);
16423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16424 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
16425 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16426 *ret_copy = MonitorEvent_clone(orig_conv);
16427 uint64_t ret_ref = (uint64_t)ret_copy;
16431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
16432 LDKHTLCUpdate a_conv;
16433 a_conv.inner = (void*)(a & (~1));
16434 a_conv.is_owned = (a & 1) || (a == 0);
16435 a_conv = HTLCUpdate_clone(&a_conv);
16436 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16437 *ret_copy = MonitorEvent_htlcevent(a_conv);
16438 uint64_t ret_ref = (uint64_t)ret_copy;
16442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
16443 LDKOutPoint a_conv;
16444 a_conv.inner = (void*)(a & (~1));
16445 a_conv.is_owned = (a & 1) || (a == 0);
16446 a_conv = OutPoint_clone(&a_conv);
16447 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16448 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
16449 uint64_t ret_ref = (uint64_t)ret_copy;
16453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16454 LDKHTLCUpdate this_obj_conv;
16455 this_obj_conv.inner = (void*)(this_obj & (~1));
16456 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16457 HTLCUpdate_free(this_obj_conv);
16460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16461 LDKHTLCUpdate orig_conv;
16462 orig_conv.inner = (void*)(orig & (~1));
16463 orig_conv.is_owned = false;
16464 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
16465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16467 uint64_t ret_ref = (uint64_t)ret_var.inner;
16468 if (ret_var.is_owned) {
16474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16475 LDKHTLCUpdate obj_conv;
16476 obj_conv.inner = (void*)(obj & (~1));
16477 obj_conv.is_owned = false;
16478 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
16479 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16480 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16481 CVec_u8Z_free(ret_var);
16485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16486 LDKu8slice ser_ref;
16487 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16488 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16489 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16490 *ret_conv = HTLCUpdate_read(ser_ref);
16491 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16492 return (uint64_t)ret_conv;
16495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16496 if ((this_ptr & 1) != 0) return;
16497 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
16498 FREE((void*)this_ptr);
16499 Balance_free(this_ptr_conv);
16502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16503 LDKBalance* orig_conv = (LDKBalance*)orig;
16504 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16505 *ret_copy = Balance_clone(orig_conv);
16506 uint64_t ret_ref = (uint64_t)ret_copy;
16510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
16511 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16512 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
16513 uint64_t ret_ref = (uint64_t)ret_copy;
16517 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) {
16518 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16519 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
16520 uint64_t ret_ref = (uint64_t)ret_copy;
16524 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) {
16525 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16526 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
16527 uint64_t ret_ref = (uint64_t)ret_copy;
16531 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) {
16532 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16533 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
16534 uint64_t ret_ref = (uint64_t)ret_copy;
16538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16539 LDKBalance* a_conv = (LDKBalance*)a;
16540 LDKBalance* b_conv = (LDKBalance*)b;
16541 jboolean ret_val = Balance_eq(a_conv, b_conv);
16545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16546 LDKChannelMonitor this_obj_conv;
16547 this_obj_conv.inner = (void*)(this_obj & (~1));
16548 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16549 ChannelMonitor_free(this_obj_conv);
16552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16553 LDKChannelMonitor orig_conv;
16554 orig_conv.inner = (void*)(orig & (~1));
16555 orig_conv.is_owned = false;
16556 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
16557 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16558 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16559 uint64_t ret_ref = (uint64_t)ret_var.inner;
16560 if (ret_var.is_owned) {
16566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
16567 LDKChannelMonitor obj_conv;
16568 obj_conv.inner = (void*)(obj & (~1));
16569 obj_conv.is_owned = false;
16570 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
16571 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16572 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16573 CVec_u8Z_free(ret_var);
16577 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) {
16578 LDKChannelMonitor this_arg_conv;
16579 this_arg_conv.inner = (void*)(this_arg & (~1));
16580 this_arg_conv.is_owned = false;
16581 LDKChannelMonitorUpdate updates_conv;
16582 updates_conv.inner = (void*)(updates & (~1));
16583 updates_conv.is_owned = false;
16584 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16585 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16586 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
16587 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
16588 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
16589 return (uint64_t)ret_conv;
16592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
16593 LDKChannelMonitor this_arg_conv;
16594 this_arg_conv.inner = (void*)(this_arg & (~1));
16595 this_arg_conv.is_owned = false;
16596 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
16600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
16601 LDKChannelMonitor this_arg_conv;
16602 this_arg_conv.inner = (void*)(this_arg & (~1));
16603 this_arg_conv.is_owned = false;
16604 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16605 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
16606 return (uint64_t)ret_ref;
16609 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
16610 LDKChannelMonitor this_arg_conv;
16611 this_arg_conv.inner = (void*)(this_arg & (~1));
16612 this_arg_conv.is_owned = false;
16613 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
16614 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16615 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16616 for (size_t v = 0; v < ret_var.datalen; v++) {
16617 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16618 *ret_conv_47_ref = ret_var.data[v];
16619 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
16621 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16622 FREE(ret_var.data);
16626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
16627 LDKChannelMonitor this_arg_conv;
16628 this_arg_conv.inner = (void*)(this_arg & (~1));
16629 this_arg_conv.is_owned = false;
16630 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
16631 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
16634 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16635 LDKChannelMonitor this_arg_conv;
16636 this_arg_conv.inner = (void*)(this_arg & (~1));
16637 this_arg_conv.is_owned = false;
16638 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
16639 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16640 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16641 for (size_t o = 0; o < ret_var.datalen; o++) {
16642 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16643 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
16644 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
16645 ret_arr_ptr[o] = ret_conv_14_ref;
16647 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16648 FREE(ret_var.data);
16652 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16653 LDKChannelMonitor this_arg_conv;
16654 this_arg_conv.inner = (void*)(this_arg & (~1));
16655 this_arg_conv.is_owned = false;
16656 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
16657 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16658 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16659 for (size_t h = 0; h < ret_var.datalen; h++) {
16660 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16661 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
16662 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
16663 ret_arr_ptr[h] = ret_conv_7_ref;
16665 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16666 FREE(ret_var.data);
16670 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) {
16671 LDKChannelMonitor this_arg_conv;
16672 this_arg_conv.inner = (void*)(this_arg & (~1));
16673 this_arg_conv.is_owned = false;
16674 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
16675 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
16676 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
16678 for (size_t i = 0; i < ret_var.datalen; i++) {
16679 LDKTransaction ret_conv_8_var = ret_var.data[i];
16680 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
16681 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
16682 Transaction_free(ret_conv_8_var);
16683 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
16685 FREE(ret_var.data);
16689 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) {
16690 LDKChannelMonitor this_arg_conv;
16691 this_arg_conv.inner = (void*)(this_arg & (~1));
16692 this_arg_conv.is_owned = false;
16693 unsigned char header_arr[80];
16694 CHECK((*env)->GetArrayLength(env, header) == 80);
16695 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16696 unsigned char (*header_ref)[80] = &header_arr;
16697 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16698 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16699 if (txdata_constr.datalen > 0)
16700 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16702 txdata_constr.data = NULL;
16703 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16704 for (size_t y = 0; y < txdata_constr.datalen; y++) {
16705 int64_t txdata_conv_24 = txdata_vals[y];
16706 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
16707 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
16708 txdata_constr.data[y] = txdata_conv_24_conv;
16710 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16711 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16712 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16713 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16714 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16716 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16717 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16718 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16719 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16721 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16722 if (logger_conv.free == LDKLogger_JCalls_free) {
16723 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16724 LDKLogger_JCalls_cloned(&logger_conv);
16726 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);
16727 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16728 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16729 for (size_t u = 0; u < ret_var.datalen; u++) {
16730 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16731 *ret_conv_46_ref = ret_var.data[u];
16732 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
16734 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16735 FREE(ret_var.data);
16739 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) {
16740 LDKChannelMonitor this_arg_conv;
16741 this_arg_conv.inner = (void*)(this_arg & (~1));
16742 this_arg_conv.is_owned = false;
16743 unsigned char header_arr[80];
16744 CHECK((*env)->GetArrayLength(env, header) == 80);
16745 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16746 unsigned char (*header_ref)[80] = &header_arr;
16747 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16748 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16749 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16750 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16752 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16753 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16754 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16755 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16757 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16758 if (logger_conv.free == LDKLogger_JCalls_free) {
16759 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16760 LDKLogger_JCalls_cloned(&logger_conv);
16762 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
16765 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) {
16766 LDKChannelMonitor this_arg_conv;
16767 this_arg_conv.inner = (void*)(this_arg & (~1));
16768 this_arg_conv.is_owned = false;
16769 unsigned char header_arr[80];
16770 CHECK((*env)->GetArrayLength(env, header) == 80);
16771 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16772 unsigned char (*header_ref)[80] = &header_arr;
16773 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16774 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16775 if (txdata_constr.datalen > 0)
16776 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16778 txdata_constr.data = NULL;
16779 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16780 for (size_t y = 0; y < txdata_constr.datalen; y++) {
16781 int64_t txdata_conv_24 = txdata_vals[y];
16782 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
16783 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
16784 txdata_constr.data[y] = txdata_conv_24_conv;
16786 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16787 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16788 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16789 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16790 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16792 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16793 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16794 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16795 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16797 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16798 if (logger_conv.free == LDKLogger_JCalls_free) {
16799 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16800 LDKLogger_JCalls_cloned(&logger_conv);
16802 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);
16803 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16804 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16805 for (size_t u = 0; u < ret_var.datalen; u++) {
16806 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16807 *ret_conv_46_ref = ret_var.data[u];
16808 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
16810 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16811 FREE(ret_var.data);
16815 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) {
16816 LDKChannelMonitor this_arg_conv;
16817 this_arg_conv.inner = (void*)(this_arg & (~1));
16818 this_arg_conv.is_owned = false;
16819 unsigned char txid_arr[32];
16820 CHECK((*env)->GetArrayLength(env, txid) == 32);
16821 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
16822 unsigned char (*txid_ref)[32] = &txid_arr;
16823 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16824 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16825 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16826 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16828 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16829 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16830 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16831 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16833 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16834 if (logger_conv.free == LDKLogger_JCalls_free) {
16835 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16836 LDKLogger_JCalls_cloned(&logger_conv);
16838 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
16841 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) {
16842 LDKChannelMonitor this_arg_conv;
16843 this_arg_conv.inner = (void*)(this_arg & (~1));
16844 this_arg_conv.is_owned = false;
16845 unsigned char header_arr[80];
16846 CHECK((*env)->GetArrayLength(env, header) == 80);
16847 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16848 unsigned char (*header_ref)[80] = &header_arr;
16849 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16850 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16851 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16852 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16854 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16855 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16856 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16857 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16859 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16860 if (logger_conv.free == LDKLogger_JCalls_free) {
16861 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16862 LDKLogger_JCalls_cloned(&logger_conv);
16864 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
16865 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16866 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16867 for (size_t u = 0; u < ret_var.datalen; u++) {
16868 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16869 *ret_conv_46_ref = ret_var.data[u];
16870 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
16872 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16873 FREE(ret_var.data);
16877 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
16878 LDKChannelMonitor this_arg_conv;
16879 this_arg_conv.inner = (void*)(this_arg & (~1));
16880 this_arg_conv.is_owned = false;
16881 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
16882 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
16884 for (size_t i = 0; i < ret_var.datalen; i++) {
16885 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
16886 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
16887 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
16889 FREE(ret_var.data);
16893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
16894 LDKChannelMonitor this_arg_conv;
16895 this_arg_conv.inner = (void*)(this_arg & (~1));
16896 this_arg_conv.is_owned = false;
16897 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
16898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16900 uint64_t ret_ref = (uint64_t)ret_var.inner;
16901 if (ret_var.is_owned) {
16907 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
16908 LDKChannelMonitor this_arg_conv;
16909 this_arg_conv.inner = (void*)(this_arg & (~1));
16910 this_arg_conv.is_owned = false;
16911 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
16912 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16913 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16914 for (size_t j = 0; j < ret_var.datalen; j++) {
16915 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16916 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
16917 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
16918 ret_arr_ptr[j] = ret_conv_9_ref;
16920 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16921 FREE(ret_var.data);
16925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16926 if ((this_ptr & 1) != 0) return;
16927 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
16928 FREE((void*)this_ptr);
16929 Persist_free(this_ptr_conv);
16932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16933 LDKu8slice ser_ref;
16934 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16935 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16936 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
16937 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16938 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
16939 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16940 return (uint64_t)ret_conv;
16943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16944 LDKOutPoint this_obj_conv;
16945 this_obj_conv.inner = (void*)(this_obj & (~1));
16946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16947 OutPoint_free(this_obj_conv);
16950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
16951 LDKOutPoint this_ptr_conv;
16952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16953 this_ptr_conv.is_owned = false;
16954 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16955 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
16959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16960 LDKOutPoint this_ptr_conv;
16961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16962 this_ptr_conv.is_owned = false;
16963 LDKThirtyTwoBytes val_ref;
16964 CHECK((*env)->GetArrayLength(env, val) == 32);
16965 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16966 OutPoint_set_txid(&this_ptr_conv, val_ref);
16969 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
16970 LDKOutPoint this_ptr_conv;
16971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16972 this_ptr_conv.is_owned = false;
16973 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
16977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16978 LDKOutPoint this_ptr_conv;
16979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16980 this_ptr_conv.is_owned = false;
16981 OutPoint_set_index(&this_ptr_conv, val);
16984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
16985 LDKThirtyTwoBytes txid_arg_ref;
16986 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
16987 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
16988 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
16989 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16990 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16991 uint64_t ret_ref = (uint64_t)ret_var.inner;
16992 if (ret_var.is_owned) {
16998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16999 LDKOutPoint orig_conv;
17000 orig_conv.inner = (void*)(orig & (~1));
17001 orig_conv.is_owned = false;
17002 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
17003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17005 uint64_t ret_ref = (uint64_t)ret_var.inner;
17006 if (ret_var.is_owned) {
17012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17013 LDKOutPoint a_conv;
17014 a_conv.inner = (void*)(a & (~1));
17015 a_conv.is_owned = false;
17016 LDKOutPoint b_conv;
17017 b_conv.inner = (void*)(b & (~1));
17018 b_conv.is_owned = false;
17019 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
17023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
17024 LDKOutPoint o_conv;
17025 o_conv.inner = (void*)(o & (~1));
17026 o_conv.is_owned = false;
17027 int64_t ret_val = OutPoint_hash(&o_conv);
17031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17032 LDKOutPoint this_arg_conv;
17033 this_arg_conv.inner = (void*)(this_arg & (~1));
17034 this_arg_conv.is_owned = false;
17035 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17036 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
17040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
17041 LDKOutPoint obj_conv;
17042 obj_conv.inner = (void*)(obj & (~1));
17043 obj_conv.is_owned = false;
17044 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
17045 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17046 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17047 CVec_u8Z_free(ret_var);
17051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17052 LDKu8slice ser_ref;
17053 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17054 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17055 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17056 *ret_conv = OutPoint_read(ser_ref);
17057 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17058 return (uint64_t)ret_conv;
17061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17062 LDKDelayedPaymentOutputDescriptor this_obj_conv;
17063 this_obj_conv.inner = (void*)(this_obj & (~1));
17064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17065 DelayedPaymentOutputDescriptor_free(this_obj_conv);
17068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17069 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17071 this_ptr_conv.is_owned = false;
17072 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
17073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17075 uint64_t ret_ref = (uint64_t)ret_var.inner;
17076 if (ret_var.is_owned) {
17082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17083 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17085 this_ptr_conv.is_owned = false;
17086 LDKOutPoint val_conv;
17087 val_conv.inner = (void*)(val & (~1));
17088 val_conv.is_owned = (val & 1) || (val == 0);
17089 val_conv = OutPoint_clone(&val_conv);
17090 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
17093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17094 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17096 this_ptr_conv.is_owned = false;
17097 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17098 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
17102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17103 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17105 this_ptr_conv.is_owned = false;
17106 LDKPublicKey val_ref;
17107 CHECK((*env)->GetArrayLength(env, val) == 33);
17108 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17109 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
17112 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17113 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17115 this_ptr_conv.is_owned = false;
17116 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
17120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17121 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17123 this_ptr_conv.is_owned = false;
17124 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
17127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17128 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17130 this_ptr_conv.is_owned = false;
17131 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
17132 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
17133 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
17136 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17137 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17139 this_ptr_conv.is_owned = false;
17140 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17141 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
17145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17146 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17148 this_ptr_conv.is_owned = false;
17149 LDKPublicKey val_ref;
17150 CHECK((*env)->GetArrayLength(env, val) == 33);
17151 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17152 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
17155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17156 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17158 this_ptr_conv.is_owned = false;
17159 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17160 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
17164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17165 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17167 this_ptr_conv.is_owned = false;
17168 LDKThirtyTwoBytes val_ref;
17169 CHECK((*env)->GetArrayLength(env, val) == 32);
17170 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17171 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
17174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17175 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17177 this_ptr_conv.is_owned = false;
17178 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
17182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17183 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17185 this_ptr_conv.is_owned = false;
17186 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
17189 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) {
17190 LDKOutPoint outpoint_arg_conv;
17191 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17192 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17193 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17194 LDKPublicKey per_commitment_point_arg_ref;
17195 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17196 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17197 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
17198 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
17199 LDKPublicKey revocation_pubkey_arg_ref;
17200 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
17201 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
17202 LDKThirtyTwoBytes channel_keys_id_arg_ref;
17203 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
17204 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
17205 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);
17206 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17207 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17208 uint64_t ret_ref = (uint64_t)ret_var.inner;
17209 if (ret_var.is_owned) {
17215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17216 LDKDelayedPaymentOutputDescriptor orig_conv;
17217 orig_conv.inner = (void*)(orig & (~1));
17218 orig_conv.is_owned = false;
17219 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
17220 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17221 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17222 uint64_t ret_ref = (uint64_t)ret_var.inner;
17223 if (ret_var.is_owned) {
17229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17230 LDKDelayedPaymentOutputDescriptor obj_conv;
17231 obj_conv.inner = (void*)(obj & (~1));
17232 obj_conv.is_owned = false;
17233 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
17234 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17235 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17236 CVec_u8Z_free(ret_var);
17240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17241 LDKu8slice ser_ref;
17242 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17243 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17244 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17245 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
17246 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17247 return (uint64_t)ret_conv;
17250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17251 LDKStaticPaymentOutputDescriptor this_obj_conv;
17252 this_obj_conv.inner = (void*)(this_obj & (~1));
17253 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17254 StaticPaymentOutputDescriptor_free(this_obj_conv);
17257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17258 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17260 this_ptr_conv.is_owned = false;
17261 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
17262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17264 uint64_t ret_ref = (uint64_t)ret_var.inner;
17265 if (ret_var.is_owned) {
17271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17272 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17274 this_ptr_conv.is_owned = false;
17275 LDKOutPoint val_conv;
17276 val_conv.inner = (void*)(val & (~1));
17277 val_conv.is_owned = (val & 1) || (val == 0);
17278 val_conv = OutPoint_clone(&val_conv);
17279 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
17282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17283 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17285 this_ptr_conv.is_owned = false;
17286 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
17287 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
17288 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
17291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17292 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17294 this_ptr_conv.is_owned = false;
17295 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17296 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
17300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17301 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17303 this_ptr_conv.is_owned = false;
17304 LDKThirtyTwoBytes val_ref;
17305 CHECK((*env)->GetArrayLength(env, val) == 32);
17306 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17307 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
17310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17311 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17313 this_ptr_conv.is_owned = false;
17314 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
17318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17319 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17321 this_ptr_conv.is_owned = false;
17322 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
17325 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) {
17326 LDKOutPoint outpoint_arg_conv;
17327 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17328 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17329 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17330 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
17331 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
17332 LDKThirtyTwoBytes channel_keys_id_arg_ref;
17333 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
17334 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
17335 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
17336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17338 uint64_t ret_ref = (uint64_t)ret_var.inner;
17339 if (ret_var.is_owned) {
17345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17346 LDKStaticPaymentOutputDescriptor orig_conv;
17347 orig_conv.inner = (void*)(orig & (~1));
17348 orig_conv.is_owned = false;
17349 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
17350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17352 uint64_t ret_ref = (uint64_t)ret_var.inner;
17353 if (ret_var.is_owned) {
17359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17360 LDKStaticPaymentOutputDescriptor obj_conv;
17361 obj_conv.inner = (void*)(obj & (~1));
17362 obj_conv.is_owned = false;
17363 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
17364 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17365 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17366 CVec_u8Z_free(ret_var);
17370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17371 LDKu8slice ser_ref;
17372 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17373 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17374 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17375 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
17376 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17377 return (uint64_t)ret_conv;
17380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17381 if ((this_ptr & 1) != 0) return;
17382 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
17383 FREE((void*)this_ptr);
17384 SpendableOutputDescriptor_free(this_ptr_conv);
17387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17388 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
17389 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17390 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
17391 uint64_t ret_ref = (uint64_t)ret_copy;
17395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
17396 LDKOutPoint outpoint_conv;
17397 outpoint_conv.inner = (void*)(outpoint & (~1));
17398 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
17399 outpoint_conv = OutPoint_clone(&outpoint_conv);
17400 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
17401 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
17402 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17403 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
17404 uint64_t ret_ref = (uint64_t)ret_copy;
17408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
17409 LDKDelayedPaymentOutputDescriptor a_conv;
17410 a_conv.inner = (void*)(a & (~1));
17411 a_conv.is_owned = (a & 1) || (a == 0);
17412 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
17413 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17414 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
17415 uint64_t ret_ref = (uint64_t)ret_copy;
17419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
17420 LDKStaticPaymentOutputDescriptor a_conv;
17421 a_conv.inner = (void*)(a & (~1));
17422 a_conv.is_owned = (a & 1) || (a == 0);
17423 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
17424 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17425 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
17426 uint64_t ret_ref = (uint64_t)ret_copy;
17430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17431 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
17432 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
17433 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17434 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17435 CVec_u8Z_free(ret_var);
17439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17440 LDKu8slice ser_ref;
17441 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17442 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17443 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17444 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
17445 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17446 return (uint64_t)ret_conv;
17449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17450 if ((this_ptr & 1) != 0) return;
17451 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
17452 FREE((void*)this_ptr);
17453 BaseSign_free(this_ptr_conv);
17456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17457 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
17458 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
17459 *ret_ret = Sign_clone(orig_conv);
17460 return (uint64_t)ret_ret;
17463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17464 if ((this_ptr & 1) != 0) return;
17465 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
17466 FREE((void*)this_ptr);
17467 Sign_free(this_ptr_conv);
17470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17471 if ((this_ptr & 1) != 0) return;
17472 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
17473 FREE((void*)this_ptr);
17474 KeysInterface_free(this_ptr_conv);
17477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17478 LDKInMemorySigner this_obj_conv;
17479 this_obj_conv.inner = (void*)(this_obj & (~1));
17480 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17481 InMemorySigner_free(this_obj_conv);
17484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17485 LDKInMemorySigner this_ptr_conv;
17486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17487 this_ptr_conv.is_owned = false;
17488 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
17493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17494 LDKInMemorySigner this_ptr_conv;
17495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17496 this_ptr_conv.is_owned = false;
17497 LDKSecretKey val_ref;
17498 CHECK((*env)->GetArrayLength(env, val) == 32);
17499 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17500 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
17503 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17504 LDKInMemorySigner this_ptr_conv;
17505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17506 this_ptr_conv.is_owned = false;
17507 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17508 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
17512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17513 LDKInMemorySigner this_ptr_conv;
17514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17515 this_ptr_conv.is_owned = false;
17516 LDKSecretKey val_ref;
17517 CHECK((*env)->GetArrayLength(env, val) == 32);
17518 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17519 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
17522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17523 LDKInMemorySigner this_ptr_conv;
17524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17525 this_ptr_conv.is_owned = false;
17526 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17527 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
17531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17532 LDKInMemorySigner this_ptr_conv;
17533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17534 this_ptr_conv.is_owned = false;
17535 LDKSecretKey val_ref;
17536 CHECK((*env)->GetArrayLength(env, val) == 32);
17537 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17538 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
17541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17542 LDKInMemorySigner this_ptr_conv;
17543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17544 this_ptr_conv.is_owned = false;
17545 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17546 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
17550 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) {
17551 LDKInMemorySigner this_ptr_conv;
17552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17553 this_ptr_conv.is_owned = false;
17554 LDKSecretKey val_ref;
17555 CHECK((*env)->GetArrayLength(env, val) == 32);
17556 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17557 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
17560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17561 LDKInMemorySigner this_ptr_conv;
17562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17563 this_ptr_conv.is_owned = false;
17564 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17565 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
17569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17570 LDKInMemorySigner this_ptr_conv;
17571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17572 this_ptr_conv.is_owned = false;
17573 LDKSecretKey val_ref;
17574 CHECK((*env)->GetArrayLength(env, val) == 32);
17575 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17576 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
17579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
17580 LDKInMemorySigner this_ptr_conv;
17581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17582 this_ptr_conv.is_owned = false;
17583 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17584 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
17588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17589 LDKInMemorySigner this_ptr_conv;
17590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17591 this_ptr_conv.is_owned = false;
17592 LDKThirtyTwoBytes val_ref;
17593 CHECK((*env)->GetArrayLength(env, val) == 32);
17594 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17595 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
17598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17599 LDKInMemorySigner orig_conv;
17600 orig_conv.inner = (void*)(orig & (~1));
17601 orig_conv.is_owned = false;
17602 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
17603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17605 uint64_t ret_ref = (uint64_t)ret_var.inner;
17606 if (ret_var.is_owned) {
17612 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) {
17613 LDKSecretKey funding_key_ref;
17614 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
17615 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
17616 LDKSecretKey revocation_base_key_ref;
17617 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
17618 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
17619 LDKSecretKey payment_key_ref;
17620 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
17621 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
17622 LDKSecretKey delayed_payment_base_key_ref;
17623 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
17624 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
17625 LDKSecretKey htlc_base_key_ref;
17626 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
17627 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
17628 LDKThirtyTwoBytes commitment_seed_ref;
17629 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
17630 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
17631 LDKThirtyTwoBytes channel_keys_id_ref;
17632 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
17633 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
17634 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);
17635 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17636 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17637 uint64_t ret_ref = (uint64_t)ret_var.inner;
17638 if (ret_var.is_owned) {
17644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
17645 LDKInMemorySigner this_arg_conv;
17646 this_arg_conv.inner = (void*)(this_arg & (~1));
17647 this_arg_conv.is_owned = false;
17648 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
17649 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17650 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17651 uint64_t ret_ref = (uint64_t)ret_var.inner;
17652 if (ret_var.is_owned) {
17658 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17659 LDKInMemorySigner this_arg_conv;
17660 this_arg_conv.inner = (void*)(this_arg & (~1));
17661 this_arg_conv.is_owned = false;
17662 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
17666 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17667 LDKInMemorySigner this_arg_conv;
17668 this_arg_conv.inner = (void*)(this_arg & (~1));
17669 this_arg_conv.is_owned = false;
17670 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
17674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
17675 LDKInMemorySigner this_arg_conv;
17676 this_arg_conv.inner = (void*)(this_arg & (~1));
17677 this_arg_conv.is_owned = false;
17678 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
17682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
17683 LDKInMemorySigner this_arg_conv;
17684 this_arg_conv.inner = (void*)(this_arg & (~1));
17685 this_arg_conv.is_owned = false;
17686 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
17687 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17688 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17689 uint64_t ret_ref = (uint64_t)ret_var.inner;
17690 if (ret_var.is_owned) {
17696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
17697 LDKInMemorySigner this_arg_conv;
17698 this_arg_conv.inner = (void*)(this_arg & (~1));
17699 this_arg_conv.is_owned = false;
17700 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
17701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17703 uint64_t ret_ref = (uint64_t)ret_var.inner;
17704 if (ret_var.is_owned) {
17710 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) {
17711 LDKInMemorySigner this_arg_conv;
17712 this_arg_conv.inner = (void*)(this_arg & (~1));
17713 this_arg_conv.is_owned = false;
17714 LDKTransaction spend_tx_ref;
17715 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
17716 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17717 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
17718 spend_tx_ref.data_is_owned = true;
17719 LDKStaticPaymentOutputDescriptor descriptor_conv;
17720 descriptor_conv.inner = (void*)(descriptor & (~1));
17721 descriptor_conv.is_owned = false;
17722 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17723 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17724 return (uint64_t)ret_conv;
17727 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) {
17728 LDKInMemorySigner this_arg_conv;
17729 this_arg_conv.inner = (void*)(this_arg & (~1));
17730 this_arg_conv.is_owned = false;
17731 LDKTransaction spend_tx_ref;
17732 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
17733 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17734 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
17735 spend_tx_ref.data_is_owned = true;
17736 LDKDelayedPaymentOutputDescriptor descriptor_conv;
17737 descriptor_conv.inner = (void*)(descriptor & (~1));
17738 descriptor_conv.is_owned = false;
17739 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17740 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17741 return (uint64_t)ret_conv;
17744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
17745 LDKInMemorySigner this_arg_conv;
17746 this_arg_conv.inner = (void*)(this_arg & (~1));
17747 this_arg_conv.is_owned = false;
17748 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
17749 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
17750 return (uint64_t)ret_ret;
17753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
17754 LDKInMemorySigner this_arg_conv;
17755 this_arg_conv.inner = (void*)(this_arg & (~1));
17756 this_arg_conv.is_owned = false;
17757 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
17758 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
17759 return (uint64_t)ret_ret;
17762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
17763 LDKInMemorySigner obj_conv;
17764 obj_conv.inner = (void*)(obj & (~1));
17765 obj_conv.is_owned = false;
17766 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
17767 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17768 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17769 CVec_u8Z_free(ret_var);
17773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17774 LDKu8slice ser_ref;
17775 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17776 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17777 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17778 *ret_conv = InMemorySigner_read(ser_ref);
17779 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17780 return (uint64_t)ret_conv;
17783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17784 LDKKeysManager this_obj_conv;
17785 this_obj_conv.inner = (void*)(this_obj & (~1));
17786 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17787 KeysManager_free(this_obj_conv);
17790 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) {
17791 unsigned char seed_arr[32];
17792 CHECK((*env)->GetArrayLength(env, seed) == 32);
17793 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
17794 unsigned char (*seed_ref)[32] = &seed_arr;
17795 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
17796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17798 uint64_t ret_ref = (uint64_t)ret_var.inner;
17799 if (ret_var.is_owned) {
17805 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) {
17806 LDKKeysManager this_arg_conv;
17807 this_arg_conv.inner = (void*)(this_arg & (~1));
17808 this_arg_conv.is_owned = false;
17809 unsigned char params_arr[32];
17810 CHECK((*env)->GetArrayLength(env, params) == 32);
17811 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
17812 unsigned char (*params_ref)[32] = ¶ms_arr;
17813 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
17814 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17815 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17816 uint64_t ret_ref = (uint64_t)ret_var.inner;
17817 if (ret_var.is_owned) {
17823 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) {
17824 LDKKeysManager this_arg_conv;
17825 this_arg_conv.inner = (void*)(this_arg & (~1));
17826 this_arg_conv.is_owned = false;
17827 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
17828 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
17829 if (descriptors_constr.datalen > 0)
17830 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17832 descriptors_constr.data = NULL;
17833 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
17834 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
17835 int64_t descriptors_conv_27 = descriptors_vals[b];
17836 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
17837 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
17838 descriptors_constr.data[b] = descriptors_conv_27_conv;
17840 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
17841 LDKCVec_TxOutZ outputs_constr;
17842 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
17843 if (outputs_constr.datalen > 0)
17844 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17846 outputs_constr.data = NULL;
17847 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
17848 for (size_t h = 0; h < outputs_constr.datalen; h++) {
17849 int64_t outputs_conv_7 = outputs_vals[h];
17850 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
17851 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
17852 outputs_constr.data[h] = outputs_conv_7_conv;
17854 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
17855 LDKCVec_u8Z change_destination_script_ref;
17856 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
17857 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
17858 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
17859 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17860 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
17861 return (uint64_t)ret_conv;
17864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
17865 LDKKeysManager this_arg_conv;
17866 this_arg_conv.inner = (void*)(this_arg & (~1));
17867 this_arg_conv.is_owned = false;
17868 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
17869 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
17870 return (uint64_t)ret_ret;
17873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17874 LDKChannelManager this_obj_conv;
17875 this_obj_conv.inner = (void*)(this_obj & (~1));
17876 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17877 ChannelManager_free(this_obj_conv);
17880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17881 LDKChainParameters this_obj_conv;
17882 this_obj_conv.inner = (void*)(this_obj & (~1));
17883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17884 ChainParameters_free(this_obj_conv);
17887 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
17888 LDKChainParameters this_ptr_conv;
17889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17890 this_ptr_conv.is_owned = false;
17891 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
17895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
17896 LDKChainParameters this_ptr_conv;
17897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17898 this_ptr_conv.is_owned = false;
17899 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
17900 ChainParameters_set_network(&this_ptr_conv, val_conv);
17903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
17904 LDKChainParameters this_ptr_conv;
17905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17906 this_ptr_conv.is_owned = false;
17907 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
17908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17910 uint64_t ret_ref = (uint64_t)ret_var.inner;
17911 if (ret_var.is_owned) {
17917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17918 LDKChainParameters this_ptr_conv;
17919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17920 this_ptr_conv.is_owned = false;
17921 LDKBestBlock val_conv;
17922 val_conv.inner = (void*)(val & (~1));
17923 val_conv.is_owned = (val & 1) || (val == 0);
17924 val_conv = BestBlock_clone(&val_conv);
17925 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
17928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
17929 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
17930 LDKBestBlock best_block_arg_conv;
17931 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
17932 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
17933 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
17934 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
17935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17937 uint64_t ret_ref = (uint64_t)ret_var.inner;
17938 if (ret_var.is_owned) {
17944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17945 LDKChainParameters orig_conv;
17946 orig_conv.inner = (void*)(orig & (~1));
17947 orig_conv.is_owned = false;
17948 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
17949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17951 uint64_t ret_ref = (uint64_t)ret_var.inner;
17952 if (ret_var.is_owned) {
17958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17959 LDKCounterpartyForwardingInfo this_obj_conv;
17960 this_obj_conv.inner = (void*)(this_obj & (~1));
17961 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17962 CounterpartyForwardingInfo_free(this_obj_conv);
17965 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17966 LDKCounterpartyForwardingInfo this_ptr_conv;
17967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17968 this_ptr_conv.is_owned = false;
17969 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
17973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17974 LDKCounterpartyForwardingInfo this_ptr_conv;
17975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17976 this_ptr_conv.is_owned = false;
17977 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
17980 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
17981 LDKCounterpartyForwardingInfo this_ptr_conv;
17982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17983 this_ptr_conv.is_owned = false;
17984 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
17988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17989 LDKCounterpartyForwardingInfo this_ptr_conv;
17990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17991 this_ptr_conv.is_owned = false;
17992 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
17995 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
17996 LDKCounterpartyForwardingInfo this_ptr_conv;
17997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17998 this_ptr_conv.is_owned = false;
17999 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
18003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18004 LDKCounterpartyForwardingInfo this_ptr_conv;
18005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18006 this_ptr_conv.is_owned = false;
18007 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
18010 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) {
18011 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
18012 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18013 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18014 uint64_t ret_ref = (uint64_t)ret_var.inner;
18015 if (ret_var.is_owned) {
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18022 LDKCounterpartyForwardingInfo orig_conv;
18023 orig_conv.inner = (void*)(orig & (~1));
18024 orig_conv.is_owned = false;
18025 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
18026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18028 uint64_t ret_ref = (uint64_t)ret_var.inner;
18029 if (ret_var.is_owned) {
18035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18036 LDKChannelCounterparty this_obj_conv;
18037 this_obj_conv.inner = (void*)(this_obj & (~1));
18038 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18039 ChannelCounterparty_free(this_obj_conv);
18042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18043 LDKChannelCounterparty this_ptr_conv;
18044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18045 this_ptr_conv.is_owned = false;
18046 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18047 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
18051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18052 LDKChannelCounterparty this_ptr_conv;
18053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18054 this_ptr_conv.is_owned = false;
18055 LDKPublicKey val_ref;
18056 CHECK((*env)->GetArrayLength(env, val) == 33);
18057 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18058 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
18061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18062 LDKChannelCounterparty this_ptr_conv;
18063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18064 this_ptr_conv.is_owned = false;
18065 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
18066 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18067 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18068 uint64_t ret_ref = (uint64_t)ret_var.inner;
18069 if (ret_var.is_owned) {
18075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18076 LDKChannelCounterparty this_ptr_conv;
18077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18078 this_ptr_conv.is_owned = false;
18079 LDKInitFeatures val_conv;
18080 val_conv.inner = (void*)(val & (~1));
18081 val_conv.is_owned = (val & 1) || (val == 0);
18082 val_conv = InitFeatures_clone(&val_conv);
18083 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
18086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
18087 LDKChannelCounterparty this_ptr_conv;
18088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18089 this_ptr_conv.is_owned = false;
18090 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
18094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18095 LDKChannelCounterparty this_ptr_conv;
18096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18097 this_ptr_conv.is_owned = false;
18098 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
18101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
18102 LDKChannelCounterparty this_ptr_conv;
18103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18104 this_ptr_conv.is_owned = false;
18105 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
18106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18108 uint64_t ret_ref = (uint64_t)ret_var.inner;
18109 if (ret_var.is_owned) {
18115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18116 LDKChannelCounterparty this_ptr_conv;
18117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18118 this_ptr_conv.is_owned = false;
18119 LDKCounterpartyForwardingInfo val_conv;
18120 val_conv.inner = (void*)(val & (~1));
18121 val_conv.is_owned = (val & 1) || (val == 0);
18122 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
18123 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
18126 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) {
18127 LDKPublicKey node_id_arg_ref;
18128 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
18129 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
18130 LDKInitFeatures features_arg_conv;
18131 features_arg_conv.inner = (void*)(features_arg & (~1));
18132 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18133 features_arg_conv = InitFeatures_clone(&features_arg_conv);
18134 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
18135 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
18136 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
18137 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
18138 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
18139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18141 uint64_t ret_ref = (uint64_t)ret_var.inner;
18142 if (ret_var.is_owned) {
18148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18149 LDKChannelCounterparty orig_conv;
18150 orig_conv.inner = (void*)(orig & (~1));
18151 orig_conv.is_owned = false;
18152 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
18153 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18154 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18155 uint64_t ret_ref = (uint64_t)ret_var.inner;
18156 if (ret_var.is_owned) {
18162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18163 LDKChannelDetails this_obj_conv;
18164 this_obj_conv.inner = (void*)(this_obj & (~1));
18165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18166 ChannelDetails_free(this_obj_conv);
18169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18170 LDKChannelDetails this_ptr_conv;
18171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18172 this_ptr_conv.is_owned = false;
18173 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18174 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
18178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18179 LDKChannelDetails this_ptr_conv;
18180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18181 this_ptr_conv.is_owned = false;
18182 LDKThirtyTwoBytes val_ref;
18183 CHECK((*env)->GetArrayLength(env, val) == 32);
18184 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18185 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
18188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
18189 LDKChannelDetails this_ptr_conv;
18190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18191 this_ptr_conv.is_owned = false;
18192 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
18193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18195 uint64_t ret_ref = (uint64_t)ret_var.inner;
18196 if (ret_var.is_owned) {
18202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18203 LDKChannelDetails this_ptr_conv;
18204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18205 this_ptr_conv.is_owned = false;
18206 LDKChannelCounterparty val_conv;
18207 val_conv.inner = (void*)(val & (~1));
18208 val_conv.is_owned = (val & 1) || (val == 0);
18209 val_conv = ChannelCounterparty_clone(&val_conv);
18210 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
18213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
18214 LDKChannelDetails this_ptr_conv;
18215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18216 this_ptr_conv.is_owned = false;
18217 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
18218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18220 uint64_t ret_ref = (uint64_t)ret_var.inner;
18221 if (ret_var.is_owned) {
18227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18228 LDKChannelDetails this_ptr_conv;
18229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18230 this_ptr_conv.is_owned = false;
18231 LDKOutPoint val_conv;
18232 val_conv.inner = (void*)(val & (~1));
18233 val_conv.is_owned = (val & 1) || (val == 0);
18234 val_conv = OutPoint_clone(&val_conv);
18235 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
18238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18239 LDKChannelDetails this_ptr_conv;
18240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18241 this_ptr_conv.is_owned = false;
18242 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18243 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
18244 uint64_t ret_ref = (uint64_t)ret_copy;
18248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18249 LDKChannelDetails this_ptr_conv;
18250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18251 this_ptr_conv.is_owned = false;
18252 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18253 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
18254 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
18257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18258 LDKChannelDetails this_ptr_conv;
18259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18260 this_ptr_conv.is_owned = false;
18261 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
18265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18266 LDKChannelDetails this_ptr_conv;
18267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18268 this_ptr_conv.is_owned = false;
18269 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
18272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
18273 LDKChannelDetails this_ptr_conv;
18274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18275 this_ptr_conv.is_owned = false;
18276 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18277 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
18278 uint64_t ret_ref = (uint64_t)ret_copy;
18282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18283 LDKChannelDetails this_ptr_conv;
18284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18285 this_ptr_conv.is_owned = false;
18286 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18287 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
18288 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
18291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18292 LDKChannelDetails this_ptr_conv;
18293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18294 this_ptr_conv.is_owned = false;
18295 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
18299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18300 LDKChannelDetails this_ptr_conv;
18301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18302 this_ptr_conv.is_owned = false;
18303 ChannelDetails_set_user_id(&this_ptr_conv, val);
18306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18307 LDKChannelDetails this_ptr_conv;
18308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18309 this_ptr_conv.is_owned = false;
18310 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
18314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18315 LDKChannelDetails this_ptr_conv;
18316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18317 this_ptr_conv.is_owned = false;
18318 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
18321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18322 LDKChannelDetails this_ptr_conv;
18323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18324 this_ptr_conv.is_owned = false;
18325 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
18329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18330 LDKChannelDetails this_ptr_conv;
18331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18332 this_ptr_conv.is_owned = false;
18333 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
18336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
18337 LDKChannelDetails this_ptr_conv;
18338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18339 this_ptr_conv.is_owned = false;
18340 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
18341 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
18342 uint64_t ret_ref = (uint64_t)ret_copy;
18346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18347 LDKChannelDetails this_ptr_conv;
18348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18349 this_ptr_conv.is_owned = false;
18350 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
18351 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
18352 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
18355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18356 LDKChannelDetails this_ptr_conv;
18357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18358 this_ptr_conv.is_owned = false;
18359 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18360 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
18361 uint64_t ret_ref = (uint64_t)ret_copy;
18365 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) {
18366 LDKChannelDetails this_ptr_conv;
18367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18368 this_ptr_conv.is_owned = false;
18369 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
18370 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
18371 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
18374 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
18375 LDKChannelDetails this_ptr_conv;
18376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18377 this_ptr_conv.is_owned = false;
18378 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
18382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18383 LDKChannelDetails this_ptr_conv;
18384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18385 this_ptr_conv.is_owned = false;
18386 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
18389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
18390 LDKChannelDetails this_ptr_conv;
18391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18392 this_ptr_conv.is_owned = false;
18393 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
18397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18398 LDKChannelDetails this_ptr_conv;
18399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18400 this_ptr_conv.is_owned = false;
18401 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
18404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
18405 LDKChannelDetails this_ptr_conv;
18406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18407 this_ptr_conv.is_owned = false;
18408 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
18412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18413 LDKChannelDetails this_ptr_conv;
18414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18415 this_ptr_conv.is_owned = false;
18416 ChannelDetails_set_is_usable(&this_ptr_conv, val);
18419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
18420 LDKChannelDetails this_ptr_conv;
18421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18422 this_ptr_conv.is_owned = false;
18423 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
18427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18428 LDKChannelDetails this_ptr_conv;
18429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18430 this_ptr_conv.is_owned = false;
18431 ChannelDetails_set_is_public(&this_ptr_conv, val);
18434 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) {
18435 LDKThirtyTwoBytes channel_id_arg_ref;
18436 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18437 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18438 LDKChannelCounterparty counterparty_arg_conv;
18439 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
18440 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
18441 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
18442 LDKOutPoint funding_txo_arg_conv;
18443 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
18444 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
18445 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
18446 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
18447 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
18448 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
18449 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
18450 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
18451 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
18452 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
18453 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);
18454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18456 uint64_t ret_ref = (uint64_t)ret_var.inner;
18457 if (ret_var.is_owned) {
18463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18464 LDKChannelDetails orig_conv;
18465 orig_conv.inner = (void*)(orig & (~1));
18466 orig_conv.is_owned = false;
18467 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
18468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18470 uint64_t ret_ref = (uint64_t)ret_var.inner;
18471 if (ret_var.is_owned) {
18477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18478 if ((this_ptr & 1) != 0) return;
18479 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
18480 FREE((void*)this_ptr);
18481 PaymentSendFailure_free(this_ptr_conv);
18484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18485 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
18486 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18487 *ret_copy = PaymentSendFailure_clone(orig_conv);
18488 uint64_t ret_ref = (uint64_t)ret_copy;
18492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
18493 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
18494 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
18495 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18496 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
18497 uint64_t ret_ref = (uint64_t)ret_copy;
18501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
18502 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
18503 a_constr.datalen = (*env)->GetArrayLength(env, a);
18504 if (a_constr.datalen > 0)
18505 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18507 a_constr.data = NULL;
18508 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18509 for (size_t w = 0; w < a_constr.datalen; w++) {
18510 int64_t a_conv_22 = a_vals[w];
18511 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
18512 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
18513 a_constr.data[w] = a_conv_22_conv;
18515 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18516 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18517 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
18518 uint64_t ret_ref = (uint64_t)ret_copy;
18522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
18523 LDKCVec_APIErrorZ a_constr;
18524 a_constr.datalen = (*env)->GetArrayLength(env, a);
18525 if (a_constr.datalen > 0)
18526 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18528 a_constr.data = NULL;
18529 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18530 for (size_t k = 0; k < a_constr.datalen; k++) {
18531 int64_t a_conv_10 = a_vals[k];
18532 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
18533 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
18534 a_constr.data[k] = a_conv_10_conv;
18536 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18537 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18538 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
18539 uint64_t ret_ref = (uint64_t)ret_copy;
18543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) {
18544 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
18545 a_constr.datalen = (*env)->GetArrayLength(env, a);
18546 if (a_constr.datalen > 0)
18547 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18549 a_constr.data = NULL;
18550 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18551 for (size_t w = 0; w < a_constr.datalen; w++) {
18552 int64_t a_conv_22 = a_vals[w];
18553 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
18554 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
18555 a_constr.data[w] = a_conv_22_conv;
18557 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18558 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18559 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
18560 uint64_t ret_ref = (uint64_t)ret_copy;
18564 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) {
18565 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
18566 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
18567 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18568 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
18570 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
18571 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
18572 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18573 LDKWatch_JCalls_cloned(&chain_monitor_conv);
18575 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
18576 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18577 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18578 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
18580 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18581 if (logger_conv.free == LDKLogger_JCalls_free) {
18582 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18583 LDKLogger_JCalls_cloned(&logger_conv);
18585 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
18586 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
18587 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18588 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
18590 LDKUserConfig config_conv;
18591 config_conv.inner = (void*)(config & (~1));
18592 config_conv.is_owned = (config & 1) || (config == 0);
18593 config_conv = UserConfig_clone(&config_conv);
18594 LDKChainParameters params_conv;
18595 params_conv.inner = (void*)(params & (~1));
18596 params_conv.is_owned = (params & 1) || (params == 0);
18597 params_conv = ChainParameters_clone(¶ms_conv);
18598 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
18599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18601 uint64_t ret_ref = (uint64_t)ret_var.inner;
18602 if (ret_var.is_owned) {
18608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
18609 LDKChannelManager this_arg_conv;
18610 this_arg_conv.inner = (void*)(this_arg & (~1));
18611 this_arg_conv.is_owned = false;
18612 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
18613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18615 uint64_t ret_ref = (uint64_t)ret_var.inner;
18616 if (ret_var.is_owned) {
18622 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) {
18623 LDKChannelManager this_arg_conv;
18624 this_arg_conv.inner = (void*)(this_arg & (~1));
18625 this_arg_conv.is_owned = false;
18626 LDKPublicKey their_network_key_ref;
18627 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
18628 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
18629 LDKUserConfig override_config_conv;
18630 override_config_conv.inner = (void*)(override_config & (~1));
18631 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
18632 override_config_conv = UserConfig_clone(&override_config_conv);
18633 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18634 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
18635 return (uint64_t)ret_conv;
18638 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18639 LDKChannelManager this_arg_conv;
18640 this_arg_conv.inner = (void*)(this_arg & (~1));
18641 this_arg_conv.is_owned = false;
18642 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
18643 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18644 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18645 for (size_t q = 0; q < ret_var.datalen; q++) {
18646 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18647 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18648 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18649 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18650 if (ret_conv_16_var.is_owned) {
18651 ret_conv_16_ref |= 1;
18653 ret_arr_ptr[q] = ret_conv_16_ref;
18655 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18656 FREE(ret_var.data);
18660 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18661 LDKChannelManager this_arg_conv;
18662 this_arg_conv.inner = (void*)(this_arg & (~1));
18663 this_arg_conv.is_owned = false;
18664 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
18665 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18666 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18667 for (size_t q = 0; q < ret_var.datalen; q++) {
18668 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18669 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18670 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18671 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18672 if (ret_conv_16_var.is_owned) {
18673 ret_conv_16_ref |= 1;
18675 ret_arr_ptr[q] = ret_conv_16_ref;
18677 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18678 FREE(ret_var.data);
18682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
18683 LDKChannelManager this_arg_conv;
18684 this_arg_conv.inner = (void*)(this_arg & (~1));
18685 this_arg_conv.is_owned = false;
18686 unsigned char channel_id_arr[32];
18687 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18688 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18689 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18690 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18691 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
18692 return (uint64_t)ret_conv;
18695 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) {
18696 LDKChannelManager this_arg_conv;
18697 this_arg_conv.inner = (void*)(this_arg & (~1));
18698 this_arg_conv.is_owned = false;
18699 unsigned char channel_id_arr[32];
18700 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18701 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18702 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18703 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18704 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
18705 return (uint64_t)ret_conv;
18708 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) {
18709 LDKChannelManager this_arg_conv;
18710 this_arg_conv.inner = (void*)(this_arg & (~1));
18711 this_arg_conv.is_owned = false;
18712 unsigned char channel_id_arr[32];
18713 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18714 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18715 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18716 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18717 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
18718 return (uint64_t)ret_conv;
18721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18722 LDKChannelManager this_arg_conv;
18723 this_arg_conv.inner = (void*)(this_arg & (~1));
18724 this_arg_conv.is_owned = false;
18725 ChannelManager_force_close_all_channels(&this_arg_conv);
18728 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) {
18729 LDKChannelManager this_arg_conv;
18730 this_arg_conv.inner = (void*)(this_arg & (~1));
18731 this_arg_conv.is_owned = false;
18732 LDKRoute route_conv;
18733 route_conv.inner = (void*)(route & (~1));
18734 route_conv.is_owned = false;
18735 LDKThirtyTwoBytes payment_hash_ref;
18736 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
18737 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
18738 LDKThirtyTwoBytes payment_secret_ref;
18739 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
18740 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
18741 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18742 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
18743 return (uint64_t)ret_conv;
18746 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) {
18747 LDKChannelManager this_arg_conv;
18748 this_arg_conv.inner = (void*)(this_arg & (~1));
18749 this_arg_conv.is_owned = false;
18750 LDKRoute route_conv;
18751 route_conv.inner = (void*)(route & (~1));
18752 route_conv.is_owned = false;
18753 LDKThirtyTwoBytes payment_preimage_ref;
18754 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
18755 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
18756 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
18757 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
18758 return (uint64_t)ret_conv;
18761 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) {
18762 LDKChannelManager this_arg_conv;
18763 this_arg_conv.inner = (void*)(this_arg & (~1));
18764 this_arg_conv.is_owned = false;
18765 unsigned char temporary_channel_id_arr[32];
18766 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
18767 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
18768 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
18769 LDKTransaction funding_transaction_ref;
18770 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
18771 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
18772 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
18773 funding_transaction_ref.data_is_owned = true;
18774 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18775 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
18776 return (uint64_t)ret_conv;
18779 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) {
18780 LDKChannelManager this_arg_conv;
18781 this_arg_conv.inner = (void*)(this_arg & (~1));
18782 this_arg_conv.is_owned = false;
18783 LDKThreeBytes rgb_ref;
18784 CHECK((*env)->GetArrayLength(env, rgb) == 3);
18785 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
18786 LDKThirtyTwoBytes alias_ref;
18787 CHECK((*env)->GetArrayLength(env, alias) == 32);
18788 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
18789 LDKCVec_NetAddressZ addresses_constr;
18790 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
18791 if (addresses_constr.datalen > 0)
18792 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18794 addresses_constr.data = NULL;
18795 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
18796 for (size_t m = 0; m < addresses_constr.datalen; m++) {
18797 int64_t addresses_conv_12 = addresses_vals[m];
18798 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
18799 addresses_constr.data[m] = addresses_conv_12_conv;
18801 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
18802 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
18805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
18806 LDKChannelManager this_arg_conv;
18807 this_arg_conv.inner = (void*)(this_arg & (~1));
18808 this_arg_conv.is_owned = false;
18809 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
18812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
18813 LDKChannelManager this_arg_conv;
18814 this_arg_conv.inner = (void*)(this_arg & (~1));
18815 this_arg_conv.is_owned = false;
18816 ChannelManager_timer_tick_occurred(&this_arg_conv);
18819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
18820 LDKChannelManager this_arg_conv;
18821 this_arg_conv.inner = (void*)(this_arg & (~1));
18822 this_arg_conv.is_owned = false;
18823 unsigned char payment_hash_arr[32];
18824 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
18825 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
18826 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
18827 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
18831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
18832 LDKChannelManager this_arg_conv;
18833 this_arg_conv.inner = (void*)(this_arg & (~1));
18834 this_arg_conv.is_owned = false;
18835 LDKThirtyTwoBytes payment_preimage_ref;
18836 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
18837 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
18838 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
18842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
18843 LDKChannelManager this_arg_conv;
18844 this_arg_conv.inner = (void*)(this_arg & (~1));
18845 this_arg_conv.is_owned = false;
18846 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
18851 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) {
18852 LDKChannelManager this_arg_conv;
18853 this_arg_conv.inner = (void*)(this_arg & (~1));
18854 this_arg_conv.is_owned = false;
18855 LDKOutPoint funding_txo_conv;
18856 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18857 funding_txo_conv.is_owned = false;
18858 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
18861 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) {
18862 LDKChannelManager this_arg_conv;
18863 this_arg_conv.inner = (void*)(this_arg & (~1));
18864 this_arg_conv.is_owned = false;
18865 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
18866 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
18867 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18868 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
18869 return (uint64_t)ret_ref;
18872 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) {
18873 LDKChannelManager this_arg_conv;
18874 this_arg_conv.inner = (void*)(this_arg & (~1));
18875 this_arg_conv.is_owned = false;
18876 LDKThirtyTwoBytes payment_hash_ref;
18877 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
18878 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
18879 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
18880 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
18881 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18882 *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);
18883 return (uint64_t)ret_conv;
18886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
18887 LDKChannelManager this_arg_conv;
18888 this_arg_conv.inner = (void*)(this_arg & (~1));
18889 this_arg_conv.is_owned = false;
18890 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18891 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
18892 return (uint64_t)ret_ret;
18895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
18896 LDKChannelManager this_arg_conv;
18897 this_arg_conv.inner = (void*)(this_arg & (~1));
18898 this_arg_conv.is_owned = false;
18899 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18900 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
18901 return (uint64_t)ret_ret;
18904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
18905 LDKChannelManager this_arg_conv;
18906 this_arg_conv.inner = (void*)(this_arg & (~1));
18907 this_arg_conv.is_owned = false;
18908 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
18909 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
18910 return (uint64_t)ret_ret;
18913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
18914 LDKChannelManager this_arg_conv;
18915 this_arg_conv.inner = (void*)(this_arg & (~1));
18916 this_arg_conv.is_owned = false;
18917 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18918 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
18919 return (uint64_t)ret_ret;
18922 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) {
18923 LDKChannelManager this_arg_conv;
18924 this_arg_conv.inner = (void*)(this_arg & (~1));
18925 this_arg_conv.is_owned = false;
18926 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
18930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
18931 LDKChannelManager this_arg_conv;
18932 this_arg_conv.inner = (void*)(this_arg & (~1));
18933 this_arg_conv.is_owned = false;
18934 ChannelManager_await_persistable_update(&this_arg_conv);
18937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
18938 LDKChannelManager this_arg_conv;
18939 this_arg_conv.inner = (void*)(this_arg & (~1));
18940 this_arg_conv.is_owned = false;
18941 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
18942 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18943 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18944 uint64_t ret_ref = (uint64_t)ret_var.inner;
18945 if (ret_var.is_owned) {
18951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
18952 LDKChannelManager this_arg_conv;
18953 this_arg_conv.inner = (void*)(this_arg & (~1));
18954 this_arg_conv.is_owned = false;
18955 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
18956 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
18957 return (uint64_t)ret_ret;
18960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
18961 LDKChannelManager obj_conv;
18962 obj_conv.inner = (void*)(obj & (~1));
18963 obj_conv.is_owned = false;
18964 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
18965 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18966 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18967 CVec_u8Z_free(ret_var);
18971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18972 LDKChannelManagerReadArgs this_obj_conv;
18973 this_obj_conv.inner = (void*)(this_obj & (~1));
18974 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18975 ChannelManagerReadArgs_free(this_obj_conv);
18978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
18979 LDKChannelManagerReadArgs this_ptr_conv;
18980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18981 this_ptr_conv.is_owned = false;
18982 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
18986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18987 LDKChannelManagerReadArgs this_ptr_conv;
18988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18989 this_ptr_conv.is_owned = false;
18990 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
18991 if (val_conv.free == LDKKeysInterface_JCalls_free) {
18992 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18993 LDKKeysInterface_JCalls_cloned(&val_conv);
18995 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
18998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
18999 LDKChannelManagerReadArgs this_ptr_conv;
19000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19001 this_ptr_conv.is_owned = false;
19002 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
19006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19007 LDKChannelManagerReadArgs this_ptr_conv;
19008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19009 this_ptr_conv.is_owned = false;
19010 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
19011 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
19012 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19013 LDKFeeEstimator_JCalls_cloned(&val_conv);
19015 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
19018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
19019 LDKChannelManagerReadArgs this_ptr_conv;
19020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19021 this_ptr_conv.is_owned = false;
19022 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
19026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19027 LDKChannelManagerReadArgs this_ptr_conv;
19028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19029 this_ptr_conv.is_owned = false;
19030 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
19031 if (val_conv.free == LDKWatch_JCalls_free) {
19032 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19033 LDKWatch_JCalls_cloned(&val_conv);
19035 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
19038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
19039 LDKChannelManagerReadArgs this_ptr_conv;
19040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19041 this_ptr_conv.is_owned = false;
19042 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
19046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19047 LDKChannelManagerReadArgs this_ptr_conv;
19048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19049 this_ptr_conv.is_owned = false;
19050 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
19051 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
19052 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19053 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
19055 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
19058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
19059 LDKChannelManagerReadArgs this_ptr_conv;
19060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19061 this_ptr_conv.is_owned = false;
19062 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
19066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19067 LDKChannelManagerReadArgs this_ptr_conv;
19068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19069 this_ptr_conv.is_owned = false;
19070 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
19071 if (val_conv.free == LDKLogger_JCalls_free) {
19072 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19073 LDKLogger_JCalls_cloned(&val_conv);
19075 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
19078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
19079 LDKChannelManagerReadArgs this_ptr_conv;
19080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19081 this_ptr_conv.is_owned = false;
19082 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
19083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19085 uint64_t ret_ref = (uint64_t)ret_var.inner;
19086 if (ret_var.is_owned) {
19092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19093 LDKChannelManagerReadArgs this_ptr_conv;
19094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19095 this_ptr_conv.is_owned = false;
19096 LDKUserConfig val_conv;
19097 val_conv.inner = (void*)(val & (~1));
19098 val_conv.is_owned = (val & 1) || (val == 0);
19099 val_conv = UserConfig_clone(&val_conv);
19100 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
19103 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) {
19104 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
19105 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
19106 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19107 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
19109 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
19110 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19111 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19112 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19114 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
19115 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
19116 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19117 LDKWatch_JCalls_cloned(&chain_monitor_conv);
19119 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
19120 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19121 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19122 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
19124 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19125 if (logger_conv.free == LDKLogger_JCalls_free) {
19126 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19127 LDKLogger_JCalls_cloned(&logger_conv);
19129 LDKUserConfig default_config_conv;
19130 default_config_conv.inner = (void*)(default_config & (~1));
19131 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
19132 default_config_conv = UserConfig_clone(&default_config_conv);
19133 LDKCVec_ChannelMonitorZ channel_monitors_constr;
19134 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
19135 if (channel_monitors_constr.datalen > 0)
19136 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19138 channel_monitors_constr.data = NULL;
19139 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
19140 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
19141 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
19142 LDKChannelMonitor channel_monitors_conv_16_conv;
19143 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
19144 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
19145 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
19147 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
19148 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);
19149 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19150 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19151 uint64_t ret_ref = (uint64_t)ret_var.inner;
19152 if (ret_var.is_owned) {
19158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
19159 LDKu8slice ser_ref;
19160 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19161 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19162 LDKChannelManagerReadArgs arg_conv;
19163 arg_conv.inner = (void*)(arg & (~1));
19164 arg_conv.is_owned = (arg & 1) || (arg == 0);
19165 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
19166 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19167 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
19168 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19169 return (uint64_t)ret_conv;
19172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19173 LDKDecodeError this_obj_conv;
19174 this_obj_conv.inner = (void*)(this_obj & (~1));
19175 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19176 DecodeError_free(this_obj_conv);
19179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19180 LDKDecodeError orig_conv;
19181 orig_conv.inner = (void*)(orig & (~1));
19182 orig_conv.is_owned = false;
19183 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
19184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19186 uint64_t ret_ref = (uint64_t)ret_var.inner;
19187 if (ret_var.is_owned) {
19193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19194 LDKInit this_obj_conv;
19195 this_obj_conv.inner = (void*)(this_obj & (~1));
19196 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19197 Init_free(this_obj_conv);
19200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19201 LDKInit this_ptr_conv;
19202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19203 this_ptr_conv.is_owned = false;
19204 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
19205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19207 uint64_t ret_ref = (uint64_t)ret_var.inner;
19208 if (ret_var.is_owned) {
19214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19215 LDKInit this_ptr_conv;
19216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19217 this_ptr_conv.is_owned = false;
19218 LDKInitFeatures val_conv;
19219 val_conv.inner = (void*)(val & (~1));
19220 val_conv.is_owned = (val & 1) || (val == 0);
19221 val_conv = InitFeatures_clone(&val_conv);
19222 Init_set_features(&this_ptr_conv, val_conv);
19225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
19226 LDKInitFeatures features_arg_conv;
19227 features_arg_conv.inner = (void*)(features_arg & (~1));
19228 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19229 features_arg_conv = InitFeatures_clone(&features_arg_conv);
19230 LDKInit ret_var = Init_new(features_arg_conv);
19231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19233 uint64_t ret_ref = (uint64_t)ret_var.inner;
19234 if (ret_var.is_owned) {
19240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19242 orig_conv.inner = (void*)(orig & (~1));
19243 orig_conv.is_owned = false;
19244 LDKInit ret_var = Init_clone(&orig_conv);
19245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19247 uint64_t ret_ref = (uint64_t)ret_var.inner;
19248 if (ret_var.is_owned) {
19254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19255 LDKErrorMessage this_obj_conv;
19256 this_obj_conv.inner = (void*)(this_obj & (~1));
19257 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19258 ErrorMessage_free(this_obj_conv);
19261 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19262 LDKErrorMessage this_ptr_conv;
19263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19264 this_ptr_conv.is_owned = false;
19265 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19266 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
19270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19271 LDKErrorMessage this_ptr_conv;
19272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19273 this_ptr_conv.is_owned = false;
19274 LDKThirtyTwoBytes val_ref;
19275 CHECK((*env)->GetArrayLength(env, val) == 32);
19276 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19277 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
19280 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
19281 LDKErrorMessage this_ptr_conv;
19282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19283 this_ptr_conv.is_owned = false;
19284 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
19285 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19291 LDKErrorMessage this_ptr_conv;
19292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19293 this_ptr_conv.is_owned = false;
19294 LDKStr val_conv = java_to_owned_str(env, val);
19295 ErrorMessage_set_data(&this_ptr_conv, val_conv);
19298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
19299 LDKThirtyTwoBytes channel_id_arg_ref;
19300 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19301 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19302 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
19303 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
19304 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19305 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19306 uint64_t ret_ref = (uint64_t)ret_var.inner;
19307 if (ret_var.is_owned) {
19313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19314 LDKErrorMessage orig_conv;
19315 orig_conv.inner = (void*)(orig & (~1));
19316 orig_conv.is_owned = false;
19317 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
19318 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19319 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19320 uint64_t ret_ref = (uint64_t)ret_var.inner;
19321 if (ret_var.is_owned) {
19327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19328 LDKPing this_obj_conv;
19329 this_obj_conv.inner = (void*)(this_obj & (~1));
19330 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19331 Ping_free(this_obj_conv);
19334 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19335 LDKPing this_ptr_conv;
19336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19337 this_ptr_conv.is_owned = false;
19338 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
19342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19343 LDKPing this_ptr_conv;
19344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19345 this_ptr_conv.is_owned = false;
19346 Ping_set_ponglen(&this_ptr_conv, val);
19349 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19350 LDKPing this_ptr_conv;
19351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19352 this_ptr_conv.is_owned = false;
19353 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
19357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19358 LDKPing this_ptr_conv;
19359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19360 this_ptr_conv.is_owned = false;
19361 Ping_set_byteslen(&this_ptr_conv, val);
19364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
19365 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
19366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19368 uint64_t ret_ref = (uint64_t)ret_var.inner;
19369 if (ret_var.is_owned) {
19375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19377 orig_conv.inner = (void*)(orig & (~1));
19378 orig_conv.is_owned = false;
19379 LDKPing ret_var = Ping_clone(&orig_conv);
19380 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19381 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19382 uint64_t ret_ref = (uint64_t)ret_var.inner;
19383 if (ret_var.is_owned) {
19389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19390 LDKPong this_obj_conv;
19391 this_obj_conv.inner = (void*)(this_obj & (~1));
19392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19393 Pong_free(this_obj_conv);
19396 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19397 LDKPong this_ptr_conv;
19398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19399 this_ptr_conv.is_owned = false;
19400 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
19404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19405 LDKPong this_ptr_conv;
19406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19407 this_ptr_conv.is_owned = false;
19408 Pong_set_byteslen(&this_ptr_conv, val);
19411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
19412 LDKPong ret_var = Pong_new(byteslen_arg);
19413 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19414 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19415 uint64_t ret_ref = (uint64_t)ret_var.inner;
19416 if (ret_var.is_owned) {
19422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19424 orig_conv.inner = (void*)(orig & (~1));
19425 orig_conv.is_owned = false;
19426 LDKPong ret_var = Pong_clone(&orig_conv);
19427 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19428 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19429 uint64_t ret_ref = (uint64_t)ret_var.inner;
19430 if (ret_var.is_owned) {
19436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19437 LDKOpenChannel this_obj_conv;
19438 this_obj_conv.inner = (void*)(this_obj & (~1));
19439 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19440 OpenChannel_free(this_obj_conv);
19443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19444 LDKOpenChannel this_ptr_conv;
19445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19446 this_ptr_conv.is_owned = false;
19447 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19448 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
19452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19453 LDKOpenChannel this_ptr_conv;
19454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19455 this_ptr_conv.is_owned = false;
19456 LDKThirtyTwoBytes val_ref;
19457 CHECK((*env)->GetArrayLength(env, val) == 32);
19458 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19459 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
19462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19463 LDKOpenChannel this_ptr_conv;
19464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19465 this_ptr_conv.is_owned = false;
19466 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19467 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
19471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19472 LDKOpenChannel this_ptr_conv;
19473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19474 this_ptr_conv.is_owned = false;
19475 LDKThirtyTwoBytes val_ref;
19476 CHECK((*env)->GetArrayLength(env, val) == 32);
19477 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19478 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
19481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19482 LDKOpenChannel this_ptr_conv;
19483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19484 this_ptr_conv.is_owned = false;
19485 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
19489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19490 LDKOpenChannel this_ptr_conv;
19491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19492 this_ptr_conv.is_owned = false;
19493 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
19496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19497 LDKOpenChannel this_ptr_conv;
19498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19499 this_ptr_conv.is_owned = false;
19500 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
19504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19505 LDKOpenChannel this_ptr_conv;
19506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19507 this_ptr_conv.is_owned = false;
19508 OpenChannel_set_push_msat(&this_ptr_conv, val);
19511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19512 LDKOpenChannel this_ptr_conv;
19513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19514 this_ptr_conv.is_owned = false;
19515 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
19519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19520 LDKOpenChannel this_ptr_conv;
19521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19522 this_ptr_conv.is_owned = false;
19523 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19526 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) {
19527 LDKOpenChannel this_ptr_conv;
19528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19529 this_ptr_conv.is_owned = false;
19530 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19534 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) {
19535 LDKOpenChannel this_ptr_conv;
19536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19537 this_ptr_conv.is_owned = false;
19538 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
19541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19542 LDKOpenChannel this_ptr_conv;
19543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19544 this_ptr_conv.is_owned = false;
19545 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
19549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19550 LDKOpenChannel this_ptr_conv;
19551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19552 this_ptr_conv.is_owned = false;
19553 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
19556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19557 LDKOpenChannel this_ptr_conv;
19558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19559 this_ptr_conv.is_owned = false;
19560 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
19564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19565 LDKOpenChannel this_ptr_conv;
19566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19567 this_ptr_conv.is_owned = false;
19568 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
19571 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
19572 LDKOpenChannel this_ptr_conv;
19573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19574 this_ptr_conv.is_owned = false;
19575 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
19579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19580 LDKOpenChannel this_ptr_conv;
19581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19582 this_ptr_conv.is_owned = false;
19583 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
19586 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19587 LDKOpenChannel this_ptr_conv;
19588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19589 this_ptr_conv.is_owned = false;
19590 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
19594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19595 LDKOpenChannel this_ptr_conv;
19596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19597 this_ptr_conv.is_owned = false;
19598 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
19601 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
19602 LDKOpenChannel this_ptr_conv;
19603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19604 this_ptr_conv.is_owned = false;
19605 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
19609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19610 LDKOpenChannel this_ptr_conv;
19611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19612 this_ptr_conv.is_owned = false;
19613 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
19616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19617 LDKOpenChannel this_ptr_conv;
19618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19619 this_ptr_conv.is_owned = false;
19620 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19621 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
19625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19626 LDKOpenChannel this_ptr_conv;
19627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19628 this_ptr_conv.is_owned = false;
19629 LDKPublicKey val_ref;
19630 CHECK((*env)->GetArrayLength(env, val) == 33);
19631 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19632 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
19635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19636 LDKOpenChannel this_ptr_conv;
19637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19638 this_ptr_conv.is_owned = false;
19639 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19640 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
19644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19645 LDKOpenChannel this_ptr_conv;
19646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19647 this_ptr_conv.is_owned = false;
19648 LDKPublicKey val_ref;
19649 CHECK((*env)->GetArrayLength(env, val) == 33);
19650 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19651 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
19654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19655 LDKOpenChannel this_ptr_conv;
19656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19657 this_ptr_conv.is_owned = false;
19658 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19659 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
19663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19664 LDKOpenChannel this_ptr_conv;
19665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19666 this_ptr_conv.is_owned = false;
19667 LDKPublicKey val_ref;
19668 CHECK((*env)->GetArrayLength(env, val) == 33);
19669 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19670 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
19673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19674 LDKOpenChannel this_ptr_conv;
19675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19676 this_ptr_conv.is_owned = false;
19677 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19678 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
19682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19683 LDKOpenChannel this_ptr_conv;
19684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19685 this_ptr_conv.is_owned = false;
19686 LDKPublicKey val_ref;
19687 CHECK((*env)->GetArrayLength(env, val) == 33);
19688 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19689 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19693 LDKOpenChannel this_ptr_conv;
19694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19695 this_ptr_conv.is_owned = false;
19696 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19697 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
19701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19702 LDKOpenChannel this_ptr_conv;
19703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19704 this_ptr_conv.is_owned = false;
19705 LDKPublicKey val_ref;
19706 CHECK((*env)->GetArrayLength(env, val) == 33);
19707 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19708 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
19711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19712 LDKOpenChannel this_ptr_conv;
19713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19714 this_ptr_conv.is_owned = false;
19715 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19716 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
19720 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) {
19721 LDKOpenChannel this_ptr_conv;
19722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19723 this_ptr_conv.is_owned = false;
19724 LDKPublicKey val_ref;
19725 CHECK((*env)->GetArrayLength(env, val) == 33);
19726 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19727 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
19730 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
19731 LDKOpenChannel this_ptr_conv;
19732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19733 this_ptr_conv.is_owned = false;
19734 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
19738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
19739 LDKOpenChannel this_ptr_conv;
19740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19741 this_ptr_conv.is_owned = false;
19742 OpenChannel_set_channel_flags(&this_ptr_conv, val);
19745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19746 LDKOpenChannel orig_conv;
19747 orig_conv.inner = (void*)(orig & (~1));
19748 orig_conv.is_owned = false;
19749 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
19750 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19751 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19752 uint64_t ret_ref = (uint64_t)ret_var.inner;
19753 if (ret_var.is_owned) {
19759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19760 LDKAcceptChannel this_obj_conv;
19761 this_obj_conv.inner = (void*)(this_obj & (~1));
19762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19763 AcceptChannel_free(this_obj_conv);
19766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19767 LDKAcceptChannel this_ptr_conv;
19768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19769 this_ptr_conv.is_owned = false;
19770 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19771 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
19775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19776 LDKAcceptChannel this_ptr_conv;
19777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19778 this_ptr_conv.is_owned = false;
19779 LDKThirtyTwoBytes val_ref;
19780 CHECK((*env)->GetArrayLength(env, val) == 32);
19781 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19782 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
19785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19786 LDKAcceptChannel this_ptr_conv;
19787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19788 this_ptr_conv.is_owned = false;
19789 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
19793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19794 LDKAcceptChannel this_ptr_conv;
19795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19796 this_ptr_conv.is_owned = false;
19797 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19800 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) {
19801 LDKAcceptChannel this_ptr_conv;
19802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19803 this_ptr_conv.is_owned = false;
19804 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19808 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) {
19809 LDKAcceptChannel this_ptr_conv;
19810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19811 this_ptr_conv.is_owned = false;
19812 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
19815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19816 LDKAcceptChannel this_ptr_conv;
19817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19818 this_ptr_conv.is_owned = false;
19819 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
19823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19824 LDKAcceptChannel this_ptr_conv;
19825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19826 this_ptr_conv.is_owned = false;
19827 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
19830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19831 LDKAcceptChannel this_ptr_conv;
19832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19833 this_ptr_conv.is_owned = false;
19834 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
19838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19839 LDKAcceptChannel this_ptr_conv;
19840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19841 this_ptr_conv.is_owned = false;
19842 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
19845 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
19846 LDKAcceptChannel this_ptr_conv;
19847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19848 this_ptr_conv.is_owned = false;
19849 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
19853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19854 LDKAcceptChannel this_ptr_conv;
19855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19856 this_ptr_conv.is_owned = false;
19857 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
19860 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19861 LDKAcceptChannel this_ptr_conv;
19862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19863 this_ptr_conv.is_owned = false;
19864 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
19868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19869 LDKAcceptChannel this_ptr_conv;
19870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19871 this_ptr_conv.is_owned = false;
19872 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
19875 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
19876 LDKAcceptChannel this_ptr_conv;
19877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19878 this_ptr_conv.is_owned = false;
19879 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
19883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19884 LDKAcceptChannel this_ptr_conv;
19885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19886 this_ptr_conv.is_owned = false;
19887 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
19890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19891 LDKAcceptChannel this_ptr_conv;
19892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19893 this_ptr_conv.is_owned = false;
19894 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19895 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
19899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19900 LDKAcceptChannel this_ptr_conv;
19901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19902 this_ptr_conv.is_owned = false;
19903 LDKPublicKey val_ref;
19904 CHECK((*env)->GetArrayLength(env, val) == 33);
19905 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19906 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
19909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19910 LDKAcceptChannel this_ptr_conv;
19911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19912 this_ptr_conv.is_owned = false;
19913 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
19918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19919 LDKAcceptChannel this_ptr_conv;
19920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19921 this_ptr_conv.is_owned = false;
19922 LDKPublicKey val_ref;
19923 CHECK((*env)->GetArrayLength(env, val) == 33);
19924 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19925 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
19928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19929 LDKAcceptChannel this_ptr_conv;
19930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19931 this_ptr_conv.is_owned = false;
19932 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19933 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
19937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19938 LDKAcceptChannel this_ptr_conv;
19939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19940 this_ptr_conv.is_owned = false;
19941 LDKPublicKey val_ref;
19942 CHECK((*env)->GetArrayLength(env, val) == 33);
19943 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19944 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
19947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19948 LDKAcceptChannel this_ptr_conv;
19949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19950 this_ptr_conv.is_owned = false;
19951 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19952 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
19956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19957 LDKAcceptChannel this_ptr_conv;
19958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19959 this_ptr_conv.is_owned = false;
19960 LDKPublicKey val_ref;
19961 CHECK((*env)->GetArrayLength(env, val) == 33);
19962 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19963 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19967 LDKAcceptChannel this_ptr_conv;
19968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19969 this_ptr_conv.is_owned = false;
19970 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19971 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
19975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19976 LDKAcceptChannel this_ptr_conv;
19977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19978 this_ptr_conv.is_owned = false;
19979 LDKPublicKey val_ref;
19980 CHECK((*env)->GetArrayLength(env, val) == 33);
19981 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19982 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
19985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19986 LDKAcceptChannel this_ptr_conv;
19987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19988 this_ptr_conv.is_owned = false;
19989 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19990 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
19994 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) {
19995 LDKAcceptChannel this_ptr_conv;
19996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19997 this_ptr_conv.is_owned = false;
19998 LDKPublicKey val_ref;
19999 CHECK((*env)->GetArrayLength(env, val) == 33);
20000 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20001 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
20004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20005 LDKAcceptChannel orig_conv;
20006 orig_conv.inner = (void*)(orig & (~1));
20007 orig_conv.is_owned = false;
20008 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
20009 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20010 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20011 uint64_t ret_ref = (uint64_t)ret_var.inner;
20012 if (ret_var.is_owned) {
20018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20019 LDKFundingCreated this_obj_conv;
20020 this_obj_conv.inner = (void*)(this_obj & (~1));
20021 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20022 FundingCreated_free(this_obj_conv);
20025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20026 LDKFundingCreated this_ptr_conv;
20027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20028 this_ptr_conv.is_owned = false;
20029 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20030 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
20034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20035 LDKFundingCreated this_ptr_conv;
20036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20037 this_ptr_conv.is_owned = false;
20038 LDKThirtyTwoBytes val_ref;
20039 CHECK((*env)->GetArrayLength(env, val) == 32);
20040 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20041 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
20044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
20045 LDKFundingCreated this_ptr_conv;
20046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20047 this_ptr_conv.is_owned = false;
20048 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
20053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20054 LDKFundingCreated this_ptr_conv;
20055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20056 this_ptr_conv.is_owned = false;
20057 LDKThirtyTwoBytes val_ref;
20058 CHECK((*env)->GetArrayLength(env, val) == 32);
20059 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20060 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
20063 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
20064 LDKFundingCreated this_ptr_conv;
20065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20066 this_ptr_conv.is_owned = false;
20067 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
20071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20072 LDKFundingCreated this_ptr_conv;
20073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20074 this_ptr_conv.is_owned = false;
20075 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
20078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20079 LDKFundingCreated 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, 64);
20083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
20087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20088 LDKFundingCreated this_ptr_conv;
20089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20090 this_ptr_conv.is_owned = false;
20091 LDKSignature val_ref;
20092 CHECK((*env)->GetArrayLength(env, val) == 64);
20093 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20094 FundingCreated_set_signature(&this_ptr_conv, val_ref);
20097 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) {
20098 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
20099 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
20100 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
20101 LDKThirtyTwoBytes funding_txid_arg_ref;
20102 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
20103 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
20104 LDKSignature signature_arg_ref;
20105 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20106 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20107 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
20108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20110 uint64_t ret_ref = (uint64_t)ret_var.inner;
20111 if (ret_var.is_owned) {
20117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20118 LDKFundingCreated orig_conv;
20119 orig_conv.inner = (void*)(orig & (~1));
20120 orig_conv.is_owned = false;
20121 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
20122 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20123 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20124 uint64_t ret_ref = (uint64_t)ret_var.inner;
20125 if (ret_var.is_owned) {
20131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20132 LDKFundingSigned this_obj_conv;
20133 this_obj_conv.inner = (void*)(this_obj & (~1));
20134 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20135 FundingSigned_free(this_obj_conv);
20138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20139 LDKFundingSigned this_ptr_conv;
20140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20141 this_ptr_conv.is_owned = false;
20142 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20143 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
20147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20148 LDKFundingSigned this_ptr_conv;
20149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20150 this_ptr_conv.is_owned = false;
20151 LDKThirtyTwoBytes val_ref;
20152 CHECK((*env)->GetArrayLength(env, val) == 32);
20153 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20154 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
20157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20158 LDKFundingSigned this_ptr_conv;
20159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20160 this_ptr_conv.is_owned = false;
20161 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20162 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
20166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20167 LDKFundingSigned this_ptr_conv;
20168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20169 this_ptr_conv.is_owned = false;
20170 LDKSignature val_ref;
20171 CHECK((*env)->GetArrayLength(env, val) == 64);
20172 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20173 FundingSigned_set_signature(&this_ptr_conv, val_ref);
20176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
20177 LDKThirtyTwoBytes channel_id_arg_ref;
20178 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20179 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20180 LDKSignature signature_arg_ref;
20181 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20182 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20183 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
20184 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20185 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20186 uint64_t ret_ref = (uint64_t)ret_var.inner;
20187 if (ret_var.is_owned) {
20193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20194 LDKFundingSigned orig_conv;
20195 orig_conv.inner = (void*)(orig & (~1));
20196 orig_conv.is_owned = false;
20197 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
20198 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20199 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20200 uint64_t ret_ref = (uint64_t)ret_var.inner;
20201 if (ret_var.is_owned) {
20207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20208 LDKFundingLocked this_obj_conv;
20209 this_obj_conv.inner = (void*)(this_obj & (~1));
20210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20211 FundingLocked_free(this_obj_conv);
20214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20215 LDKFundingLocked this_ptr_conv;
20216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20217 this_ptr_conv.is_owned = false;
20218 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20219 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
20223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20224 LDKFundingLocked this_ptr_conv;
20225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20226 this_ptr_conv.is_owned = false;
20227 LDKThirtyTwoBytes val_ref;
20228 CHECK((*env)->GetArrayLength(env, val) == 32);
20229 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20230 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
20233 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20234 LDKFundingLocked this_ptr_conv;
20235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20236 this_ptr_conv.is_owned = false;
20237 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20238 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
20242 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) {
20243 LDKFundingLocked this_ptr_conv;
20244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20245 this_ptr_conv.is_owned = false;
20246 LDKPublicKey val_ref;
20247 CHECK((*env)->GetArrayLength(env, val) == 33);
20248 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20249 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
20252 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) {
20253 LDKThirtyTwoBytes channel_id_arg_ref;
20254 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20255 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20256 LDKPublicKey next_per_commitment_point_arg_ref;
20257 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
20258 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
20259 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
20260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20262 uint64_t ret_ref = (uint64_t)ret_var.inner;
20263 if (ret_var.is_owned) {
20269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20270 LDKFundingLocked orig_conv;
20271 orig_conv.inner = (void*)(orig & (~1));
20272 orig_conv.is_owned = false;
20273 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
20274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20276 uint64_t ret_ref = (uint64_t)ret_var.inner;
20277 if (ret_var.is_owned) {
20283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20284 LDKShutdown this_obj_conv;
20285 this_obj_conv.inner = (void*)(this_obj & (~1));
20286 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20287 Shutdown_free(this_obj_conv);
20290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20291 LDKShutdown this_ptr_conv;
20292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20293 this_ptr_conv.is_owned = false;
20294 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20295 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
20299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20300 LDKShutdown this_ptr_conv;
20301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20302 this_ptr_conv.is_owned = false;
20303 LDKThirtyTwoBytes val_ref;
20304 CHECK((*env)->GetArrayLength(env, val) == 32);
20305 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20306 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
20309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
20310 LDKShutdown this_ptr_conv;
20311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20312 this_ptr_conv.is_owned = false;
20313 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
20314 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20315 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20320 LDKShutdown this_ptr_conv;
20321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20322 this_ptr_conv.is_owned = false;
20323 LDKCVec_u8Z val_ref;
20324 val_ref.datalen = (*env)->GetArrayLength(env, val);
20325 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
20326 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
20327 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
20330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
20331 LDKThirtyTwoBytes channel_id_arg_ref;
20332 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20333 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20334 LDKCVec_u8Z scriptpubkey_arg_ref;
20335 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
20336 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
20337 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
20338 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
20339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20341 uint64_t ret_ref = (uint64_t)ret_var.inner;
20342 if (ret_var.is_owned) {
20348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20349 LDKShutdown orig_conv;
20350 orig_conv.inner = (void*)(orig & (~1));
20351 orig_conv.is_owned = false;
20352 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
20353 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20354 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20355 uint64_t ret_ref = (uint64_t)ret_var.inner;
20356 if (ret_var.is_owned) {
20362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20363 LDKClosingSignedFeeRange this_obj_conv;
20364 this_obj_conv.inner = (void*)(this_obj & (~1));
20365 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20366 ClosingSignedFeeRange_free(this_obj_conv);
20369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20370 LDKClosingSignedFeeRange this_ptr_conv;
20371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20372 this_ptr_conv.is_owned = false;
20373 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
20377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20378 LDKClosingSignedFeeRange this_ptr_conv;
20379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20380 this_ptr_conv.is_owned = false;
20381 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
20384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20385 LDKClosingSignedFeeRange this_ptr_conv;
20386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20387 this_ptr_conv.is_owned = false;
20388 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
20392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20393 LDKClosingSignedFeeRange this_ptr_conv;
20394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20395 this_ptr_conv.is_owned = false;
20396 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
20399 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) {
20400 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
20401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20403 uint64_t ret_ref = (uint64_t)ret_var.inner;
20404 if (ret_var.is_owned) {
20410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20411 LDKClosingSignedFeeRange orig_conv;
20412 orig_conv.inner = (void*)(orig & (~1));
20413 orig_conv.is_owned = false;
20414 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
20415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20417 uint64_t ret_ref = (uint64_t)ret_var.inner;
20418 if (ret_var.is_owned) {
20424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20425 LDKClosingSigned this_obj_conv;
20426 this_obj_conv.inner = (void*)(this_obj & (~1));
20427 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20428 ClosingSigned_free(this_obj_conv);
20431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20432 LDKClosingSigned this_ptr_conv;
20433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20434 this_ptr_conv.is_owned = false;
20435 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20436 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
20440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20441 LDKClosingSigned this_ptr_conv;
20442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20443 this_ptr_conv.is_owned = false;
20444 LDKThirtyTwoBytes val_ref;
20445 CHECK((*env)->GetArrayLength(env, val) == 32);
20446 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20447 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
20450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20451 LDKClosingSigned this_ptr_conv;
20452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20453 this_ptr_conv.is_owned = false;
20454 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
20458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20459 LDKClosingSigned this_ptr_conv;
20460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20461 this_ptr_conv.is_owned = false;
20462 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
20465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20466 LDKClosingSigned this_ptr_conv;
20467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20468 this_ptr_conv.is_owned = false;
20469 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20470 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
20474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20475 LDKClosingSigned this_ptr_conv;
20476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20477 this_ptr_conv.is_owned = false;
20478 LDKSignature val_ref;
20479 CHECK((*env)->GetArrayLength(env, val) == 64);
20480 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20481 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
20484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
20485 LDKClosingSigned this_ptr_conv;
20486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20487 this_ptr_conv.is_owned = false;
20488 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
20489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20491 uint64_t ret_ref = (uint64_t)ret_var.inner;
20492 if (ret_var.is_owned) {
20498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20499 LDKClosingSigned this_ptr_conv;
20500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20501 this_ptr_conv.is_owned = false;
20502 LDKClosingSignedFeeRange val_conv;
20503 val_conv.inner = (void*)(val & (~1));
20504 val_conv.is_owned = (val & 1) || (val == 0);
20505 val_conv = ClosingSignedFeeRange_clone(&val_conv);
20506 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
20509 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) {
20510 LDKThirtyTwoBytes channel_id_arg_ref;
20511 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20512 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20513 LDKSignature signature_arg_ref;
20514 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20515 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20516 LDKClosingSignedFeeRange fee_range_arg_conv;
20517 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
20518 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
20519 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
20520 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
20521 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20522 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20523 uint64_t ret_ref = (uint64_t)ret_var.inner;
20524 if (ret_var.is_owned) {
20530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20531 LDKClosingSigned orig_conv;
20532 orig_conv.inner = (void*)(orig & (~1));
20533 orig_conv.is_owned = false;
20534 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
20535 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20536 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20537 uint64_t ret_ref = (uint64_t)ret_var.inner;
20538 if (ret_var.is_owned) {
20544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20545 LDKUpdateAddHTLC this_obj_conv;
20546 this_obj_conv.inner = (void*)(this_obj & (~1));
20547 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20548 UpdateAddHTLC_free(this_obj_conv);
20551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20552 LDKUpdateAddHTLC this_ptr_conv;
20553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20554 this_ptr_conv.is_owned = false;
20555 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20556 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
20560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20561 LDKUpdateAddHTLC this_ptr_conv;
20562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20563 this_ptr_conv.is_owned = false;
20564 LDKThirtyTwoBytes val_ref;
20565 CHECK((*env)->GetArrayLength(env, val) == 32);
20566 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20567 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
20570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20571 LDKUpdateAddHTLC this_ptr_conv;
20572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20573 this_ptr_conv.is_owned = false;
20574 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
20578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20579 LDKUpdateAddHTLC this_ptr_conv;
20580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20581 this_ptr_conv.is_owned = false;
20582 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
20585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20586 LDKUpdateAddHTLC this_ptr_conv;
20587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20588 this_ptr_conv.is_owned = false;
20589 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
20593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20594 LDKUpdateAddHTLC this_ptr_conv;
20595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20596 this_ptr_conv.is_owned = false;
20597 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
20600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20601 LDKUpdateAddHTLC this_ptr_conv;
20602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20603 this_ptr_conv.is_owned = false;
20604 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20605 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
20609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20610 LDKUpdateAddHTLC this_ptr_conv;
20611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20612 this_ptr_conv.is_owned = false;
20613 LDKThirtyTwoBytes val_ref;
20614 CHECK((*env)->GetArrayLength(env, val) == 32);
20615 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20616 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
20619 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
20620 LDKUpdateAddHTLC this_ptr_conv;
20621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20622 this_ptr_conv.is_owned = false;
20623 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
20627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20628 LDKUpdateAddHTLC this_ptr_conv;
20629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20630 this_ptr_conv.is_owned = false;
20631 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
20634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20635 LDKUpdateAddHTLC orig_conv;
20636 orig_conv.inner = (void*)(orig & (~1));
20637 orig_conv.is_owned = false;
20638 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
20639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20641 uint64_t ret_ref = (uint64_t)ret_var.inner;
20642 if (ret_var.is_owned) {
20648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20649 LDKUpdateFulfillHTLC this_obj_conv;
20650 this_obj_conv.inner = (void*)(this_obj & (~1));
20651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20652 UpdateFulfillHTLC_free(this_obj_conv);
20655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20656 LDKUpdateFulfillHTLC this_ptr_conv;
20657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20658 this_ptr_conv.is_owned = false;
20659 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20660 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
20664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20665 LDKUpdateFulfillHTLC this_ptr_conv;
20666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20667 this_ptr_conv.is_owned = false;
20668 LDKThirtyTwoBytes val_ref;
20669 CHECK((*env)->GetArrayLength(env, val) == 32);
20670 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20671 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
20674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20675 LDKUpdateFulfillHTLC this_ptr_conv;
20676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20677 this_ptr_conv.is_owned = false;
20678 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
20682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20683 LDKUpdateFulfillHTLC this_ptr_conv;
20684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20685 this_ptr_conv.is_owned = false;
20686 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
20689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
20690 LDKUpdateFulfillHTLC this_ptr_conv;
20691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20692 this_ptr_conv.is_owned = false;
20693 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20694 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
20698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20699 LDKUpdateFulfillHTLC this_ptr_conv;
20700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20701 this_ptr_conv.is_owned = false;
20702 LDKThirtyTwoBytes val_ref;
20703 CHECK((*env)->GetArrayLength(env, val) == 32);
20704 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20705 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
20708 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) {
20709 LDKThirtyTwoBytes channel_id_arg_ref;
20710 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20711 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20712 LDKThirtyTwoBytes payment_preimage_arg_ref;
20713 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
20714 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
20715 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
20716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20718 uint64_t ret_ref = (uint64_t)ret_var.inner;
20719 if (ret_var.is_owned) {
20725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20726 LDKUpdateFulfillHTLC orig_conv;
20727 orig_conv.inner = (void*)(orig & (~1));
20728 orig_conv.is_owned = false;
20729 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
20730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20732 uint64_t ret_ref = (uint64_t)ret_var.inner;
20733 if (ret_var.is_owned) {
20739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20740 LDKUpdateFailHTLC this_obj_conv;
20741 this_obj_conv.inner = (void*)(this_obj & (~1));
20742 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20743 UpdateFailHTLC_free(this_obj_conv);
20746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20747 LDKUpdateFailHTLC this_ptr_conv;
20748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20749 this_ptr_conv.is_owned = false;
20750 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20751 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
20755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20756 LDKUpdateFailHTLC this_ptr_conv;
20757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20758 this_ptr_conv.is_owned = false;
20759 LDKThirtyTwoBytes val_ref;
20760 CHECK((*env)->GetArrayLength(env, val) == 32);
20761 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20762 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
20765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20766 LDKUpdateFailHTLC this_ptr_conv;
20767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20768 this_ptr_conv.is_owned = false;
20769 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
20773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20774 LDKUpdateFailHTLC this_ptr_conv;
20775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20776 this_ptr_conv.is_owned = false;
20777 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
20780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20781 LDKUpdateFailHTLC orig_conv;
20782 orig_conv.inner = (void*)(orig & (~1));
20783 orig_conv.is_owned = false;
20784 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
20785 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20786 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20787 uint64_t ret_ref = (uint64_t)ret_var.inner;
20788 if (ret_var.is_owned) {
20794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20795 LDKUpdateFailMalformedHTLC this_obj_conv;
20796 this_obj_conv.inner = (void*)(this_obj & (~1));
20797 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20798 UpdateFailMalformedHTLC_free(this_obj_conv);
20801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20802 LDKUpdateFailMalformedHTLC this_ptr_conv;
20803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20804 this_ptr_conv.is_owned = false;
20805 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20806 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
20810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20811 LDKUpdateFailMalformedHTLC this_ptr_conv;
20812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20813 this_ptr_conv.is_owned = false;
20814 LDKThirtyTwoBytes val_ref;
20815 CHECK((*env)->GetArrayLength(env, val) == 32);
20816 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20817 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
20820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20821 LDKUpdateFailMalformedHTLC this_ptr_conv;
20822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20823 this_ptr_conv.is_owned = false;
20824 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
20828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20829 LDKUpdateFailMalformedHTLC this_ptr_conv;
20830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20831 this_ptr_conv.is_owned = false;
20832 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
20835 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
20836 LDKUpdateFailMalformedHTLC this_ptr_conv;
20837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20838 this_ptr_conv.is_owned = false;
20839 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
20843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20844 LDKUpdateFailMalformedHTLC this_ptr_conv;
20845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20846 this_ptr_conv.is_owned = false;
20847 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
20850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20851 LDKUpdateFailMalformedHTLC orig_conv;
20852 orig_conv.inner = (void*)(orig & (~1));
20853 orig_conv.is_owned = false;
20854 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
20855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20857 uint64_t ret_ref = (uint64_t)ret_var.inner;
20858 if (ret_var.is_owned) {
20864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20865 LDKCommitmentSigned this_obj_conv;
20866 this_obj_conv.inner = (void*)(this_obj & (~1));
20867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20868 CommitmentSigned_free(this_obj_conv);
20871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20872 LDKCommitmentSigned this_ptr_conv;
20873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20874 this_ptr_conv.is_owned = false;
20875 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
20880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20881 LDKCommitmentSigned this_ptr_conv;
20882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20883 this_ptr_conv.is_owned = false;
20884 LDKThirtyTwoBytes val_ref;
20885 CHECK((*env)->GetArrayLength(env, val) == 32);
20886 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20887 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
20890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20891 LDKCommitmentSigned this_ptr_conv;
20892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20893 this_ptr_conv.is_owned = false;
20894 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20895 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
20899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20900 LDKCommitmentSigned this_ptr_conv;
20901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20902 this_ptr_conv.is_owned = false;
20903 LDKSignature val_ref;
20904 CHECK((*env)->GetArrayLength(env, val) == 64);
20905 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20906 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
20909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
20910 LDKCommitmentSigned this_ptr_conv;
20911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20912 this_ptr_conv.is_owned = false;
20913 LDKCVec_SignatureZ val_constr;
20914 val_constr.datalen = (*env)->GetArrayLength(env, val);
20915 if (val_constr.datalen > 0)
20916 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20918 val_constr.data = NULL;
20919 for (size_t i = 0; i < val_constr.datalen; i++) {
20920 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
20921 LDKSignature val_conv_8_ref;
20922 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
20923 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
20924 val_constr.data[i] = val_conv_8_ref;
20926 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
20929 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) {
20930 LDKThirtyTwoBytes channel_id_arg_ref;
20931 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20932 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20933 LDKSignature signature_arg_ref;
20934 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20935 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20936 LDKCVec_SignatureZ htlc_signatures_arg_constr;
20937 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
20938 if (htlc_signatures_arg_constr.datalen > 0)
20939 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20941 htlc_signatures_arg_constr.data = NULL;
20942 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
20943 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
20944 LDKSignature htlc_signatures_arg_conv_8_ref;
20945 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
20946 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
20947 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
20949 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
20950 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20951 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20952 uint64_t ret_ref = (uint64_t)ret_var.inner;
20953 if (ret_var.is_owned) {
20959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20960 LDKCommitmentSigned orig_conv;
20961 orig_conv.inner = (void*)(orig & (~1));
20962 orig_conv.is_owned = false;
20963 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
20964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20966 uint64_t ret_ref = (uint64_t)ret_var.inner;
20967 if (ret_var.is_owned) {
20973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20974 LDKRevokeAndACK this_obj_conv;
20975 this_obj_conv.inner = (void*)(this_obj & (~1));
20976 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20977 RevokeAndACK_free(this_obj_conv);
20980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20981 LDKRevokeAndACK this_ptr_conv;
20982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20983 this_ptr_conv.is_owned = false;
20984 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20985 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
20989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20990 LDKRevokeAndACK this_ptr_conv;
20991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20992 this_ptr_conv.is_owned = false;
20993 LDKThirtyTwoBytes val_ref;
20994 CHECK((*env)->GetArrayLength(env, val) == 32);
20995 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20996 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
20999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
21000 LDKRevokeAndACK this_ptr_conv;
21001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21002 this_ptr_conv.is_owned = false;
21003 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21004 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
21008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21009 LDKRevokeAndACK this_ptr_conv;
21010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21011 this_ptr_conv.is_owned = false;
21012 LDKThirtyTwoBytes val_ref;
21013 CHECK((*env)->GetArrayLength(env, val) == 32);
21014 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21015 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
21018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21019 LDKRevokeAndACK this_ptr_conv;
21020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21021 this_ptr_conv.is_owned = false;
21022 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21023 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
21027 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) {
21028 LDKRevokeAndACK this_ptr_conv;
21029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21030 this_ptr_conv.is_owned = false;
21031 LDKPublicKey val_ref;
21032 CHECK((*env)->GetArrayLength(env, val) == 33);
21033 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21034 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
21037 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) {
21038 LDKThirtyTwoBytes channel_id_arg_ref;
21039 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21040 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21041 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
21042 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
21043 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
21044 LDKPublicKey next_per_commitment_point_arg_ref;
21045 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
21046 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
21047 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
21048 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21049 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21050 uint64_t ret_ref = (uint64_t)ret_var.inner;
21051 if (ret_var.is_owned) {
21057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21058 LDKRevokeAndACK orig_conv;
21059 orig_conv.inner = (void*)(orig & (~1));
21060 orig_conv.is_owned = false;
21061 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
21062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21064 uint64_t ret_ref = (uint64_t)ret_var.inner;
21065 if (ret_var.is_owned) {
21071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21072 LDKUpdateFee this_obj_conv;
21073 this_obj_conv.inner = (void*)(this_obj & (~1));
21074 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21075 UpdateFee_free(this_obj_conv);
21078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21079 LDKUpdateFee 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, 32);
21083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
21087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21088 LDKUpdateFee this_ptr_conv;
21089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21090 this_ptr_conv.is_owned = false;
21091 LDKThirtyTwoBytes val_ref;
21092 CHECK((*env)->GetArrayLength(env, val) == 32);
21093 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21094 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
21097 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
21098 LDKUpdateFee this_ptr_conv;
21099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21100 this_ptr_conv.is_owned = false;
21101 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
21105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21106 LDKUpdateFee this_ptr_conv;
21107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21108 this_ptr_conv.is_owned = false;
21109 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
21112 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) {
21113 LDKThirtyTwoBytes channel_id_arg_ref;
21114 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21115 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21116 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
21117 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21118 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21119 uint64_t ret_ref = (uint64_t)ret_var.inner;
21120 if (ret_var.is_owned) {
21126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21127 LDKUpdateFee orig_conv;
21128 orig_conv.inner = (void*)(orig & (~1));
21129 orig_conv.is_owned = false;
21130 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
21131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21133 uint64_t ret_ref = (uint64_t)ret_var.inner;
21134 if (ret_var.is_owned) {
21140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21141 LDKDataLossProtect this_obj_conv;
21142 this_obj_conv.inner = (void*)(this_obj & (~1));
21143 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21144 DataLossProtect_free(this_obj_conv);
21147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
21148 LDKDataLossProtect this_ptr_conv;
21149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21150 this_ptr_conv.is_owned = false;
21151 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21152 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
21156 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) {
21157 LDKDataLossProtect this_ptr_conv;
21158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21159 this_ptr_conv.is_owned = false;
21160 LDKThirtyTwoBytes val_ref;
21161 CHECK((*env)->GetArrayLength(env, val) == 32);
21162 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21163 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
21166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21167 LDKDataLossProtect this_ptr_conv;
21168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21169 this_ptr_conv.is_owned = false;
21170 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21171 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
21175 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) {
21176 LDKDataLossProtect this_ptr_conv;
21177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21178 this_ptr_conv.is_owned = false;
21179 LDKPublicKey val_ref;
21180 CHECK((*env)->GetArrayLength(env, val) == 33);
21181 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21182 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
21185 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) {
21186 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
21187 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
21188 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
21189 LDKPublicKey my_current_per_commitment_point_arg_ref;
21190 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
21191 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
21192 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
21193 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21194 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21195 uint64_t ret_ref = (uint64_t)ret_var.inner;
21196 if (ret_var.is_owned) {
21202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21203 LDKDataLossProtect orig_conv;
21204 orig_conv.inner = (void*)(orig & (~1));
21205 orig_conv.is_owned = false;
21206 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
21207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21209 uint64_t ret_ref = (uint64_t)ret_var.inner;
21210 if (ret_var.is_owned) {
21216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21217 LDKChannelReestablish this_obj_conv;
21218 this_obj_conv.inner = (void*)(this_obj & (~1));
21219 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21220 ChannelReestablish_free(this_obj_conv);
21223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21224 LDKChannelReestablish this_ptr_conv;
21225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21226 this_ptr_conv.is_owned = false;
21227 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21228 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
21232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21233 LDKChannelReestablish this_ptr_conv;
21234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21235 this_ptr_conv.is_owned = false;
21236 LDKThirtyTwoBytes val_ref;
21237 CHECK((*env)->GetArrayLength(env, val) == 32);
21238 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21239 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
21242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
21243 LDKChannelReestablish this_ptr_conv;
21244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21245 this_ptr_conv.is_owned = false;
21246 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
21250 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) {
21251 LDKChannelReestablish this_ptr_conv;
21252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21253 this_ptr_conv.is_owned = false;
21254 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
21257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
21258 LDKChannelReestablish this_ptr_conv;
21259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21260 this_ptr_conv.is_owned = false;
21261 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
21265 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) {
21266 LDKChannelReestablish this_ptr_conv;
21267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21268 this_ptr_conv.is_owned = false;
21269 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
21272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21273 LDKChannelReestablish orig_conv;
21274 orig_conv.inner = (void*)(orig & (~1));
21275 orig_conv.is_owned = false;
21276 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
21277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21279 uint64_t ret_ref = (uint64_t)ret_var.inner;
21280 if (ret_var.is_owned) {
21286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21287 LDKAnnouncementSignatures this_obj_conv;
21288 this_obj_conv.inner = (void*)(this_obj & (~1));
21289 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21290 AnnouncementSignatures_free(this_obj_conv);
21293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21294 LDKAnnouncementSignatures this_ptr_conv;
21295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21296 this_ptr_conv.is_owned = false;
21297 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21298 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
21302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21303 LDKAnnouncementSignatures this_ptr_conv;
21304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21305 this_ptr_conv.is_owned = false;
21306 LDKThirtyTwoBytes val_ref;
21307 CHECK((*env)->GetArrayLength(env, val) == 32);
21308 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21309 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
21312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21313 LDKAnnouncementSignatures this_ptr_conv;
21314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21315 this_ptr_conv.is_owned = false;
21316 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
21320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21321 LDKAnnouncementSignatures this_ptr_conv;
21322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21323 this_ptr_conv.is_owned = false;
21324 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
21327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21328 LDKAnnouncementSignatures this_ptr_conv;
21329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21330 this_ptr_conv.is_owned = false;
21331 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21332 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
21336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21337 LDKAnnouncementSignatures this_ptr_conv;
21338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21339 this_ptr_conv.is_owned = false;
21340 LDKSignature val_ref;
21341 CHECK((*env)->GetArrayLength(env, val) == 64);
21342 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21343 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
21346 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21347 LDKAnnouncementSignatures this_ptr_conv;
21348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21349 this_ptr_conv.is_owned = false;
21350 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21351 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
21355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21356 LDKAnnouncementSignatures this_ptr_conv;
21357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21358 this_ptr_conv.is_owned = false;
21359 LDKSignature val_ref;
21360 CHECK((*env)->GetArrayLength(env, val) == 64);
21361 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21362 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
21365 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) {
21366 LDKThirtyTwoBytes channel_id_arg_ref;
21367 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21368 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21369 LDKSignature node_signature_arg_ref;
21370 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
21371 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
21372 LDKSignature bitcoin_signature_arg_ref;
21373 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
21374 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
21375 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
21376 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21377 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21378 uint64_t ret_ref = (uint64_t)ret_var.inner;
21379 if (ret_var.is_owned) {
21385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21386 LDKAnnouncementSignatures orig_conv;
21387 orig_conv.inner = (void*)(orig & (~1));
21388 orig_conv.is_owned = false;
21389 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
21390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21392 uint64_t ret_ref = (uint64_t)ret_var.inner;
21393 if (ret_var.is_owned) {
21399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21400 if ((this_ptr & 1) != 0) return;
21401 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
21402 FREE((void*)this_ptr);
21403 NetAddress_free(this_ptr_conv);
21406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21407 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
21408 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21409 *ret_copy = NetAddress_clone(orig_conv);
21410 uint64_t ret_ref = (uint64_t)ret_copy;
21414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21415 LDKFourBytes addr_ref;
21416 CHECK((*env)->GetArrayLength(env, addr) == 4);
21417 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
21418 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21419 *ret_copy = NetAddress_ipv4(addr_ref, port);
21420 uint64_t ret_ref = (uint64_t)ret_copy;
21424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21425 LDKSixteenBytes addr_ref;
21426 CHECK((*env)->GetArrayLength(env, addr) == 16);
21427 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
21428 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21429 *ret_copy = NetAddress_ipv6(addr_ref, port);
21430 uint64_t ret_ref = (uint64_t)ret_copy;
21434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21435 LDKTenBytes addr_ref;
21436 CHECK((*env)->GetArrayLength(env, addr) == 10);
21437 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
21438 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21439 *ret_copy = NetAddress_onion_v2(addr_ref, port);
21440 uint64_t ret_ref = (uint64_t)ret_copy;
21444 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) {
21445 LDKThirtyTwoBytes ed25519_pubkey_ref;
21446 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
21447 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
21448 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21449 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
21450 uint64_t ret_ref = (uint64_t)ret_copy;
21454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
21455 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
21456 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
21457 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21458 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21459 CVec_u8Z_free(ret_var);
21463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21464 LDKu8slice ser_ref;
21465 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21466 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21467 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
21468 *ret_conv = Result_read(ser_ref);
21469 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21470 return (uint64_t)ret_conv;
21473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21474 LDKu8slice ser_ref;
21475 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21476 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21477 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21478 *ret_conv = NetAddress_read(ser_ref);
21479 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21480 return (uint64_t)ret_conv;
21483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21484 LDKUnsignedNodeAnnouncement this_obj_conv;
21485 this_obj_conv.inner = (void*)(this_obj & (~1));
21486 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21487 UnsignedNodeAnnouncement_free(this_obj_conv);
21490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
21491 LDKUnsignedNodeAnnouncement this_ptr_conv;
21492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21493 this_ptr_conv.is_owned = false;
21494 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
21495 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21496 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21497 uint64_t ret_ref = (uint64_t)ret_var.inner;
21498 if (ret_var.is_owned) {
21504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21505 LDKUnsignedNodeAnnouncement this_ptr_conv;
21506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21507 this_ptr_conv.is_owned = false;
21508 LDKNodeFeatures val_conv;
21509 val_conv.inner = (void*)(val & (~1));
21510 val_conv.is_owned = (val & 1) || (val == 0);
21511 val_conv = NodeFeatures_clone(&val_conv);
21512 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
21515 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
21516 LDKUnsignedNodeAnnouncement this_ptr_conv;
21517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21518 this_ptr_conv.is_owned = false;
21519 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
21523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21524 LDKUnsignedNodeAnnouncement this_ptr_conv;
21525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21526 this_ptr_conv.is_owned = false;
21527 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
21530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21531 LDKUnsignedNodeAnnouncement this_ptr_conv;
21532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21533 this_ptr_conv.is_owned = false;
21534 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21535 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
21539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21540 LDKUnsignedNodeAnnouncement this_ptr_conv;
21541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21542 this_ptr_conv.is_owned = false;
21543 LDKPublicKey val_ref;
21544 CHECK((*env)->GetArrayLength(env, val) == 33);
21545 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21546 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
21549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
21550 LDKUnsignedNodeAnnouncement this_ptr_conv;
21551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21552 this_ptr_conv.is_owned = false;
21553 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
21554 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
21558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21559 LDKUnsignedNodeAnnouncement this_ptr_conv;
21560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21561 this_ptr_conv.is_owned = false;
21562 LDKThreeBytes val_ref;
21563 CHECK((*env)->GetArrayLength(env, val) == 3);
21564 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
21565 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
21568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
21569 LDKUnsignedNodeAnnouncement this_ptr_conv;
21570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21571 this_ptr_conv.is_owned = false;
21572 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21573 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
21577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21578 LDKUnsignedNodeAnnouncement this_ptr_conv;
21579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21580 this_ptr_conv.is_owned = false;
21581 LDKThirtyTwoBytes val_ref;
21582 CHECK((*env)->GetArrayLength(env, val) == 32);
21583 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21584 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
21587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21588 LDKUnsignedNodeAnnouncement this_ptr_conv;
21589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21590 this_ptr_conv.is_owned = false;
21591 LDKCVec_NetAddressZ val_constr;
21592 val_constr.datalen = (*env)->GetArrayLength(env, val);
21593 if (val_constr.datalen > 0)
21594 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21596 val_constr.data = NULL;
21597 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21598 for (size_t m = 0; m < val_constr.datalen; m++) {
21599 int64_t val_conv_12 = val_vals[m];
21600 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
21601 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
21602 val_constr.data[m] = val_conv_12_conv;
21604 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21605 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
21608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21609 LDKUnsignedNodeAnnouncement orig_conv;
21610 orig_conv.inner = (void*)(orig & (~1));
21611 orig_conv.is_owned = false;
21612 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
21613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21615 uint64_t ret_ref = (uint64_t)ret_var.inner;
21616 if (ret_var.is_owned) {
21622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21623 LDKNodeAnnouncement this_obj_conv;
21624 this_obj_conv.inner = (void*)(this_obj & (~1));
21625 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21626 NodeAnnouncement_free(this_obj_conv);
21629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21630 LDKNodeAnnouncement this_ptr_conv;
21631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21632 this_ptr_conv.is_owned = false;
21633 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21634 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
21638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21639 LDKNodeAnnouncement this_ptr_conv;
21640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21641 this_ptr_conv.is_owned = false;
21642 LDKSignature val_ref;
21643 CHECK((*env)->GetArrayLength(env, val) == 64);
21644 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21645 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
21648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
21649 LDKNodeAnnouncement this_ptr_conv;
21650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21651 this_ptr_conv.is_owned = false;
21652 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
21653 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21654 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21655 uint64_t ret_ref = (uint64_t)ret_var.inner;
21656 if (ret_var.is_owned) {
21662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21663 LDKNodeAnnouncement this_ptr_conv;
21664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21665 this_ptr_conv.is_owned = false;
21666 LDKUnsignedNodeAnnouncement val_conv;
21667 val_conv.inner = (void*)(val & (~1));
21668 val_conv.is_owned = (val & 1) || (val == 0);
21669 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
21670 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
21673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
21674 LDKSignature signature_arg_ref;
21675 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21676 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21677 LDKUnsignedNodeAnnouncement contents_arg_conv;
21678 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21679 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21680 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
21681 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
21682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21684 uint64_t ret_ref = (uint64_t)ret_var.inner;
21685 if (ret_var.is_owned) {
21691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21692 LDKNodeAnnouncement orig_conv;
21693 orig_conv.inner = (void*)(orig & (~1));
21694 orig_conv.is_owned = false;
21695 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
21696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21698 uint64_t ret_ref = (uint64_t)ret_var.inner;
21699 if (ret_var.is_owned) {
21705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21706 LDKUnsignedChannelAnnouncement this_obj_conv;
21707 this_obj_conv.inner = (void*)(this_obj & (~1));
21708 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21709 UnsignedChannelAnnouncement_free(this_obj_conv);
21712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
21713 LDKUnsignedChannelAnnouncement this_ptr_conv;
21714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21715 this_ptr_conv.is_owned = false;
21716 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
21717 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21718 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21719 uint64_t ret_ref = (uint64_t)ret_var.inner;
21720 if (ret_var.is_owned) {
21726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21727 LDKUnsignedChannelAnnouncement this_ptr_conv;
21728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21729 this_ptr_conv.is_owned = false;
21730 LDKChannelFeatures val_conv;
21731 val_conv.inner = (void*)(val & (~1));
21732 val_conv.is_owned = (val & 1) || (val == 0);
21733 val_conv = ChannelFeatures_clone(&val_conv);
21734 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
21737 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21738 LDKUnsignedChannelAnnouncement 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, 32);
21742 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
21746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21747 LDKUnsignedChannelAnnouncement this_ptr_conv;
21748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21749 this_ptr_conv.is_owned = false;
21750 LDKThirtyTwoBytes val_ref;
21751 CHECK((*env)->GetArrayLength(env, val) == 32);
21752 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21753 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
21756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21757 LDKUnsignedChannelAnnouncement this_ptr_conv;
21758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21759 this_ptr_conv.is_owned = false;
21760 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
21764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21765 LDKUnsignedChannelAnnouncement this_ptr_conv;
21766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21767 this_ptr_conv.is_owned = false;
21768 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
21771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21772 LDKUnsignedChannelAnnouncement this_ptr_conv;
21773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21774 this_ptr_conv.is_owned = false;
21775 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21776 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
21780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21781 LDKUnsignedChannelAnnouncement this_ptr_conv;
21782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21783 this_ptr_conv.is_owned = false;
21784 LDKPublicKey val_ref;
21785 CHECK((*env)->GetArrayLength(env, val) == 33);
21786 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21787 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
21790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21791 LDKUnsignedChannelAnnouncement this_ptr_conv;
21792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21793 this_ptr_conv.is_owned = false;
21794 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21795 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
21799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21800 LDKUnsignedChannelAnnouncement this_ptr_conv;
21801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21802 this_ptr_conv.is_owned = false;
21803 LDKPublicKey val_ref;
21804 CHECK((*env)->GetArrayLength(env, val) == 33);
21805 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21806 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
21809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21810 LDKUnsignedChannelAnnouncement this_ptr_conv;
21811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21812 this_ptr_conv.is_owned = false;
21813 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21814 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
21818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21819 LDKUnsignedChannelAnnouncement this_ptr_conv;
21820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21821 this_ptr_conv.is_owned = false;
21822 LDKPublicKey val_ref;
21823 CHECK((*env)->GetArrayLength(env, val) == 33);
21824 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21825 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
21828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21829 LDKUnsignedChannelAnnouncement this_ptr_conv;
21830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21831 this_ptr_conv.is_owned = false;
21832 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21833 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
21837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21838 LDKUnsignedChannelAnnouncement this_ptr_conv;
21839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21840 this_ptr_conv.is_owned = false;
21841 LDKPublicKey val_ref;
21842 CHECK((*env)->GetArrayLength(env, val) == 33);
21843 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21844 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
21847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21848 LDKUnsignedChannelAnnouncement orig_conv;
21849 orig_conv.inner = (void*)(orig & (~1));
21850 orig_conv.is_owned = false;
21851 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
21852 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21853 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21854 uint64_t ret_ref = (uint64_t)ret_var.inner;
21855 if (ret_var.is_owned) {
21861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21862 LDKChannelAnnouncement this_obj_conv;
21863 this_obj_conv.inner = (void*)(this_obj & (~1));
21864 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21865 ChannelAnnouncement_free(this_obj_conv);
21868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21869 LDKChannelAnnouncement this_ptr_conv;
21870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21871 this_ptr_conv.is_owned = false;
21872 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21873 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
21877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21878 LDKChannelAnnouncement this_ptr_conv;
21879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21880 this_ptr_conv.is_owned = false;
21881 LDKSignature val_ref;
21882 CHECK((*env)->GetArrayLength(env, val) == 64);
21883 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21884 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
21887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21888 LDKChannelAnnouncement this_ptr_conv;
21889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21890 this_ptr_conv.is_owned = false;
21891 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21892 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
21896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21897 LDKChannelAnnouncement this_ptr_conv;
21898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21899 this_ptr_conv.is_owned = false;
21900 LDKSignature val_ref;
21901 CHECK((*env)->GetArrayLength(env, val) == 64);
21902 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21903 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
21906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21907 LDKChannelAnnouncement this_ptr_conv;
21908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21909 this_ptr_conv.is_owned = false;
21910 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21911 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
21915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21916 LDKChannelAnnouncement this_ptr_conv;
21917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21918 this_ptr_conv.is_owned = false;
21919 LDKSignature val_ref;
21920 CHECK((*env)->GetArrayLength(env, val) == 64);
21921 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21922 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
21925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21926 LDKChannelAnnouncement 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, 64);
21930 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
21934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21935 LDKChannelAnnouncement this_ptr_conv;
21936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21937 this_ptr_conv.is_owned = false;
21938 LDKSignature val_ref;
21939 CHECK((*env)->GetArrayLength(env, val) == 64);
21940 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21941 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
21944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
21945 LDKChannelAnnouncement this_ptr_conv;
21946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21947 this_ptr_conv.is_owned = false;
21948 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
21949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21951 uint64_t ret_ref = (uint64_t)ret_var.inner;
21952 if (ret_var.is_owned) {
21958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21959 LDKChannelAnnouncement this_ptr_conv;
21960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21961 this_ptr_conv.is_owned = false;
21962 LDKUnsignedChannelAnnouncement val_conv;
21963 val_conv.inner = (void*)(val & (~1));
21964 val_conv.is_owned = (val & 1) || (val == 0);
21965 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
21966 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
21969 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) {
21970 LDKSignature node_signature_1_arg_ref;
21971 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
21972 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
21973 LDKSignature node_signature_2_arg_ref;
21974 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
21975 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
21976 LDKSignature bitcoin_signature_1_arg_ref;
21977 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
21978 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
21979 LDKSignature bitcoin_signature_2_arg_ref;
21980 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
21981 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
21982 LDKUnsignedChannelAnnouncement contents_arg_conv;
21983 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21984 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21985 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
21986 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);
21987 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21988 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21989 uint64_t ret_ref = (uint64_t)ret_var.inner;
21990 if (ret_var.is_owned) {
21996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21997 LDKChannelAnnouncement orig_conv;
21998 orig_conv.inner = (void*)(orig & (~1));
21999 orig_conv.is_owned = false;
22000 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
22001 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22002 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22003 uint64_t ret_ref = (uint64_t)ret_var.inner;
22004 if (ret_var.is_owned) {
22010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22011 LDKUnsignedChannelUpdate this_obj_conv;
22012 this_obj_conv.inner = (void*)(this_obj & (~1));
22013 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22014 UnsignedChannelUpdate_free(this_obj_conv);
22017 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22018 LDKUnsignedChannelUpdate this_ptr_conv;
22019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22020 this_ptr_conv.is_owned = false;
22021 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22022 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
22026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22027 LDKUnsignedChannelUpdate this_ptr_conv;
22028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22029 this_ptr_conv.is_owned = false;
22030 LDKThirtyTwoBytes val_ref;
22031 CHECK((*env)->GetArrayLength(env, val) == 32);
22032 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22033 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
22036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22037 LDKUnsignedChannelUpdate this_ptr_conv;
22038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22039 this_ptr_conv.is_owned = false;
22040 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
22044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22045 LDKUnsignedChannelUpdate this_ptr_conv;
22046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22047 this_ptr_conv.is_owned = false;
22048 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
22051 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22052 LDKUnsignedChannelUpdate this_ptr_conv;
22053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22054 this_ptr_conv.is_owned = false;
22055 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
22059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22060 LDKUnsignedChannelUpdate this_ptr_conv;
22061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22062 this_ptr_conv.is_owned = false;
22063 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
22066 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
22067 LDKUnsignedChannelUpdate this_ptr_conv;
22068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22069 this_ptr_conv.is_owned = false;
22070 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
22074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
22075 LDKUnsignedChannelUpdate this_ptr_conv;
22076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22077 this_ptr_conv.is_owned = false;
22078 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
22081 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22082 LDKUnsignedChannelUpdate this_ptr_conv;
22083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22084 this_ptr_conv.is_owned = false;
22085 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
22089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22090 LDKUnsignedChannelUpdate this_ptr_conv;
22091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22092 this_ptr_conv.is_owned = false;
22093 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
22096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22097 LDKUnsignedChannelUpdate this_ptr_conv;
22098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22099 this_ptr_conv.is_owned = false;
22100 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
22104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22105 LDKUnsignedChannelUpdate this_ptr_conv;
22106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22107 this_ptr_conv.is_owned = false;
22108 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
22111 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22112 LDKUnsignedChannelUpdate this_ptr_conv;
22113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22114 this_ptr_conv.is_owned = false;
22115 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
22119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22120 LDKUnsignedChannelUpdate this_ptr_conv;
22121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22122 this_ptr_conv.is_owned = false;
22123 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
22126 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
22127 LDKUnsignedChannelUpdate this_ptr_conv;
22128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22129 this_ptr_conv.is_owned = false;
22130 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
22134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22135 LDKUnsignedChannelUpdate this_ptr_conv;
22136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22137 this_ptr_conv.is_owned = false;
22138 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
22141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22142 LDKUnsignedChannelUpdate orig_conv;
22143 orig_conv.inner = (void*)(orig & (~1));
22144 orig_conv.is_owned = false;
22145 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
22146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22148 uint64_t ret_ref = (uint64_t)ret_var.inner;
22149 if (ret_var.is_owned) {
22155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22156 LDKChannelUpdate this_obj_conv;
22157 this_obj_conv.inner = (void*)(this_obj & (~1));
22158 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22159 ChannelUpdate_free(this_obj_conv);
22162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22163 LDKChannelUpdate this_ptr_conv;
22164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22165 this_ptr_conv.is_owned = false;
22166 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22167 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
22171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22172 LDKChannelUpdate this_ptr_conv;
22173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22174 this_ptr_conv.is_owned = false;
22175 LDKSignature val_ref;
22176 CHECK((*env)->GetArrayLength(env, val) == 64);
22177 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22178 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
22181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
22182 LDKChannelUpdate this_ptr_conv;
22183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22184 this_ptr_conv.is_owned = false;
22185 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
22186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22188 uint64_t ret_ref = (uint64_t)ret_var.inner;
22189 if (ret_var.is_owned) {
22195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22196 LDKChannelUpdate this_ptr_conv;
22197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22198 this_ptr_conv.is_owned = false;
22199 LDKUnsignedChannelUpdate val_conv;
22200 val_conv.inner = (void*)(val & (~1));
22201 val_conv.is_owned = (val & 1) || (val == 0);
22202 val_conv = UnsignedChannelUpdate_clone(&val_conv);
22203 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
22206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
22207 LDKSignature signature_arg_ref;
22208 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
22209 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
22210 LDKUnsignedChannelUpdate contents_arg_conv;
22211 contents_arg_conv.inner = (void*)(contents_arg & (~1));
22212 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
22213 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
22214 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
22215 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22216 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22217 uint64_t ret_ref = (uint64_t)ret_var.inner;
22218 if (ret_var.is_owned) {
22224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22225 LDKChannelUpdate orig_conv;
22226 orig_conv.inner = (void*)(orig & (~1));
22227 orig_conv.is_owned = false;
22228 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
22229 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22230 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22231 uint64_t ret_ref = (uint64_t)ret_var.inner;
22232 if (ret_var.is_owned) {
22238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22239 LDKQueryChannelRange this_obj_conv;
22240 this_obj_conv.inner = (void*)(this_obj & (~1));
22241 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22242 QueryChannelRange_free(this_obj_conv);
22245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22246 LDKQueryChannelRange this_ptr_conv;
22247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22248 this_ptr_conv.is_owned = false;
22249 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22250 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
22254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22255 LDKQueryChannelRange this_ptr_conv;
22256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22257 this_ptr_conv.is_owned = false;
22258 LDKThirtyTwoBytes val_ref;
22259 CHECK((*env)->GetArrayLength(env, val) == 32);
22260 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22261 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
22264 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
22265 LDKQueryChannelRange this_ptr_conv;
22266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22267 this_ptr_conv.is_owned = false;
22268 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
22272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22273 LDKQueryChannelRange this_ptr_conv;
22274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22275 this_ptr_conv.is_owned = false;
22276 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
22279 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
22280 LDKQueryChannelRange this_ptr_conv;
22281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22282 this_ptr_conv.is_owned = false;
22283 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
22287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22288 LDKQueryChannelRange this_ptr_conv;
22289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22290 this_ptr_conv.is_owned = false;
22291 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
22294 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) {
22295 LDKThirtyTwoBytes chain_hash_arg_ref;
22296 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22297 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22298 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
22299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22301 uint64_t ret_ref = (uint64_t)ret_var.inner;
22302 if (ret_var.is_owned) {
22308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22309 LDKQueryChannelRange orig_conv;
22310 orig_conv.inner = (void*)(orig & (~1));
22311 orig_conv.is_owned = false;
22312 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
22313 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22314 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22315 uint64_t ret_ref = (uint64_t)ret_var.inner;
22316 if (ret_var.is_owned) {
22322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22323 LDKReplyChannelRange this_obj_conv;
22324 this_obj_conv.inner = (void*)(this_obj & (~1));
22325 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22326 ReplyChannelRange_free(this_obj_conv);
22329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22330 LDKReplyChannelRange this_ptr_conv;
22331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22332 this_ptr_conv.is_owned = false;
22333 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22334 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
22338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22339 LDKReplyChannelRange this_ptr_conv;
22340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22341 this_ptr_conv.is_owned = false;
22342 LDKThirtyTwoBytes val_ref;
22343 CHECK((*env)->GetArrayLength(env, val) == 32);
22344 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22345 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
22348 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
22349 LDKReplyChannelRange this_ptr_conv;
22350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22351 this_ptr_conv.is_owned = false;
22352 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
22356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22357 LDKReplyChannelRange this_ptr_conv;
22358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22359 this_ptr_conv.is_owned = false;
22360 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
22363 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
22364 LDKReplyChannelRange this_ptr_conv;
22365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22366 this_ptr_conv.is_owned = false;
22367 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
22371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22372 LDKReplyChannelRange this_ptr_conv;
22373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22374 this_ptr_conv.is_owned = false;
22375 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
22378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
22379 LDKReplyChannelRange this_ptr_conv;
22380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22381 this_ptr_conv.is_owned = false;
22382 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
22386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22387 LDKReplyChannelRange this_ptr_conv;
22388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22389 this_ptr_conv.is_owned = false;
22390 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
22393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22394 LDKReplyChannelRange this_ptr_conv;
22395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22396 this_ptr_conv.is_owned = false;
22397 LDKCVec_u64Z val_constr;
22398 val_constr.datalen = (*env)->GetArrayLength(env, val);
22399 if (val_constr.datalen > 0)
22400 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22402 val_constr.data = NULL;
22403 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22404 for (size_t g = 0; g < val_constr.datalen; g++) {
22405 int64_t val_conv_6 = val_vals[g];
22406 val_constr.data[g] = val_conv_6;
22408 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22409 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
22412 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) {
22413 LDKThirtyTwoBytes chain_hash_arg_ref;
22414 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22415 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22416 LDKCVec_u64Z short_channel_ids_arg_constr;
22417 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
22418 if (short_channel_ids_arg_constr.datalen > 0)
22419 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22421 short_channel_ids_arg_constr.data = NULL;
22422 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
22423 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
22424 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
22425 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
22427 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
22428 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
22429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22431 uint64_t ret_ref = (uint64_t)ret_var.inner;
22432 if (ret_var.is_owned) {
22438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22439 LDKReplyChannelRange orig_conv;
22440 orig_conv.inner = (void*)(orig & (~1));
22441 orig_conv.is_owned = false;
22442 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
22443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22445 uint64_t ret_ref = (uint64_t)ret_var.inner;
22446 if (ret_var.is_owned) {
22452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22453 LDKQueryShortChannelIds this_obj_conv;
22454 this_obj_conv.inner = (void*)(this_obj & (~1));
22455 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22456 QueryShortChannelIds_free(this_obj_conv);
22459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22460 LDKQueryShortChannelIds this_ptr_conv;
22461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22462 this_ptr_conv.is_owned = false;
22463 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22464 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
22468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22469 LDKQueryShortChannelIds this_ptr_conv;
22470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22471 this_ptr_conv.is_owned = false;
22472 LDKThirtyTwoBytes val_ref;
22473 CHECK((*env)->GetArrayLength(env, val) == 32);
22474 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22475 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
22478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22479 LDKQueryShortChannelIds this_ptr_conv;
22480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22481 this_ptr_conv.is_owned = false;
22482 LDKCVec_u64Z val_constr;
22483 val_constr.datalen = (*env)->GetArrayLength(env, val);
22484 if (val_constr.datalen > 0)
22485 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22487 val_constr.data = NULL;
22488 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22489 for (size_t g = 0; g < val_constr.datalen; g++) {
22490 int64_t val_conv_6 = val_vals[g];
22491 val_constr.data[g] = val_conv_6;
22493 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22494 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
22497 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) {
22498 LDKThirtyTwoBytes chain_hash_arg_ref;
22499 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22500 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22501 LDKCVec_u64Z short_channel_ids_arg_constr;
22502 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
22503 if (short_channel_ids_arg_constr.datalen > 0)
22504 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22506 short_channel_ids_arg_constr.data = NULL;
22507 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
22508 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
22509 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
22510 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
22512 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
22513 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
22514 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22515 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22516 uint64_t ret_ref = (uint64_t)ret_var.inner;
22517 if (ret_var.is_owned) {
22523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22524 LDKQueryShortChannelIds orig_conv;
22525 orig_conv.inner = (void*)(orig & (~1));
22526 orig_conv.is_owned = false;
22527 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
22528 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22529 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22530 uint64_t ret_ref = (uint64_t)ret_var.inner;
22531 if (ret_var.is_owned) {
22537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22538 LDKReplyShortChannelIdsEnd this_obj_conv;
22539 this_obj_conv.inner = (void*)(this_obj & (~1));
22540 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22541 ReplyShortChannelIdsEnd_free(this_obj_conv);
22544 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22545 LDKReplyShortChannelIdsEnd this_ptr_conv;
22546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22547 this_ptr_conv.is_owned = false;
22548 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22549 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
22553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22554 LDKReplyShortChannelIdsEnd this_ptr_conv;
22555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22556 this_ptr_conv.is_owned = false;
22557 LDKThirtyTwoBytes val_ref;
22558 CHECK((*env)->GetArrayLength(env, val) == 32);
22559 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22560 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
22563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
22564 LDKReplyShortChannelIdsEnd this_ptr_conv;
22565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22566 this_ptr_conv.is_owned = false;
22567 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
22571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22572 LDKReplyShortChannelIdsEnd this_ptr_conv;
22573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22574 this_ptr_conv.is_owned = false;
22575 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
22578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
22579 LDKThirtyTwoBytes chain_hash_arg_ref;
22580 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22581 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22582 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
22583 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22584 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22585 uint64_t ret_ref = (uint64_t)ret_var.inner;
22586 if (ret_var.is_owned) {
22592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22593 LDKReplyShortChannelIdsEnd orig_conv;
22594 orig_conv.inner = (void*)(orig & (~1));
22595 orig_conv.is_owned = false;
22596 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
22597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22599 uint64_t ret_ref = (uint64_t)ret_var.inner;
22600 if (ret_var.is_owned) {
22606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22607 LDKGossipTimestampFilter this_obj_conv;
22608 this_obj_conv.inner = (void*)(this_obj & (~1));
22609 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22610 GossipTimestampFilter_free(this_obj_conv);
22613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22614 LDKGossipTimestampFilter this_ptr_conv;
22615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22616 this_ptr_conv.is_owned = false;
22617 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22618 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
22622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22623 LDKGossipTimestampFilter this_ptr_conv;
22624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22625 this_ptr_conv.is_owned = false;
22626 LDKThirtyTwoBytes val_ref;
22627 CHECK((*env)->GetArrayLength(env, val) == 32);
22628 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22629 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
22632 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22633 LDKGossipTimestampFilter this_ptr_conv;
22634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22635 this_ptr_conv.is_owned = false;
22636 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
22640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22641 LDKGossipTimestampFilter this_ptr_conv;
22642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22643 this_ptr_conv.is_owned = false;
22644 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
22647 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
22648 LDKGossipTimestampFilter this_ptr_conv;
22649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22650 this_ptr_conv.is_owned = false;
22651 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
22655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22656 LDKGossipTimestampFilter this_ptr_conv;
22657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22658 this_ptr_conv.is_owned = false;
22659 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
22662 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) {
22663 LDKThirtyTwoBytes chain_hash_arg_ref;
22664 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22665 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22666 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
22667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22669 uint64_t ret_ref = (uint64_t)ret_var.inner;
22670 if (ret_var.is_owned) {
22676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22677 LDKGossipTimestampFilter orig_conv;
22678 orig_conv.inner = (void*)(orig & (~1));
22679 orig_conv.is_owned = false;
22680 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
22681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22683 uint64_t ret_ref = (uint64_t)ret_var.inner;
22684 if (ret_var.is_owned) {
22690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22691 if ((this_ptr & 1) != 0) return;
22692 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
22693 FREE((void*)this_ptr);
22694 ErrorAction_free(this_ptr_conv);
22697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22698 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
22699 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22700 *ret_copy = ErrorAction_clone(orig_conv);
22701 uint64_t ret_ref = (uint64_t)ret_copy;
22705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
22706 LDKErrorMessage msg_conv;
22707 msg_conv.inner = (void*)(msg & (~1));
22708 msg_conv.is_owned = (msg & 1) || (msg == 0);
22709 msg_conv = ErrorMessage_clone(&msg_conv);
22710 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22711 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
22712 uint64_t ret_ref = (uint64_t)ret_copy;
22716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
22717 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22718 *ret_copy = ErrorAction_ignore_error();
22719 uint64_t ret_ref = (uint64_t)ret_copy;
22723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
22724 LDKLevel a_conv = LDKLevel_from_java(env, a);
22725 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22726 *ret_copy = ErrorAction_ignore_and_log(a_conv);
22727 uint64_t ret_ref = (uint64_t)ret_copy;
22731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
22732 LDKErrorMessage msg_conv;
22733 msg_conv.inner = (void*)(msg & (~1));
22734 msg_conv.is_owned = (msg & 1) || (msg == 0);
22735 msg_conv = ErrorMessage_clone(&msg_conv);
22736 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22737 *ret_copy = ErrorAction_send_error_message(msg_conv);
22738 uint64_t ret_ref = (uint64_t)ret_copy;
22742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22743 LDKLightningError this_obj_conv;
22744 this_obj_conv.inner = (void*)(this_obj & (~1));
22745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22746 LightningError_free(this_obj_conv);
22749 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
22750 LDKLightningError this_ptr_conv;
22751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22752 this_ptr_conv.is_owned = false;
22753 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
22754 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
22759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
22760 LDKLightningError this_ptr_conv;
22761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22762 this_ptr_conv.is_owned = false;
22763 LDKStr val_conv = java_to_owned_str(env, val);
22764 LightningError_set_err(&this_ptr_conv, val_conv);
22767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
22768 LDKLightningError this_ptr_conv;
22769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22770 this_ptr_conv.is_owned = false;
22771 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22772 *ret_copy = LightningError_get_action(&this_ptr_conv);
22773 uint64_t ret_ref = (uint64_t)ret_copy;
22777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22778 LDKLightningError this_ptr_conv;
22779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22780 this_ptr_conv.is_owned = false;
22781 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
22782 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
22783 LightningError_set_action(&this_ptr_conv, val_conv);
22786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
22787 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
22788 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
22789 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
22790 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
22791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22793 uint64_t ret_ref = (uint64_t)ret_var.inner;
22794 if (ret_var.is_owned) {
22800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22801 LDKLightningError orig_conv;
22802 orig_conv.inner = (void*)(orig & (~1));
22803 orig_conv.is_owned = false;
22804 LDKLightningError ret_var = LightningError_clone(&orig_conv);
22805 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22806 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22807 uint64_t ret_ref = (uint64_t)ret_var.inner;
22808 if (ret_var.is_owned) {
22814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22815 LDKCommitmentUpdate this_obj_conv;
22816 this_obj_conv.inner = (void*)(this_obj & (~1));
22817 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22818 CommitmentUpdate_free(this_obj_conv);
22821 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22822 LDKCommitmentUpdate this_ptr_conv;
22823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22824 this_ptr_conv.is_owned = false;
22825 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
22826 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22827 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22828 for (size_t p = 0; p < ret_var.datalen; p++) {
22829 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
22830 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22831 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22832 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
22833 if (ret_conv_15_var.is_owned) {
22834 ret_conv_15_ref |= 1;
22836 ret_arr_ptr[p] = ret_conv_15_ref;
22838 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22839 FREE(ret_var.data);
22843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22844 LDKCommitmentUpdate this_ptr_conv;
22845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22846 this_ptr_conv.is_owned = false;
22847 LDKCVec_UpdateAddHTLCZ val_constr;
22848 val_constr.datalen = (*env)->GetArrayLength(env, val);
22849 if (val_constr.datalen > 0)
22850 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
22852 val_constr.data = NULL;
22853 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22854 for (size_t p = 0; p < val_constr.datalen; p++) {
22855 int64_t val_conv_15 = val_vals[p];
22856 LDKUpdateAddHTLC val_conv_15_conv;
22857 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
22858 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
22859 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
22860 val_constr.data[p] = val_conv_15_conv;
22862 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22863 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
22866 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22867 LDKCommitmentUpdate this_ptr_conv;
22868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22869 this_ptr_conv.is_owned = false;
22870 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
22871 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22872 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22873 for (size_t t = 0; t < ret_var.datalen; t++) {
22874 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
22875 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22876 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22877 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
22878 if (ret_conv_19_var.is_owned) {
22879 ret_conv_19_ref |= 1;
22881 ret_arr_ptr[t] = ret_conv_19_ref;
22883 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22884 FREE(ret_var.data);
22888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22889 LDKCommitmentUpdate this_ptr_conv;
22890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22891 this_ptr_conv.is_owned = false;
22892 LDKCVec_UpdateFulfillHTLCZ val_constr;
22893 val_constr.datalen = (*env)->GetArrayLength(env, val);
22894 if (val_constr.datalen > 0)
22895 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
22897 val_constr.data = NULL;
22898 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22899 for (size_t t = 0; t < val_constr.datalen; t++) {
22900 int64_t val_conv_19 = val_vals[t];
22901 LDKUpdateFulfillHTLC val_conv_19_conv;
22902 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
22903 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
22904 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
22905 val_constr.data[t] = val_conv_19_conv;
22907 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22908 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
22911 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22912 LDKCommitmentUpdate this_ptr_conv;
22913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22914 this_ptr_conv.is_owned = false;
22915 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
22916 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22917 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22918 for (size_t q = 0; q < ret_var.datalen; q++) {
22919 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
22920 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22921 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22922 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
22923 if (ret_conv_16_var.is_owned) {
22924 ret_conv_16_ref |= 1;
22926 ret_arr_ptr[q] = ret_conv_16_ref;
22928 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22929 FREE(ret_var.data);
22933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22934 LDKCommitmentUpdate this_ptr_conv;
22935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22936 this_ptr_conv.is_owned = false;
22937 LDKCVec_UpdateFailHTLCZ val_constr;
22938 val_constr.datalen = (*env)->GetArrayLength(env, val);
22939 if (val_constr.datalen > 0)
22940 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
22942 val_constr.data = NULL;
22943 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22944 for (size_t q = 0; q < val_constr.datalen; q++) {
22945 int64_t val_conv_16 = val_vals[q];
22946 LDKUpdateFailHTLC val_conv_16_conv;
22947 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
22948 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
22949 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
22950 val_constr.data[q] = val_conv_16_conv;
22952 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22953 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
22956 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22957 LDKCommitmentUpdate this_ptr_conv;
22958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22959 this_ptr_conv.is_owned = false;
22960 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
22961 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22962 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22963 for (size_t z = 0; z < ret_var.datalen; z++) {
22964 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
22965 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22966 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22967 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
22968 if (ret_conv_25_var.is_owned) {
22969 ret_conv_25_ref |= 1;
22971 ret_arr_ptr[z] = ret_conv_25_ref;
22973 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22974 FREE(ret_var.data);
22978 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) {
22979 LDKCommitmentUpdate this_ptr_conv;
22980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22981 this_ptr_conv.is_owned = false;
22982 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
22983 val_constr.datalen = (*env)->GetArrayLength(env, val);
22984 if (val_constr.datalen > 0)
22985 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
22987 val_constr.data = NULL;
22988 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22989 for (size_t z = 0; z < val_constr.datalen; z++) {
22990 int64_t val_conv_25 = val_vals[z];
22991 LDKUpdateFailMalformedHTLC val_conv_25_conv;
22992 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
22993 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
22994 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
22995 val_constr.data[z] = val_conv_25_conv;
22997 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22998 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
23001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
23002 LDKCommitmentUpdate this_ptr_conv;
23003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23004 this_ptr_conv.is_owned = false;
23005 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
23006 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23007 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23008 uint64_t ret_ref = (uint64_t)ret_var.inner;
23009 if (ret_var.is_owned) {
23015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23016 LDKCommitmentUpdate this_ptr_conv;
23017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23018 this_ptr_conv.is_owned = false;
23019 LDKUpdateFee val_conv;
23020 val_conv.inner = (void*)(val & (~1));
23021 val_conv.is_owned = (val & 1) || (val == 0);
23022 val_conv = UpdateFee_clone(&val_conv);
23023 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
23026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
23027 LDKCommitmentUpdate this_ptr_conv;
23028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23029 this_ptr_conv.is_owned = false;
23030 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
23031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23033 uint64_t ret_ref = (uint64_t)ret_var.inner;
23034 if (ret_var.is_owned) {
23040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23041 LDKCommitmentUpdate this_ptr_conv;
23042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23043 this_ptr_conv.is_owned = false;
23044 LDKCommitmentSigned val_conv;
23045 val_conv.inner = (void*)(val & (~1));
23046 val_conv.is_owned = (val & 1) || (val == 0);
23047 val_conv = CommitmentSigned_clone(&val_conv);
23048 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
23051 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) {
23052 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
23053 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
23054 if (update_add_htlcs_arg_constr.datalen > 0)
23055 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23057 update_add_htlcs_arg_constr.data = NULL;
23058 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
23059 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
23060 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
23061 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
23062 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
23063 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
23064 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
23065 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
23067 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
23068 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
23069 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
23070 if (update_fulfill_htlcs_arg_constr.datalen > 0)
23071 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23073 update_fulfill_htlcs_arg_constr.data = NULL;
23074 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
23075 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
23076 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
23077 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
23078 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
23079 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
23080 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
23081 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
23083 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
23084 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
23085 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
23086 if (update_fail_htlcs_arg_constr.datalen > 0)
23087 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23089 update_fail_htlcs_arg_constr.data = NULL;
23090 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
23091 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
23092 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
23093 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
23094 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
23095 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
23096 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
23097 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
23099 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
23100 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
23101 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
23102 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
23103 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23105 update_fail_malformed_htlcs_arg_constr.data = NULL;
23106 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
23107 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
23108 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
23109 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
23110 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
23111 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);
23112 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
23113 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
23115 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
23116 LDKUpdateFee update_fee_arg_conv;
23117 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
23118 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
23119 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
23120 LDKCommitmentSigned commitment_signed_arg_conv;
23121 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
23122 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
23123 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
23124 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);
23125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23127 uint64_t ret_ref = (uint64_t)ret_var.inner;
23128 if (ret_var.is_owned) {
23134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23135 LDKCommitmentUpdate orig_conv;
23136 orig_conv.inner = (void*)(orig & (~1));
23137 orig_conv.is_owned = false;
23138 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
23139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23141 uint64_t ret_ref = (uint64_t)ret_var.inner;
23142 if (ret_var.is_owned) {
23148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23149 if ((this_ptr & 1) != 0) return;
23150 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
23151 FREE((void*)this_ptr);
23152 ChannelMessageHandler_free(this_ptr_conv);
23155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23156 if ((this_ptr & 1) != 0) return;
23157 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
23158 FREE((void*)this_ptr);
23159 RoutingMessageHandler_free(this_ptr_conv);
23162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
23163 LDKAcceptChannel obj_conv;
23164 obj_conv.inner = (void*)(obj & (~1));
23165 obj_conv.is_owned = false;
23166 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
23167 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23168 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23169 CVec_u8Z_free(ret_var);
23173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23174 LDKu8slice ser_ref;
23175 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23176 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23177 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23178 *ret_conv = AcceptChannel_read(ser_ref);
23179 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23180 return (uint64_t)ret_conv;
23183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
23184 LDKAnnouncementSignatures obj_conv;
23185 obj_conv.inner = (void*)(obj & (~1));
23186 obj_conv.is_owned = false;
23187 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
23188 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23189 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23190 CVec_u8Z_free(ret_var);
23194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23195 LDKu8slice ser_ref;
23196 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23197 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23198 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23199 *ret_conv = AnnouncementSignatures_read(ser_ref);
23200 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23201 return (uint64_t)ret_conv;
23204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
23205 LDKChannelReestablish obj_conv;
23206 obj_conv.inner = (void*)(obj & (~1));
23207 obj_conv.is_owned = false;
23208 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
23209 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23210 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23211 CVec_u8Z_free(ret_var);
23215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23216 LDKu8slice ser_ref;
23217 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23218 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23219 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23220 *ret_conv = ChannelReestablish_read(ser_ref);
23221 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23222 return (uint64_t)ret_conv;
23225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23226 LDKClosingSigned obj_conv;
23227 obj_conv.inner = (void*)(obj & (~1));
23228 obj_conv.is_owned = false;
23229 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
23230 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23231 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23232 CVec_u8Z_free(ret_var);
23236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23237 LDKu8slice ser_ref;
23238 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23239 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23240 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23241 *ret_conv = ClosingSigned_read(ser_ref);
23242 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23243 return (uint64_t)ret_conv;
23246 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23247 LDKClosingSignedFeeRange obj_conv;
23248 obj_conv.inner = (void*)(obj & (~1));
23249 obj_conv.is_owned = false;
23250 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
23251 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23252 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23253 CVec_u8Z_free(ret_var);
23257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23258 LDKu8slice ser_ref;
23259 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23260 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23261 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23262 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
23263 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23264 return (uint64_t)ret_conv;
23267 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23268 LDKCommitmentSigned obj_conv;
23269 obj_conv.inner = (void*)(obj & (~1));
23270 obj_conv.is_owned = false;
23271 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
23272 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23273 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23274 CVec_u8Z_free(ret_var);
23278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23279 LDKu8slice ser_ref;
23280 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23281 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23282 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23283 *ret_conv = CommitmentSigned_read(ser_ref);
23284 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23285 return (uint64_t)ret_conv;
23288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
23289 LDKFundingCreated obj_conv;
23290 obj_conv.inner = (void*)(obj & (~1));
23291 obj_conv.is_owned = false;
23292 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
23293 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23294 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23295 CVec_u8Z_free(ret_var);
23299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23300 LDKu8slice ser_ref;
23301 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23302 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23303 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
23304 *ret_conv = FundingCreated_read(ser_ref);
23305 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23306 return (uint64_t)ret_conv;
23309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23310 LDKFundingSigned obj_conv;
23311 obj_conv.inner = (void*)(obj & (~1));
23312 obj_conv.is_owned = false;
23313 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
23314 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23315 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23316 CVec_u8Z_free(ret_var);
23320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23321 LDKu8slice ser_ref;
23322 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23323 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23324 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
23325 *ret_conv = FundingSigned_read(ser_ref);
23326 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23327 return (uint64_t)ret_conv;
23330 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
23331 LDKFundingLocked obj_conv;
23332 obj_conv.inner = (void*)(obj & (~1));
23333 obj_conv.is_owned = false;
23334 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
23335 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23336 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23337 CVec_u8Z_free(ret_var);
23341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23342 LDKu8slice ser_ref;
23343 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23344 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23345 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
23346 *ret_conv = FundingLocked_read(ser_ref);
23347 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23348 return (uint64_t)ret_conv;
23351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
23353 obj_conv.inner = (void*)(obj & (~1));
23354 obj_conv.is_owned = false;
23355 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
23356 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23357 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23358 CVec_u8Z_free(ret_var);
23362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23363 LDKu8slice ser_ref;
23364 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23365 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23366 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
23367 *ret_conv = Init_read(ser_ref);
23368 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23369 return (uint64_t)ret_conv;
23372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
23373 LDKOpenChannel obj_conv;
23374 obj_conv.inner = (void*)(obj & (~1));
23375 obj_conv.is_owned = false;
23376 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
23377 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23378 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23379 CVec_u8Z_free(ret_var);
23383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23384 LDKu8slice ser_ref;
23385 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23386 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23387 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
23388 *ret_conv = OpenChannel_read(ser_ref);
23389 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23390 return (uint64_t)ret_conv;
23393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
23394 LDKRevokeAndACK obj_conv;
23395 obj_conv.inner = (void*)(obj & (~1));
23396 obj_conv.is_owned = false;
23397 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
23398 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23399 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23400 CVec_u8Z_free(ret_var);
23404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23405 LDKu8slice ser_ref;
23406 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23407 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23408 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
23409 *ret_conv = RevokeAndACK_read(ser_ref);
23410 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23411 return (uint64_t)ret_conv;
23414 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
23415 LDKShutdown obj_conv;
23416 obj_conv.inner = (void*)(obj & (~1));
23417 obj_conv.is_owned = false;
23418 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
23419 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23420 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23421 CVec_u8Z_free(ret_var);
23425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23426 LDKu8slice ser_ref;
23427 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23428 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23429 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23430 *ret_conv = Shutdown_read(ser_ref);
23431 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23432 return (uint64_t)ret_conv;
23435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23436 LDKUpdateFailHTLC obj_conv;
23437 obj_conv.inner = (void*)(obj & (~1));
23438 obj_conv.is_owned = false;
23439 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
23440 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23441 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23442 CVec_u8Z_free(ret_var);
23446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23447 LDKu8slice ser_ref;
23448 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23449 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23450 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23451 *ret_conv = UpdateFailHTLC_read(ser_ref);
23452 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23453 return (uint64_t)ret_conv;
23456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23457 LDKUpdateFailMalformedHTLC obj_conv;
23458 obj_conv.inner = (void*)(obj & (~1));
23459 obj_conv.is_owned = false;
23460 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
23461 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23462 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23463 CVec_u8Z_free(ret_var);
23467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23468 LDKu8slice ser_ref;
23469 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23470 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23471 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23472 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
23473 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23474 return (uint64_t)ret_conv;
23477 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
23478 LDKUpdateFee obj_conv;
23479 obj_conv.inner = (void*)(obj & (~1));
23480 obj_conv.is_owned = false;
23481 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
23482 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23483 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23484 CVec_u8Z_free(ret_var);
23488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23489 LDKu8slice ser_ref;
23490 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23491 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23492 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23493 *ret_conv = UpdateFee_read(ser_ref);
23494 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23495 return (uint64_t)ret_conv;
23498 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23499 LDKUpdateFulfillHTLC obj_conv;
23500 obj_conv.inner = (void*)(obj & (~1));
23501 obj_conv.is_owned = false;
23502 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
23503 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23504 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23505 CVec_u8Z_free(ret_var);
23509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23510 LDKu8slice ser_ref;
23511 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23512 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23513 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23514 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
23515 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23516 return (uint64_t)ret_conv;
23519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23520 LDKUpdateAddHTLC obj_conv;
23521 obj_conv.inner = (void*)(obj & (~1));
23522 obj_conv.is_owned = false;
23523 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
23524 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23525 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23526 CVec_u8Z_free(ret_var);
23530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23531 LDKu8slice ser_ref;
23532 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23533 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23534 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23535 *ret_conv = UpdateAddHTLC_read(ser_ref);
23536 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23537 return (uint64_t)ret_conv;
23540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
23542 obj_conv.inner = (void*)(obj & (~1));
23543 obj_conv.is_owned = false;
23544 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
23545 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23546 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23547 CVec_u8Z_free(ret_var);
23551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23552 LDKu8slice ser_ref;
23553 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23554 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23555 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23556 *ret_conv = Ping_read(ser_ref);
23557 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23558 return (uint64_t)ret_conv;
23561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
23563 obj_conv.inner = (void*)(obj & (~1));
23564 obj_conv.is_owned = false;
23565 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
23566 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23567 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23568 CVec_u8Z_free(ret_var);
23572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23573 LDKu8slice ser_ref;
23574 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23575 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23576 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23577 *ret_conv = Pong_read(ser_ref);
23578 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23579 return (uint64_t)ret_conv;
23582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23583 LDKUnsignedChannelAnnouncement obj_conv;
23584 obj_conv.inner = (void*)(obj & (~1));
23585 obj_conv.is_owned = false;
23586 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
23587 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23588 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23589 CVec_u8Z_free(ret_var);
23593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23594 LDKu8slice ser_ref;
23595 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23596 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23597 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23598 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
23599 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23600 return (uint64_t)ret_conv;
23603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23604 LDKChannelAnnouncement obj_conv;
23605 obj_conv.inner = (void*)(obj & (~1));
23606 obj_conv.is_owned = false;
23607 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
23608 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23609 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23610 CVec_u8Z_free(ret_var);
23614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23615 LDKu8slice ser_ref;
23616 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23617 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23618 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23619 *ret_conv = ChannelAnnouncement_read(ser_ref);
23620 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23621 return (uint64_t)ret_conv;
23624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
23625 LDKUnsignedChannelUpdate obj_conv;
23626 obj_conv.inner = (void*)(obj & (~1));
23627 obj_conv.is_owned = false;
23628 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
23629 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23630 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23631 CVec_u8Z_free(ret_var);
23635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23636 LDKu8slice ser_ref;
23637 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23638 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23639 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23640 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
23641 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23642 return (uint64_t)ret_conv;
23645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
23646 LDKChannelUpdate obj_conv;
23647 obj_conv.inner = (void*)(obj & (~1));
23648 obj_conv.is_owned = false;
23649 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
23650 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23651 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23652 CVec_u8Z_free(ret_var);
23656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23657 LDKu8slice ser_ref;
23658 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23659 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23660 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23661 *ret_conv = ChannelUpdate_read(ser_ref);
23662 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23663 return (uint64_t)ret_conv;
23666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
23667 LDKErrorMessage obj_conv;
23668 obj_conv.inner = (void*)(obj & (~1));
23669 obj_conv.is_owned = false;
23670 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
23671 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23672 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23673 CVec_u8Z_free(ret_var);
23677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23678 LDKu8slice ser_ref;
23679 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23680 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23681 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23682 *ret_conv = ErrorMessage_read(ser_ref);
23683 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23684 return (uint64_t)ret_conv;
23687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23688 LDKUnsignedNodeAnnouncement obj_conv;
23689 obj_conv.inner = (void*)(obj & (~1));
23690 obj_conv.is_owned = false;
23691 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
23692 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23693 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23694 CVec_u8Z_free(ret_var);
23698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23699 LDKu8slice ser_ref;
23700 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23701 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23702 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23703 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
23704 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23705 return (uint64_t)ret_conv;
23708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23709 LDKNodeAnnouncement obj_conv;
23710 obj_conv.inner = (void*)(obj & (~1));
23711 obj_conv.is_owned = false;
23712 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
23713 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23714 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23715 CVec_u8Z_free(ret_var);
23719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23720 LDKu8slice ser_ref;
23721 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23722 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23723 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23724 *ret_conv = NodeAnnouncement_read(ser_ref);
23725 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23726 return (uint64_t)ret_conv;
23729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23730 LDKu8slice ser_ref;
23731 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23732 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23733 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23734 *ret_conv = QueryShortChannelIds_read(ser_ref);
23735 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23736 return (uint64_t)ret_conv;
23739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
23740 LDKQueryShortChannelIds obj_conv;
23741 obj_conv.inner = (void*)(obj & (~1));
23742 obj_conv.is_owned = false;
23743 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
23744 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23745 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23746 CVec_u8Z_free(ret_var);
23750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
23751 LDKReplyShortChannelIdsEnd obj_conv;
23752 obj_conv.inner = (void*)(obj & (~1));
23753 obj_conv.is_owned = false;
23754 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
23755 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23756 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23757 CVec_u8Z_free(ret_var);
23761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23762 LDKu8slice ser_ref;
23763 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23764 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23765 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23766 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
23767 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23768 return (uint64_t)ret_conv;
23771 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
23772 LDKQueryChannelRange this_arg_conv;
23773 this_arg_conv.inner = (void*)(this_arg & (~1));
23774 this_arg_conv.is_owned = false;
23775 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
23779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23780 LDKQueryChannelRange obj_conv;
23781 obj_conv.inner = (void*)(obj & (~1));
23782 obj_conv.is_owned = false;
23783 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
23784 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23785 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23786 CVec_u8Z_free(ret_var);
23790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23791 LDKu8slice ser_ref;
23792 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23793 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23794 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23795 *ret_conv = QueryChannelRange_read(ser_ref);
23796 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23797 return (uint64_t)ret_conv;
23800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23801 LDKu8slice ser_ref;
23802 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23803 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23804 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23805 *ret_conv = ReplyChannelRange_read(ser_ref);
23806 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23807 return (uint64_t)ret_conv;
23810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23811 LDKReplyChannelRange obj_conv;
23812 obj_conv.inner = (void*)(obj & (~1));
23813 obj_conv.is_owned = false;
23814 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
23815 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23816 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23817 CVec_u8Z_free(ret_var);
23821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
23822 LDKGossipTimestampFilter obj_conv;
23823 obj_conv.inner = (void*)(obj & (~1));
23824 obj_conv.is_owned = false;
23825 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
23826 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23827 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23828 CVec_u8Z_free(ret_var);
23832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23833 LDKu8slice ser_ref;
23834 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23835 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23836 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23837 *ret_conv = GossipTimestampFilter_read(ser_ref);
23838 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23839 return (uint64_t)ret_conv;
23842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23843 if ((this_ptr & 1) != 0) return;
23844 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
23845 FREE((void*)this_ptr);
23846 CustomMessageHandler_free(this_ptr_conv);
23849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23850 LDKIgnoringMessageHandler this_obj_conv;
23851 this_obj_conv.inner = (void*)(this_obj & (~1));
23852 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23853 IgnoringMessageHandler_free(this_obj_conv);
23856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
23857 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
23858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23860 uint64_t ret_ref = (uint64_t)ret_var.inner;
23861 if (ret_var.is_owned) {
23867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23868 LDKIgnoringMessageHandler this_arg_conv;
23869 this_arg_conv.inner = (void*)(this_arg & (~1));
23870 this_arg_conv.is_owned = false;
23871 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23872 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
23873 return (uint64_t)ret_ret;
23876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23877 LDKIgnoringMessageHandler this_arg_conv;
23878 this_arg_conv.inner = (void*)(this_arg & (~1));
23879 this_arg_conv.is_owned = false;
23880 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23881 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
23882 return (uint64_t)ret_ret;
23885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
23886 LDKIgnoringMessageHandler this_arg_conv;
23887 this_arg_conv.inner = (void*)(this_arg & (~1));
23888 this_arg_conv.is_owned = false;
23889 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
23890 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
23891 return (uint64_t)ret_ret;
23894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23895 LDKIgnoringMessageHandler this_arg_conv;
23896 this_arg_conv.inner = (void*)(this_arg & (~1));
23897 this_arg_conv.is_owned = false;
23898 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
23899 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
23900 return (uint64_t)ret_ret;
23903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23904 LDKErroringMessageHandler this_obj_conv;
23905 this_obj_conv.inner = (void*)(this_obj & (~1));
23906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23907 ErroringMessageHandler_free(this_obj_conv);
23910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
23911 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
23912 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23913 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23914 uint64_t ret_ref = (uint64_t)ret_var.inner;
23915 if (ret_var.is_owned) {
23921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23922 LDKErroringMessageHandler this_arg_conv;
23923 this_arg_conv.inner = (void*)(this_arg & (~1));
23924 this_arg_conv.is_owned = false;
23925 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23926 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
23927 return (uint64_t)ret_ret;
23930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23931 LDKErroringMessageHandler this_arg_conv;
23932 this_arg_conv.inner = (void*)(this_arg & (~1));
23933 this_arg_conv.is_owned = false;
23934 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
23935 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
23936 return (uint64_t)ret_ret;
23939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23940 LDKMessageHandler this_obj_conv;
23941 this_obj_conv.inner = (void*)(this_obj & (~1));
23942 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23943 MessageHandler_free(this_obj_conv);
23946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
23947 LDKMessageHandler this_ptr_conv;
23948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23949 this_ptr_conv.is_owned = false;
23950 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
23954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23955 LDKMessageHandler this_ptr_conv;
23956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23957 this_ptr_conv.is_owned = false;
23958 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
23959 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
23960 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23961 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
23963 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
23966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
23967 LDKMessageHandler this_ptr_conv;
23968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23969 this_ptr_conv.is_owned = false;
23970 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
23974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23975 LDKMessageHandler this_ptr_conv;
23976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23977 this_ptr_conv.is_owned = false;
23978 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
23979 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
23980 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23981 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
23983 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
23986 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) {
23987 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
23988 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
23989 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23990 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
23992 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
23993 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
23994 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23995 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
23997 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
23998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24000 uint64_t ret_ref = (uint64_t)ret_var.inner;
24001 if (ret_var.is_owned) {
24007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24008 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
24009 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
24010 *ret_ret = SocketDescriptor_clone(orig_conv);
24011 return (uint64_t)ret_ret;
24014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24015 if ((this_ptr & 1) != 0) return;
24016 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
24017 FREE((void*)this_ptr);
24018 SocketDescriptor_free(this_ptr_conv);
24021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24022 LDKPeerHandleError this_obj_conv;
24023 this_obj_conv.inner = (void*)(this_obj & (~1));
24024 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24025 PeerHandleError_free(this_obj_conv);
24028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
24029 LDKPeerHandleError this_ptr_conv;
24030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24031 this_ptr_conv.is_owned = false;
24032 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
24036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24037 LDKPeerHandleError this_ptr_conv;
24038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24039 this_ptr_conv.is_owned = false;
24040 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
24043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
24044 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
24045 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24046 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24047 uint64_t ret_ref = (uint64_t)ret_var.inner;
24048 if (ret_var.is_owned) {
24054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24055 LDKPeerHandleError orig_conv;
24056 orig_conv.inner = (void*)(orig & (~1));
24057 orig_conv.is_owned = false;
24058 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
24059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24061 uint64_t ret_ref = (uint64_t)ret_var.inner;
24062 if (ret_var.is_owned) {
24068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24069 LDKPeerManager this_obj_conv;
24070 this_obj_conv.inner = (void*)(this_obj & (~1));
24071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24072 PeerManager_free(this_obj_conv);
24075 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) {
24076 LDKMessageHandler message_handler_conv;
24077 message_handler_conv.inner = (void*)(message_handler & (~1));
24078 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
24079 // Warning: we need a move here but no clone is available for LDKMessageHandler
24080 LDKSecretKey our_node_secret_ref;
24081 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
24082 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
24083 unsigned char ephemeral_random_data_arr[32];
24084 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
24085 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
24086 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
24087 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24088 if (logger_conv.free == LDKLogger_JCalls_free) {
24089 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24090 LDKLogger_JCalls_cloned(&logger_conv);
24092 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
24093 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
24094 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24095 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
24097 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
24098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24100 uint64_t ret_ref = (uint64_t)ret_var.inner;
24101 if (ret_var.is_owned) {
24107 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
24108 LDKPeerManager this_arg_conv;
24109 this_arg_conv.inner = (void*)(this_arg & (~1));
24110 this_arg_conv.is_owned = false;
24111 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
24112 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
24114 for (size_t i = 0; i < ret_var.datalen; i++) {
24115 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
24116 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
24117 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
24119 FREE(ret_var.data);
24123 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) {
24124 LDKPeerManager this_arg_conv;
24125 this_arg_conv.inner = (void*)(this_arg & (~1));
24126 this_arg_conv.is_owned = false;
24127 LDKPublicKey their_node_id_ref;
24128 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
24129 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
24130 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24131 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
24132 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24133 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
24135 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24136 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
24137 return (uint64_t)ret_conv;
24140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
24141 LDKPeerManager this_arg_conv;
24142 this_arg_conv.inner = (void*)(this_arg & (~1));
24143 this_arg_conv.is_owned = false;
24144 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24145 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
24146 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24147 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
24149 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24150 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
24151 return (uint64_t)ret_conv;
24154 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) {
24155 LDKPeerManager this_arg_conv;
24156 this_arg_conv.inner = (void*)(this_arg & (~1));
24157 this_arg_conv.is_owned = false;
24158 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24159 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24160 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
24161 return (uint64_t)ret_conv;
24164 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) {
24165 LDKPeerManager this_arg_conv;
24166 this_arg_conv.inner = (void*)(this_arg & (~1));
24167 this_arg_conv.is_owned = false;
24168 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
24169 LDKu8slice data_ref;
24170 data_ref.datalen = (*env)->GetArrayLength(env, data);
24171 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
24172 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24173 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
24174 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
24175 return (uint64_t)ret_conv;
24178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
24179 LDKPeerManager this_arg_conv;
24180 this_arg_conv.inner = (void*)(this_arg & (~1));
24181 this_arg_conv.is_owned = false;
24182 PeerManager_process_events(&this_arg_conv);
24185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
24186 LDKPeerManager this_arg_conv;
24187 this_arg_conv.inner = (void*)(this_arg & (~1));
24188 this_arg_conv.is_owned = false;
24189 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24190 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
24193 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) {
24194 LDKPeerManager this_arg_conv;
24195 this_arg_conv.inner = (void*)(this_arg & (~1));
24196 this_arg_conv.is_owned = false;
24197 LDKPublicKey node_id_ref;
24198 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24199 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24200 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
24203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
24204 LDKPeerManager this_arg_conv;
24205 this_arg_conv.inner = (void*)(this_arg & (~1));
24206 this_arg_conv.is_owned = false;
24207 PeerManager_timer_tick_occurred(&this_arg_conv);
24210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
24211 unsigned char commitment_seed_arr[32];
24212 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
24213 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
24214 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
24215 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24216 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
24220 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) {
24221 LDKCVec_u8Z to_holder_script_ref;
24222 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
24223 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
24224 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
24225 LDKCVec_u8Z to_counterparty_script_ref;
24226 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
24227 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
24228 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
24229 LDKOutPoint funding_outpoint_conv;
24230 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
24231 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
24232 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
24233 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);
24234 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24235 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24236 Transaction_free(ret_var);
24240 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) {
24241 LDKPublicKey per_commitment_point_ref;
24242 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24243 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24244 unsigned char base_secret_arr[32];
24245 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
24246 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
24247 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
24248 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
24249 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
24250 return (uint64_t)ret_conv;
24253 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) {
24254 LDKPublicKey per_commitment_point_ref;
24255 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24256 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24257 LDKPublicKey base_point_ref;
24258 CHECK((*env)->GetArrayLength(env, base_point) == 33);
24259 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
24260 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24261 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
24262 return (uint64_t)ret_conv;
24265 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) {
24266 unsigned char per_commitment_secret_arr[32];
24267 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
24268 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
24269 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
24270 unsigned char countersignatory_revocation_base_secret_arr[32];
24271 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
24272 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
24273 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
24274 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
24275 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
24276 return (uint64_t)ret_conv;
24279 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) {
24280 LDKPublicKey per_commitment_point_ref;
24281 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24282 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24283 LDKPublicKey countersignatory_revocation_base_point_ref;
24284 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
24285 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
24286 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24287 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
24288 return (uint64_t)ret_conv;
24291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24292 LDKTxCreationKeys this_obj_conv;
24293 this_obj_conv.inner = (void*)(this_obj & (~1));
24294 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24295 TxCreationKeys_free(this_obj_conv);
24298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24299 LDKTxCreationKeys this_ptr_conv;
24300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24301 this_ptr_conv.is_owned = false;
24302 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24303 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
24307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24308 LDKTxCreationKeys this_ptr_conv;
24309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24310 this_ptr_conv.is_owned = false;
24311 LDKPublicKey val_ref;
24312 CHECK((*env)->GetArrayLength(env, val) == 33);
24313 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24314 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
24317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24318 LDKTxCreationKeys this_ptr_conv;
24319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24320 this_ptr_conv.is_owned = false;
24321 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
24326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24327 LDKTxCreationKeys this_ptr_conv;
24328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24329 this_ptr_conv.is_owned = false;
24330 LDKPublicKey val_ref;
24331 CHECK((*env)->GetArrayLength(env, val) == 33);
24332 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24333 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
24336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24337 LDKTxCreationKeys this_ptr_conv;
24338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24339 this_ptr_conv.is_owned = false;
24340 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24341 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
24345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24346 LDKTxCreationKeys this_ptr_conv;
24347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24348 this_ptr_conv.is_owned = false;
24349 LDKPublicKey val_ref;
24350 CHECK((*env)->GetArrayLength(env, val) == 33);
24351 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24352 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
24355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24356 LDKTxCreationKeys this_ptr_conv;
24357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24358 this_ptr_conv.is_owned = false;
24359 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24360 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
24364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24365 LDKTxCreationKeys this_ptr_conv;
24366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24367 this_ptr_conv.is_owned = false;
24368 LDKPublicKey val_ref;
24369 CHECK((*env)->GetArrayLength(env, val) == 33);
24370 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24371 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
24374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24375 LDKTxCreationKeys this_ptr_conv;
24376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24377 this_ptr_conv.is_owned = false;
24378 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24379 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
24383 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) {
24384 LDKTxCreationKeys this_ptr_conv;
24385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24386 this_ptr_conv.is_owned = false;
24387 LDKPublicKey val_ref;
24388 CHECK((*env)->GetArrayLength(env, val) == 33);
24389 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24390 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
24393 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) {
24394 LDKPublicKey per_commitment_point_arg_ref;
24395 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
24396 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
24397 LDKPublicKey revocation_key_arg_ref;
24398 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
24399 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
24400 LDKPublicKey broadcaster_htlc_key_arg_ref;
24401 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
24402 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
24403 LDKPublicKey countersignatory_htlc_key_arg_ref;
24404 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
24405 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
24406 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
24407 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
24408 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
24409 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);
24410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24412 uint64_t ret_ref = (uint64_t)ret_var.inner;
24413 if (ret_var.is_owned) {
24419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24420 LDKTxCreationKeys orig_conv;
24421 orig_conv.inner = (void*)(orig & (~1));
24422 orig_conv.is_owned = false;
24423 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
24424 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24425 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24426 uint64_t ret_ref = (uint64_t)ret_var.inner;
24427 if (ret_var.is_owned) {
24433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
24434 LDKTxCreationKeys obj_conv;
24435 obj_conv.inner = (void*)(obj & (~1));
24436 obj_conv.is_owned = false;
24437 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
24438 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24439 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24440 CVec_u8Z_free(ret_var);
24444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24445 LDKu8slice ser_ref;
24446 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24447 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24448 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
24449 *ret_conv = TxCreationKeys_read(ser_ref);
24450 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24451 return (uint64_t)ret_conv;
24454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24455 LDKChannelPublicKeys this_obj_conv;
24456 this_obj_conv.inner = (void*)(this_obj & (~1));
24457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24458 ChannelPublicKeys_free(this_obj_conv);
24461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24462 LDKChannelPublicKeys this_ptr_conv;
24463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24464 this_ptr_conv.is_owned = false;
24465 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24466 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
24470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24471 LDKChannelPublicKeys this_ptr_conv;
24472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24473 this_ptr_conv.is_owned = false;
24474 LDKPublicKey val_ref;
24475 CHECK((*env)->GetArrayLength(env, val) == 33);
24476 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24477 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
24480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24481 LDKChannelPublicKeys this_ptr_conv;
24482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24483 this_ptr_conv.is_owned = false;
24484 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24485 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
24489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24490 LDKChannelPublicKeys this_ptr_conv;
24491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24492 this_ptr_conv.is_owned = false;
24493 LDKPublicKey val_ref;
24494 CHECK((*env)->GetArrayLength(env, val) == 33);
24495 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24496 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
24499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24500 LDKChannelPublicKeys this_ptr_conv;
24501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24502 this_ptr_conv.is_owned = false;
24503 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24504 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
24508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24509 LDKChannelPublicKeys this_ptr_conv;
24510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24511 this_ptr_conv.is_owned = false;
24512 LDKPublicKey val_ref;
24513 CHECK((*env)->GetArrayLength(env, val) == 33);
24514 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24515 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
24518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24519 LDKChannelPublicKeys this_ptr_conv;
24520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24521 this_ptr_conv.is_owned = false;
24522 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24523 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
24527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24528 LDKChannelPublicKeys this_ptr_conv;
24529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24530 this_ptr_conv.is_owned = false;
24531 LDKPublicKey val_ref;
24532 CHECK((*env)->GetArrayLength(env, val) == 33);
24533 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24534 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
24537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24538 LDKChannelPublicKeys this_ptr_conv;
24539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24540 this_ptr_conv.is_owned = false;
24541 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24542 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
24546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24547 LDKChannelPublicKeys this_ptr_conv;
24548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24549 this_ptr_conv.is_owned = false;
24550 LDKPublicKey val_ref;
24551 CHECK((*env)->GetArrayLength(env, val) == 33);
24552 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24553 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
24556 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) {
24557 LDKPublicKey funding_pubkey_arg_ref;
24558 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
24559 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
24560 LDKPublicKey revocation_basepoint_arg_ref;
24561 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
24562 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
24563 LDKPublicKey payment_point_arg_ref;
24564 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
24565 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
24566 LDKPublicKey delayed_payment_basepoint_arg_ref;
24567 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
24568 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
24569 LDKPublicKey htlc_basepoint_arg_ref;
24570 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
24571 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
24572 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);
24573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24575 uint64_t ret_ref = (uint64_t)ret_var.inner;
24576 if (ret_var.is_owned) {
24582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24583 LDKChannelPublicKeys orig_conv;
24584 orig_conv.inner = (void*)(orig & (~1));
24585 orig_conv.is_owned = false;
24586 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
24587 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24588 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24589 uint64_t ret_ref = (uint64_t)ret_var.inner;
24590 if (ret_var.is_owned) {
24596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
24597 LDKChannelPublicKeys obj_conv;
24598 obj_conv.inner = (void*)(obj & (~1));
24599 obj_conv.is_owned = false;
24600 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
24601 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24602 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24603 CVec_u8Z_free(ret_var);
24607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24608 LDKu8slice ser_ref;
24609 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24610 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24611 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
24612 *ret_conv = ChannelPublicKeys_read(ser_ref);
24613 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24614 return (uint64_t)ret_conv;
24617 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) {
24618 LDKPublicKey per_commitment_point_ref;
24619 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24620 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24621 LDKPublicKey broadcaster_delayed_payment_base_ref;
24622 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
24623 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
24624 LDKPublicKey broadcaster_htlc_base_ref;
24625 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
24626 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
24627 LDKPublicKey countersignatory_revocation_base_ref;
24628 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
24629 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
24630 LDKPublicKey countersignatory_htlc_base_ref;
24631 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
24632 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
24633 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24634 *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);
24635 return (uint64_t)ret_conv;
24638 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) {
24639 LDKPublicKey per_commitment_point_ref;
24640 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24641 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24642 LDKChannelPublicKeys broadcaster_keys_conv;
24643 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
24644 broadcaster_keys_conv.is_owned = false;
24645 LDKChannelPublicKeys countersignatory_keys_conv;
24646 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
24647 countersignatory_keys_conv.is_owned = false;
24648 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24649 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
24650 return (uint64_t)ret_conv;
24653 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) {
24654 LDKPublicKey revocation_key_ref;
24655 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
24656 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
24657 LDKPublicKey broadcaster_delayed_payment_key_ref;
24658 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
24659 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
24660 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
24661 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24662 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24663 CVec_u8Z_free(ret_var);
24667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24668 LDKHTLCOutputInCommitment this_obj_conv;
24669 this_obj_conv.inner = (void*)(this_obj & (~1));
24670 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24671 HTLCOutputInCommitment_free(this_obj_conv);
24674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
24675 LDKHTLCOutputInCommitment this_ptr_conv;
24676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24677 this_ptr_conv.is_owned = false;
24678 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
24682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24683 LDKHTLCOutputInCommitment this_ptr_conv;
24684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24685 this_ptr_conv.is_owned = false;
24686 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
24689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24690 LDKHTLCOutputInCommitment this_ptr_conv;
24691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24692 this_ptr_conv.is_owned = false;
24693 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
24697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24698 LDKHTLCOutputInCommitment this_ptr_conv;
24699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24700 this_ptr_conv.is_owned = false;
24701 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
24704 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
24705 LDKHTLCOutputInCommitment this_ptr_conv;
24706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24707 this_ptr_conv.is_owned = false;
24708 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
24712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24713 LDKHTLCOutputInCommitment this_ptr_conv;
24714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24715 this_ptr_conv.is_owned = false;
24716 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
24719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24720 LDKHTLCOutputInCommitment this_ptr_conv;
24721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24722 this_ptr_conv.is_owned = false;
24723 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24724 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
24728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24729 LDKHTLCOutputInCommitment this_ptr_conv;
24730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24731 this_ptr_conv.is_owned = false;
24732 LDKThirtyTwoBytes val_ref;
24733 CHECK((*env)->GetArrayLength(env, val) == 32);
24734 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24735 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
24738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
24739 LDKHTLCOutputInCommitment this_ptr_conv;
24740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24741 this_ptr_conv.is_owned = false;
24742 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
24743 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
24744 uint64_t ret_ref = (uint64_t)ret_copy;
24748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24749 LDKHTLCOutputInCommitment this_ptr_conv;
24750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24751 this_ptr_conv.is_owned = false;
24752 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
24753 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
24754 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
24757 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) {
24758 LDKThirtyTwoBytes payment_hash_arg_ref;
24759 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
24760 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
24761 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
24762 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
24763 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
24764 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24765 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24766 uint64_t ret_ref = (uint64_t)ret_var.inner;
24767 if (ret_var.is_owned) {
24773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24774 LDKHTLCOutputInCommitment orig_conv;
24775 orig_conv.inner = (void*)(orig & (~1));
24776 orig_conv.is_owned = false;
24777 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
24778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24780 uint64_t ret_ref = (uint64_t)ret_var.inner;
24781 if (ret_var.is_owned) {
24787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
24788 LDKHTLCOutputInCommitment obj_conv;
24789 obj_conv.inner = (void*)(obj & (~1));
24790 obj_conv.is_owned = false;
24791 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
24792 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24793 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24794 CVec_u8Z_free(ret_var);
24798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24799 LDKu8slice ser_ref;
24800 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24801 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24802 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
24803 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
24804 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24805 return (uint64_t)ret_conv;
24808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
24809 LDKHTLCOutputInCommitment htlc_conv;
24810 htlc_conv.inner = (void*)(htlc & (~1));
24811 htlc_conv.is_owned = false;
24812 LDKTxCreationKeys keys_conv;
24813 keys_conv.inner = (void*)(keys & (~1));
24814 keys_conv.is_owned = false;
24815 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
24816 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24817 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24818 CVec_u8Z_free(ret_var);
24822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
24823 LDKPublicKey broadcaster_ref;
24824 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
24825 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
24826 LDKPublicKey countersignatory_ref;
24827 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
24828 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
24829 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
24830 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24831 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24832 CVec_u8Z_free(ret_var);
24836 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) {
24837 unsigned char commitment_txid_arr[32];
24838 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
24839 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
24840 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
24841 LDKHTLCOutputInCommitment htlc_conv;
24842 htlc_conv.inner = (void*)(htlc & (~1));
24843 htlc_conv.is_owned = false;
24844 LDKPublicKey broadcaster_delayed_payment_key_ref;
24845 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
24846 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
24847 LDKPublicKey revocation_key_ref;
24848 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
24849 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
24850 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
24851 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24852 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24853 Transaction_free(ret_var);
24857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24858 LDKChannelTransactionParameters this_obj_conv;
24859 this_obj_conv.inner = (void*)(this_obj & (~1));
24860 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24861 ChannelTransactionParameters_free(this_obj_conv);
24864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
24865 LDKChannelTransactionParameters this_ptr_conv;
24866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24867 this_ptr_conv.is_owned = false;
24868 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
24869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24871 uint64_t ret_ref = (uint64_t)ret_var.inner;
24872 if (ret_var.is_owned) {
24878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24879 LDKChannelTransactionParameters this_ptr_conv;
24880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24881 this_ptr_conv.is_owned = false;
24882 LDKChannelPublicKeys val_conv;
24883 val_conv.inner = (void*)(val & (~1));
24884 val_conv.is_owned = (val & 1) || (val == 0);
24885 val_conv = ChannelPublicKeys_clone(&val_conv);
24886 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
24889 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24890 LDKChannelTransactionParameters this_ptr_conv;
24891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24892 this_ptr_conv.is_owned = false;
24893 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
24897 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) {
24898 LDKChannelTransactionParameters this_ptr_conv;
24899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24900 this_ptr_conv.is_owned = false;
24901 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
24904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
24905 LDKChannelTransactionParameters this_ptr_conv;
24906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24907 this_ptr_conv.is_owned = false;
24908 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
24912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24913 LDKChannelTransactionParameters this_ptr_conv;
24914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24915 this_ptr_conv.is_owned = false;
24916 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
24919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
24920 LDKChannelTransactionParameters this_ptr_conv;
24921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24922 this_ptr_conv.is_owned = false;
24923 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
24924 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24925 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24926 uint64_t ret_ref = (uint64_t)ret_var.inner;
24927 if (ret_var.is_owned) {
24933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24934 LDKChannelTransactionParameters this_ptr_conv;
24935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24936 this_ptr_conv.is_owned = false;
24937 LDKCounterpartyChannelTransactionParameters val_conv;
24938 val_conv.inner = (void*)(val & (~1));
24939 val_conv.is_owned = (val & 1) || (val == 0);
24940 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
24941 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
24944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24945 LDKChannelTransactionParameters this_ptr_conv;
24946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24947 this_ptr_conv.is_owned = false;
24948 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
24949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24951 uint64_t ret_ref = (uint64_t)ret_var.inner;
24952 if (ret_var.is_owned) {
24958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24959 LDKChannelTransactionParameters this_ptr_conv;
24960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24961 this_ptr_conv.is_owned = false;
24962 LDKOutPoint val_conv;
24963 val_conv.inner = (void*)(val & (~1));
24964 val_conv.is_owned = (val & 1) || (val == 0);
24965 val_conv = OutPoint_clone(&val_conv);
24966 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
24969 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) {
24970 LDKChannelPublicKeys holder_pubkeys_arg_conv;
24971 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
24972 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
24973 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
24974 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
24975 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
24976 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
24977 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
24978 LDKOutPoint funding_outpoint_arg_conv;
24979 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
24980 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
24981 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
24982 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);
24983 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24984 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24985 uint64_t ret_ref = (uint64_t)ret_var.inner;
24986 if (ret_var.is_owned) {
24992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24993 LDKChannelTransactionParameters orig_conv;
24994 orig_conv.inner = (void*)(orig & (~1));
24995 orig_conv.is_owned = false;
24996 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
24997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24999 uint64_t ret_ref = (uint64_t)ret_var.inner;
25000 if (ret_var.is_owned) {
25006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25007 LDKCounterpartyChannelTransactionParameters this_obj_conv;
25008 this_obj_conv.inner = (void*)(this_obj & (~1));
25009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25010 CounterpartyChannelTransactionParameters_free(this_obj_conv);
25013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
25014 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25016 this_ptr_conv.is_owned = false;
25017 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
25018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25020 uint64_t ret_ref = (uint64_t)ret_var.inner;
25021 if (ret_var.is_owned) {
25027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25028 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25030 this_ptr_conv.is_owned = false;
25031 LDKChannelPublicKeys val_conv;
25032 val_conv.inner = (void*)(val & (~1));
25033 val_conv.is_owned = (val & 1) || (val == 0);
25034 val_conv = ChannelPublicKeys_clone(&val_conv);
25035 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
25038 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25039 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25041 this_ptr_conv.is_owned = false;
25042 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
25046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25047 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25049 this_ptr_conv.is_owned = false;
25050 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
25053 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) {
25054 LDKChannelPublicKeys pubkeys_arg_conv;
25055 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
25056 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
25057 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
25058 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
25059 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25060 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25061 uint64_t ret_ref = (uint64_t)ret_var.inner;
25062 if (ret_var.is_owned) {
25068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25069 LDKCounterpartyChannelTransactionParameters orig_conv;
25070 orig_conv.inner = (void*)(orig & (~1));
25071 orig_conv.is_owned = false;
25072 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
25073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25075 uint64_t ret_ref = (uint64_t)ret_var.inner;
25076 if (ret_var.is_owned) {
25082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
25083 LDKChannelTransactionParameters this_arg_conv;
25084 this_arg_conv.inner = (void*)(this_arg & (~1));
25085 this_arg_conv.is_owned = false;
25086 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
25090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25091 LDKChannelTransactionParameters this_arg_conv;
25092 this_arg_conv.inner = (void*)(this_arg & (~1));
25093 this_arg_conv.is_owned = false;
25094 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
25095 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25096 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25097 uint64_t ret_ref = (uint64_t)ret_var.inner;
25098 if (ret_var.is_owned) {
25104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25105 LDKChannelTransactionParameters this_arg_conv;
25106 this_arg_conv.inner = (void*)(this_arg & (~1));
25107 this_arg_conv.is_owned = false;
25108 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
25109 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25110 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25111 uint64_t ret_ref = (uint64_t)ret_var.inner;
25112 if (ret_var.is_owned) {
25118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25119 LDKCounterpartyChannelTransactionParameters obj_conv;
25120 obj_conv.inner = (void*)(obj & (~1));
25121 obj_conv.is_owned = false;
25122 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
25123 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25124 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25125 CVec_u8Z_free(ret_var);
25129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25130 LDKu8slice ser_ref;
25131 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25132 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25133 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25134 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
25135 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25136 return (uint64_t)ret_conv;
25139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25140 LDKChannelTransactionParameters obj_conv;
25141 obj_conv.inner = (void*)(obj & (~1));
25142 obj_conv.is_owned = false;
25143 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
25144 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25145 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25146 CVec_u8Z_free(ret_var);
25150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25151 LDKu8slice ser_ref;
25152 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25153 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25154 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
25155 *ret_conv = ChannelTransactionParameters_read(ser_ref);
25156 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25157 return (uint64_t)ret_conv;
25160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25161 LDKDirectedChannelTransactionParameters this_obj_conv;
25162 this_obj_conv.inner = (void*)(this_obj & (~1));
25163 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25164 DirectedChannelTransactionParameters_free(this_obj_conv);
25167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
25168 LDKDirectedChannelTransactionParameters this_arg_conv;
25169 this_arg_conv.inner = (void*)(this_arg & (~1));
25170 this_arg_conv.is_owned = false;
25171 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
25172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25174 uint64_t ret_ref = (uint64_t)ret_var.inner;
25175 if (ret_var.is_owned) {
25181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
25182 LDKDirectedChannelTransactionParameters this_arg_conv;
25183 this_arg_conv.inner = (void*)(this_arg & (~1));
25184 this_arg_conv.is_owned = false;
25185 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
25186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25188 uint64_t ret_ref = (uint64_t)ret_var.inner;
25189 if (ret_var.is_owned) {
25195 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
25196 LDKDirectedChannelTransactionParameters this_arg_conv;
25197 this_arg_conv.inner = (void*)(this_arg & (~1));
25198 this_arg_conv.is_owned = false;
25199 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
25203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
25204 LDKDirectedChannelTransactionParameters this_arg_conv;
25205 this_arg_conv.inner = (void*)(this_arg & (~1));
25206 this_arg_conv.is_owned = false;
25207 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
25211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
25212 LDKDirectedChannelTransactionParameters this_arg_conv;
25213 this_arg_conv.inner = (void*)(this_arg & (~1));
25214 this_arg_conv.is_owned = false;
25215 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
25216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25218 uint64_t ret_ref = (uint64_t)ret_var.inner;
25219 if (ret_var.is_owned) {
25225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25226 LDKHolderCommitmentTransaction this_obj_conv;
25227 this_obj_conv.inner = (void*)(this_obj & (~1));
25228 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25229 HolderCommitmentTransaction_free(this_obj_conv);
25232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
25233 LDKHolderCommitmentTransaction this_ptr_conv;
25234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25235 this_ptr_conv.is_owned = false;
25236 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25237 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
25241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25242 LDKHolderCommitmentTransaction this_ptr_conv;
25243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25244 this_ptr_conv.is_owned = false;
25245 LDKSignature val_ref;
25246 CHECK((*env)->GetArrayLength(env, val) == 64);
25247 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
25248 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
25251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
25252 LDKHolderCommitmentTransaction this_ptr_conv;
25253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25254 this_ptr_conv.is_owned = false;
25255 LDKCVec_SignatureZ val_constr;
25256 val_constr.datalen = (*env)->GetArrayLength(env, val);
25257 if (val_constr.datalen > 0)
25258 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
25260 val_constr.data = NULL;
25261 for (size_t i = 0; i < val_constr.datalen; i++) {
25262 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
25263 LDKSignature val_conv_8_ref;
25264 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
25265 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
25266 val_constr.data[i] = val_conv_8_ref;
25268 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
25271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25272 LDKHolderCommitmentTransaction orig_conv;
25273 orig_conv.inner = (void*)(orig & (~1));
25274 orig_conv.is_owned = false;
25275 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
25276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25278 uint64_t ret_ref = (uint64_t)ret_var.inner;
25279 if (ret_var.is_owned) {
25285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25286 LDKHolderCommitmentTransaction obj_conv;
25287 obj_conv.inner = (void*)(obj & (~1));
25288 obj_conv.is_owned = false;
25289 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
25290 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25291 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25292 CVec_u8Z_free(ret_var);
25296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25297 LDKu8slice ser_ref;
25298 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25299 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25300 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
25301 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
25302 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25303 return (uint64_t)ret_conv;
25306 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) {
25307 LDKCommitmentTransaction commitment_tx_conv;
25308 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
25309 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
25310 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
25311 LDKSignature counterparty_sig_ref;
25312 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
25313 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
25314 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
25315 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
25316 if (counterparty_htlc_sigs_constr.datalen > 0)
25317 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
25319 counterparty_htlc_sigs_constr.data = NULL;
25320 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
25321 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
25322 LDKSignature counterparty_htlc_sigs_conv_8_ref;
25323 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
25324 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
25325 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
25327 LDKPublicKey holder_funding_key_ref;
25328 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
25329 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
25330 LDKPublicKey counterparty_funding_key_ref;
25331 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
25332 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
25333 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
25334 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25335 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25336 uint64_t ret_ref = (uint64_t)ret_var.inner;
25337 if (ret_var.is_owned) {
25343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25344 LDKBuiltCommitmentTransaction this_obj_conv;
25345 this_obj_conv.inner = (void*)(this_obj & (~1));
25346 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25347 BuiltCommitmentTransaction_free(this_obj_conv);
25350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
25351 LDKBuiltCommitmentTransaction this_ptr_conv;
25352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25353 this_ptr_conv.is_owned = false;
25354 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
25355 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25356 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25357 Transaction_free(ret_var);
25361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25362 LDKBuiltCommitmentTransaction this_ptr_conv;
25363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25364 this_ptr_conv.is_owned = false;
25365 LDKTransaction val_ref;
25366 val_ref.datalen = (*env)->GetArrayLength(env, val);
25367 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
25368 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25369 val_ref.data_is_owned = true;
25370 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
25373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
25374 LDKBuiltCommitmentTransaction this_ptr_conv;
25375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25376 this_ptr_conv.is_owned = false;
25377 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25378 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
25382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25383 LDKBuiltCommitmentTransaction this_ptr_conv;
25384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25385 this_ptr_conv.is_owned = false;
25386 LDKThirtyTwoBytes val_ref;
25387 CHECK((*env)->GetArrayLength(env, val) == 32);
25388 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25389 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
25392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
25393 LDKTransaction transaction_arg_ref;
25394 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
25395 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
25396 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
25397 transaction_arg_ref.data_is_owned = true;
25398 LDKThirtyTwoBytes txid_arg_ref;
25399 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
25400 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
25401 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
25402 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25403 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25404 uint64_t ret_ref = (uint64_t)ret_var.inner;
25405 if (ret_var.is_owned) {
25411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25412 LDKBuiltCommitmentTransaction orig_conv;
25413 orig_conv.inner = (void*)(orig & (~1));
25414 orig_conv.is_owned = false;
25415 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
25416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25418 uint64_t ret_ref = (uint64_t)ret_var.inner;
25419 if (ret_var.is_owned) {
25425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25426 LDKBuiltCommitmentTransaction obj_conv;
25427 obj_conv.inner = (void*)(obj & (~1));
25428 obj_conv.is_owned = false;
25429 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
25430 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25431 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25432 CVec_u8Z_free(ret_var);
25436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25437 LDKu8slice ser_ref;
25438 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25439 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25440 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
25441 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
25442 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25443 return (uint64_t)ret_conv;
25446 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) {
25447 LDKBuiltCommitmentTransaction this_arg_conv;
25448 this_arg_conv.inner = (void*)(this_arg & (~1));
25449 this_arg_conv.is_owned = false;
25450 LDKu8slice funding_redeemscript_ref;
25451 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25452 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25453 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25454 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
25455 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25459 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) {
25460 LDKBuiltCommitmentTransaction this_arg_conv;
25461 this_arg_conv.inner = (void*)(this_arg & (~1));
25462 this_arg_conv.is_owned = false;
25463 unsigned char funding_key_arr[32];
25464 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
25465 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
25466 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25467 LDKu8slice funding_redeemscript_ref;
25468 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25469 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25470 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25471 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
25472 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25477 LDKClosingTransaction this_obj_conv;
25478 this_obj_conv.inner = (void*)(this_obj & (~1));
25479 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25480 ClosingTransaction_free(this_obj_conv);
25483 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) {
25484 LDKCVec_u8Z to_holder_script_ref;
25485 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
25486 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
25487 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
25488 LDKCVec_u8Z to_counterparty_script_ref;
25489 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
25490 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
25491 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
25492 LDKOutPoint funding_outpoint_conv;
25493 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25494 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25495 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25496 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
25497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25499 uint64_t ret_ref = (uint64_t)ret_var.inner;
25500 if (ret_var.is_owned) {
25506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
25507 LDKClosingTransaction this_arg_conv;
25508 this_arg_conv.inner = (void*)(this_arg & (~1));
25509 this_arg_conv.is_owned = false;
25510 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
25511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25513 uint64_t ret_ref = (uint64_t)ret_var.inner;
25514 if (ret_var.is_owned) {
25520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
25521 LDKClosingTransaction this_arg_conv;
25522 this_arg_conv.inner = (void*)(this_arg & (~1));
25523 this_arg_conv.is_owned = false;
25524 LDKOutPoint funding_outpoint_conv;
25525 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25526 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25527 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25528 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
25529 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
25530 return (uint64_t)ret_conv;
25533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25534 LDKClosingTransaction this_arg_conv;
25535 this_arg_conv.inner = (void*)(this_arg & (~1));
25536 this_arg_conv.is_owned = false;
25537 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
25541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25542 LDKClosingTransaction this_arg_conv;
25543 this_arg_conv.inner = (void*)(this_arg & (~1));
25544 this_arg_conv.is_owned = false;
25545 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
25549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
25550 LDKClosingTransaction this_arg_conv;
25551 this_arg_conv.inner = (void*)(this_arg & (~1));
25552 this_arg_conv.is_owned = false;
25553 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
25554 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25555 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
25560 LDKClosingTransaction this_arg_conv;
25561 this_arg_conv.inner = (void*)(this_arg & (~1));
25562 this_arg_conv.is_owned = false;
25563 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
25564 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25565 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25570 LDKTrustedClosingTransaction this_obj_conv;
25571 this_obj_conv.inner = (void*)(this_obj & (~1));
25572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25573 TrustedClosingTransaction_free(this_obj_conv);
25576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
25577 LDKTrustedClosingTransaction this_arg_conv;
25578 this_arg_conv.inner = (void*)(this_arg & (~1));
25579 this_arg_conv.is_owned = false;
25580 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
25581 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25582 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25583 Transaction_free(ret_var);
25587 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) {
25588 LDKTrustedClosingTransaction this_arg_conv;
25589 this_arg_conv.inner = (void*)(this_arg & (~1));
25590 this_arg_conv.is_owned = false;
25591 LDKu8slice funding_redeemscript_ref;
25592 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25593 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25594 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25595 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
25596 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25600 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) {
25601 LDKTrustedClosingTransaction this_arg_conv;
25602 this_arg_conv.inner = (void*)(this_arg & (~1));
25603 this_arg_conv.is_owned = false;
25604 unsigned char funding_key_arr[32];
25605 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
25606 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
25607 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25608 LDKu8slice funding_redeemscript_ref;
25609 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25610 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25611 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25612 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
25613 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25618 LDKCommitmentTransaction this_obj_conv;
25619 this_obj_conv.inner = (void*)(this_obj & (~1));
25620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25621 CommitmentTransaction_free(this_obj_conv);
25624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25625 LDKCommitmentTransaction orig_conv;
25626 orig_conv.inner = (void*)(orig & (~1));
25627 orig_conv.is_owned = false;
25628 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
25629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25631 uint64_t ret_ref = (uint64_t)ret_var.inner;
25632 if (ret_var.is_owned) {
25638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25639 LDKCommitmentTransaction obj_conv;
25640 obj_conv.inner = (void*)(obj & (~1));
25641 obj_conv.is_owned = false;
25642 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
25643 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25644 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25645 CVec_u8Z_free(ret_var);
25649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25650 LDKu8slice ser_ref;
25651 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25652 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25653 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
25654 *ret_conv = CommitmentTransaction_read(ser_ref);
25655 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25656 return (uint64_t)ret_conv;
25659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
25660 LDKCommitmentTransaction this_arg_conv;
25661 this_arg_conv.inner = (void*)(this_arg & (~1));
25662 this_arg_conv.is_owned = false;
25663 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
25667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25668 LDKCommitmentTransaction this_arg_conv;
25669 this_arg_conv.inner = (void*)(this_arg & (~1));
25670 this_arg_conv.is_owned = false;
25671 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
25675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25676 LDKCommitmentTransaction this_arg_conv;
25677 this_arg_conv.inner = (void*)(this_arg & (~1));
25678 this_arg_conv.is_owned = false;
25679 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
25683 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
25684 LDKCommitmentTransaction this_arg_conv;
25685 this_arg_conv.inner = (void*)(this_arg & (~1));
25686 this_arg_conv.is_owned = false;
25687 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
25691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
25692 LDKCommitmentTransaction this_arg_conv;
25693 this_arg_conv.inner = (void*)(this_arg & (~1));
25694 this_arg_conv.is_owned = false;
25695 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
25696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25698 uint64_t ret_ref = (uint64_t)ret_var.inner;
25699 if (ret_var.is_owned) {
25705 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) {
25706 LDKCommitmentTransaction this_arg_conv;
25707 this_arg_conv.inner = (void*)(this_arg & (~1));
25708 this_arg_conv.is_owned = false;
25709 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25710 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25711 channel_parameters_conv.is_owned = false;
25712 LDKChannelPublicKeys broadcaster_keys_conv;
25713 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
25714 broadcaster_keys_conv.is_owned = false;
25715 LDKChannelPublicKeys countersignatory_keys_conv;
25716 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
25717 countersignatory_keys_conv.is_owned = false;
25718 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
25719 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
25720 return (uint64_t)ret_conv;
25723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25724 LDKTrustedCommitmentTransaction this_obj_conv;
25725 this_obj_conv.inner = (void*)(this_obj & (~1));
25726 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25727 TrustedCommitmentTransaction_free(this_obj_conv);
25730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
25731 LDKTrustedCommitmentTransaction this_arg_conv;
25732 this_arg_conv.inner = (void*)(this_arg & (~1));
25733 this_arg_conv.is_owned = false;
25734 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25735 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
25739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
25740 LDKTrustedCommitmentTransaction this_arg_conv;
25741 this_arg_conv.inner = (void*)(this_arg & (~1));
25742 this_arg_conv.is_owned = false;
25743 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
25744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25746 uint64_t ret_ref = (uint64_t)ret_var.inner;
25747 if (ret_var.is_owned) {
25753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
25754 LDKTrustedCommitmentTransaction this_arg_conv;
25755 this_arg_conv.inner = (void*)(this_arg & (~1));
25756 this_arg_conv.is_owned = false;
25757 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
25758 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25759 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25760 uint64_t ret_ref = (uint64_t)ret_var.inner;
25761 if (ret_var.is_owned) {
25767 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) {
25768 LDKTrustedCommitmentTransaction this_arg_conv;
25769 this_arg_conv.inner = (void*)(this_arg & (~1));
25770 this_arg_conv.is_owned = false;
25771 unsigned char htlc_base_key_arr[32];
25772 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
25773 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
25774 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
25775 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25776 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25777 channel_parameters_conv.is_owned = false;
25778 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
25779 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
25780 return (uint64_t)ret_conv;
25783 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) {
25784 LDKPublicKey broadcaster_payment_basepoint_ref;
25785 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
25786 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
25787 LDKPublicKey countersignatory_payment_basepoint_ref;
25788 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
25789 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
25790 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
25794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25795 LDKInitFeatures a_conv;
25796 a_conv.inner = (void*)(a & (~1));
25797 a_conv.is_owned = false;
25798 LDKInitFeatures b_conv;
25799 b_conv.inner = (void*)(b & (~1));
25800 b_conv.is_owned = false;
25801 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
25805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25806 LDKNodeFeatures a_conv;
25807 a_conv.inner = (void*)(a & (~1));
25808 a_conv.is_owned = false;
25809 LDKNodeFeatures b_conv;
25810 b_conv.inner = (void*)(b & (~1));
25811 b_conv.is_owned = false;
25812 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
25816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25817 LDKChannelFeatures a_conv;
25818 a_conv.inner = (void*)(a & (~1));
25819 a_conv.is_owned = false;
25820 LDKChannelFeatures b_conv;
25821 b_conv.inner = (void*)(b & (~1));
25822 b_conv.is_owned = false;
25823 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
25827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25828 LDKInvoiceFeatures a_conv;
25829 a_conv.inner = (void*)(a & (~1));
25830 a_conv.is_owned = false;
25831 LDKInvoiceFeatures b_conv;
25832 b_conv.inner = (void*)(b & (~1));
25833 b_conv.is_owned = false;
25834 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
25838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25839 LDKInitFeatures orig_conv;
25840 orig_conv.inner = (void*)(orig & (~1));
25841 orig_conv.is_owned = false;
25842 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
25843 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25844 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25845 uint64_t ret_ref = (uint64_t)ret_var.inner;
25846 if (ret_var.is_owned) {
25852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25853 LDKNodeFeatures orig_conv;
25854 orig_conv.inner = (void*)(orig & (~1));
25855 orig_conv.is_owned = false;
25856 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
25857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25859 uint64_t ret_ref = (uint64_t)ret_var.inner;
25860 if (ret_var.is_owned) {
25866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25867 LDKChannelFeatures orig_conv;
25868 orig_conv.inner = (void*)(orig & (~1));
25869 orig_conv.is_owned = false;
25870 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
25871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25873 uint64_t ret_ref = (uint64_t)ret_var.inner;
25874 if (ret_var.is_owned) {
25880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25881 LDKInvoiceFeatures orig_conv;
25882 orig_conv.inner = (void*)(orig & (~1));
25883 orig_conv.is_owned = false;
25884 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
25885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25887 uint64_t ret_ref = (uint64_t)ret_var.inner;
25888 if (ret_var.is_owned) {
25894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25895 LDKInitFeatures this_obj_conv;
25896 this_obj_conv.inner = (void*)(this_obj & (~1));
25897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25898 InitFeatures_free(this_obj_conv);
25901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25902 LDKNodeFeatures this_obj_conv;
25903 this_obj_conv.inner = (void*)(this_obj & (~1));
25904 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25905 NodeFeatures_free(this_obj_conv);
25908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25909 LDKChannelFeatures this_obj_conv;
25910 this_obj_conv.inner = (void*)(this_obj & (~1));
25911 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25912 ChannelFeatures_free(this_obj_conv);
25915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25916 LDKInvoiceFeatures this_obj_conv;
25917 this_obj_conv.inner = (void*)(this_obj & (~1));
25918 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25919 InvoiceFeatures_free(this_obj_conv);
25922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
25923 LDKInitFeatures ret_var = InitFeatures_empty();
25924 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25925 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25926 uint64_t ret_ref = (uint64_t)ret_var.inner;
25927 if (ret_var.is_owned) {
25933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
25934 LDKInitFeatures ret_var = InitFeatures_known();
25935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25937 uint64_t ret_ref = (uint64_t)ret_var.inner;
25938 if (ret_var.is_owned) {
25944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
25945 LDKInitFeatures this_arg_conv;
25946 this_arg_conv.inner = (void*)(this_arg & (~1));
25947 this_arg_conv.is_owned = false;
25948 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
25952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
25953 LDKNodeFeatures ret_var = NodeFeatures_empty();
25954 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25955 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25956 uint64_t ret_ref = (uint64_t)ret_var.inner;
25957 if (ret_var.is_owned) {
25963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
25964 LDKNodeFeatures ret_var = NodeFeatures_known();
25965 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25966 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25967 uint64_t ret_ref = (uint64_t)ret_var.inner;
25968 if (ret_var.is_owned) {
25974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
25975 LDKNodeFeatures this_arg_conv;
25976 this_arg_conv.inner = (void*)(this_arg & (~1));
25977 this_arg_conv.is_owned = false;
25978 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
25982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
25983 LDKChannelFeatures ret_var = ChannelFeatures_empty();
25984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25986 uint64_t ret_ref = (uint64_t)ret_var.inner;
25987 if (ret_var.is_owned) {
25993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
25994 LDKChannelFeatures ret_var = ChannelFeatures_known();
25995 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25996 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25997 uint64_t ret_ref = (uint64_t)ret_var.inner;
25998 if (ret_var.is_owned) {
26004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26005 LDKChannelFeatures this_arg_conv;
26006 this_arg_conv.inner = (void*)(this_arg & (~1));
26007 this_arg_conv.is_owned = false;
26008 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
26012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
26013 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
26014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26016 uint64_t ret_ref = (uint64_t)ret_var.inner;
26017 if (ret_var.is_owned) {
26023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
26024 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
26025 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26026 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26027 uint64_t ret_ref = (uint64_t)ret_var.inner;
26028 if (ret_var.is_owned) {
26034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26035 LDKInvoiceFeatures this_arg_conv;
26036 this_arg_conv.inner = (void*)(this_arg & (~1));
26037 this_arg_conv.is_owned = false;
26038 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
26042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26043 LDKInitFeatures this_arg_conv;
26044 this_arg_conv.inner = (void*)(this_arg & (~1));
26045 this_arg_conv.is_owned = false;
26046 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
26050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26051 LDKNodeFeatures this_arg_conv;
26052 this_arg_conv.inner = (void*)(this_arg & (~1));
26053 this_arg_conv.is_owned = false;
26054 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
26058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26059 LDKInvoiceFeatures this_arg_conv;
26060 this_arg_conv.inner = (void*)(this_arg & (~1));
26061 this_arg_conv.is_owned = false;
26062 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
26066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26067 LDKInitFeatures obj_conv;
26068 obj_conv.inner = (void*)(obj & (~1));
26069 obj_conv.is_owned = false;
26070 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
26071 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26072 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26073 CVec_u8Z_free(ret_var);
26077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26078 LDKNodeFeatures obj_conv;
26079 obj_conv.inner = (void*)(obj & (~1));
26080 obj_conv.is_owned = false;
26081 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
26082 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26083 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26084 CVec_u8Z_free(ret_var);
26088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26089 LDKChannelFeatures obj_conv;
26090 obj_conv.inner = (void*)(obj & (~1));
26091 obj_conv.is_owned = false;
26092 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
26093 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26094 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26095 CVec_u8Z_free(ret_var);
26099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26100 LDKInvoiceFeatures obj_conv;
26101 obj_conv.inner = (void*)(obj & (~1));
26102 obj_conv.is_owned = false;
26103 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
26104 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26105 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26106 CVec_u8Z_free(ret_var);
26110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26111 LDKu8slice ser_ref;
26112 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26113 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26114 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
26115 *ret_conv = InitFeatures_read(ser_ref);
26116 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26117 return (uint64_t)ret_conv;
26120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26121 LDKu8slice ser_ref;
26122 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26123 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26124 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
26125 *ret_conv = NodeFeatures_read(ser_ref);
26126 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26127 return (uint64_t)ret_conv;
26130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26131 LDKu8slice ser_ref;
26132 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26133 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26134 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
26135 *ret_conv = ChannelFeatures_read(ser_ref);
26136 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26137 return (uint64_t)ret_conv;
26140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26141 LDKu8slice ser_ref;
26142 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26143 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26144 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
26145 *ret_conv = InvoiceFeatures_read(ser_ref);
26146 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26147 return (uint64_t)ret_conv;
26150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26151 LDKShutdownScript this_obj_conv;
26152 this_obj_conv.inner = (void*)(this_obj & (~1));
26153 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26154 ShutdownScript_free(this_obj_conv);
26157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26158 LDKShutdownScript orig_conv;
26159 orig_conv.inner = (void*)(orig & (~1));
26160 orig_conv.is_owned = false;
26161 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
26162 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26163 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26164 uint64_t ret_ref = (uint64_t)ret_var.inner;
26165 if (ret_var.is_owned) {
26171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26172 LDKInvalidShutdownScript this_obj_conv;
26173 this_obj_conv.inner = (void*)(this_obj & (~1));
26174 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26175 InvalidShutdownScript_free(this_obj_conv);
26178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
26179 LDKInvalidShutdownScript this_ptr_conv;
26180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26181 this_ptr_conv.is_owned = false;
26182 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
26183 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26184 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26189 LDKInvalidShutdownScript this_ptr_conv;
26190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26191 this_ptr_conv.is_owned = false;
26192 LDKCVec_u8Z val_ref;
26193 val_ref.datalen = (*env)->GetArrayLength(env, val);
26194 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
26195 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26196 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
26199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
26200 LDKCVec_u8Z script_arg_ref;
26201 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
26202 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
26203 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
26204 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
26205 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26206 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26207 uint64_t ret_ref = (uint64_t)ret_var.inner;
26208 if (ret_var.is_owned) {
26214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
26215 LDKShutdownScript obj_conv;
26216 obj_conv.inner = (void*)(obj & (~1));
26217 obj_conv.is_owned = false;
26218 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
26219 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26220 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26221 CVec_u8Z_free(ret_var);
26225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26226 LDKu8slice ser_ref;
26227 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26228 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26229 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26230 *ret_conv = ShutdownScript_read(ser_ref);
26231 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26232 return (uint64_t)ret_conv;
26235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
26236 unsigned char pubkey_hash_arr[20];
26237 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
26238 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
26239 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
26240 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
26241 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26242 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26243 uint64_t ret_ref = (uint64_t)ret_var.inner;
26244 if (ret_var.is_owned) {
26250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
26251 unsigned char script_hash_arr[20];
26252 CHECK((*env)->GetArrayLength(env, script_hash) == 20);
26253 (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
26254 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
26255 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
26256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26258 uint64_t ret_ref = (uint64_t)ret_var.inner;
26259 if (ret_var.is_owned) {
26265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
26266 unsigned char pubkey_hash_arr[20];
26267 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
26268 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
26269 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
26270 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
26271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26273 uint64_t ret_ref = (uint64_t)ret_var.inner;
26274 if (ret_var.is_owned) {
26280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
26281 unsigned char script_hash_arr[32];
26282 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
26283 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
26284 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
26285 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
26286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26288 uint64_t ret_ref = (uint64_t)ret_var.inner;
26289 if (ret_var.is_owned) {
26295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
26296 LDKu8slice program_ref;
26297 program_ref.datalen = (*env)->GetArrayLength(env, program);
26298 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
26299 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26300 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
26301 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
26302 return (uint64_t)ret_conv;
26305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
26306 LDKShutdownScript this_arg_conv;
26307 this_arg_conv.inner = (void*)(this_arg & (~1));
26308 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26309 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
26310 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
26311 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26312 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26313 CVec_u8Z_free(ret_var);
26317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
26318 LDKShutdownScript this_arg_conv;
26319 this_arg_conv.inner = (void*)(this_arg & (~1));
26320 this_arg_conv.is_owned = false;
26321 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26322 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
26326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
26327 LDKShutdownScript this_arg_conv;
26328 this_arg_conv.inner = (void*)(this_arg & (~1));
26329 this_arg_conv.is_owned = false;
26330 LDKInitFeatures features_conv;
26331 features_conv.inner = (void*)(features & (~1));
26332 features_conv.is_owned = false;
26333 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
26337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26338 if ((this_ptr & 1) != 0) return;
26339 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
26340 FREE((void*)this_ptr);
26341 CustomMessageReader_free(this_ptr_conv);
26344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26345 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
26346 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
26347 *ret_ret = Type_clone(orig_conv);
26348 return (uint64_t)ret_ret;
26351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26352 if ((this_ptr & 1) != 0) return;
26353 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
26354 FREE((void*)this_ptr);
26355 Type_free(this_ptr_conv);
26358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26359 LDKRouteHop this_obj_conv;
26360 this_obj_conv.inner = (void*)(this_obj & (~1));
26361 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26362 RouteHop_free(this_obj_conv);
26365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26366 LDKRouteHop this_ptr_conv;
26367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26368 this_ptr_conv.is_owned = false;
26369 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26370 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
26374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26375 LDKRouteHop this_ptr_conv;
26376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26377 this_ptr_conv.is_owned = false;
26378 LDKPublicKey val_ref;
26379 CHECK((*env)->GetArrayLength(env, val) == 33);
26380 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26381 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
26384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26385 LDKRouteHop this_ptr_conv;
26386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26387 this_ptr_conv.is_owned = false;
26388 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
26389 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26390 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26391 uint64_t ret_ref = (uint64_t)ret_var.inner;
26392 if (ret_var.is_owned) {
26398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26399 LDKRouteHop this_ptr_conv;
26400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26401 this_ptr_conv.is_owned = false;
26402 LDKNodeFeatures val_conv;
26403 val_conv.inner = (void*)(val & (~1));
26404 val_conv.is_owned = (val & 1) || (val == 0);
26405 val_conv = NodeFeatures_clone(&val_conv);
26406 RouteHop_set_node_features(&this_ptr_conv, val_conv);
26409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26410 LDKRouteHop this_ptr_conv;
26411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26412 this_ptr_conv.is_owned = false;
26413 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
26417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26418 LDKRouteHop this_ptr_conv;
26419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26420 this_ptr_conv.is_owned = false;
26421 RouteHop_set_short_channel_id(&this_ptr_conv, val);
26424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26425 LDKRouteHop this_ptr_conv;
26426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26427 this_ptr_conv.is_owned = false;
26428 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
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 void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26439 LDKRouteHop this_ptr_conv;
26440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26441 this_ptr_conv.is_owned = false;
26442 LDKChannelFeatures val_conv;
26443 val_conv.inner = (void*)(val & (~1));
26444 val_conv.is_owned = (val & 1) || (val == 0);
26445 val_conv = ChannelFeatures_clone(&val_conv);
26446 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
26449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26450 LDKRouteHop this_ptr_conv;
26451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26452 this_ptr_conv.is_owned = false;
26453 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
26457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26458 LDKRouteHop this_ptr_conv;
26459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26460 this_ptr_conv.is_owned = false;
26461 RouteHop_set_fee_msat(&this_ptr_conv, val);
26464 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26465 LDKRouteHop this_ptr_conv;
26466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26467 this_ptr_conv.is_owned = false;
26468 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
26472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26473 LDKRouteHop this_ptr_conv;
26474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26475 this_ptr_conv.is_owned = false;
26476 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26479 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) {
26480 LDKPublicKey pubkey_arg_ref;
26481 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
26482 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
26483 LDKNodeFeatures node_features_arg_conv;
26484 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
26485 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
26486 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
26487 LDKChannelFeatures channel_features_arg_conv;
26488 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
26489 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
26490 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
26491 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);
26492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26494 uint64_t ret_ref = (uint64_t)ret_var.inner;
26495 if (ret_var.is_owned) {
26501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26502 LDKRouteHop orig_conv;
26503 orig_conv.inner = (void*)(orig & (~1));
26504 orig_conv.is_owned = false;
26505 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
26506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26508 uint64_t ret_ref = (uint64_t)ret_var.inner;
26509 if (ret_var.is_owned) {
26515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
26516 LDKRouteHop o_conv;
26517 o_conv.inner = (void*)(o & (~1));
26518 o_conv.is_owned = false;
26519 int64_t ret_val = RouteHop_hash(&o_conv);
26523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26524 LDKRouteHop a_conv;
26525 a_conv.inner = (void*)(a & (~1));
26526 a_conv.is_owned = false;
26527 LDKRouteHop b_conv;
26528 b_conv.inner = (void*)(b & (~1));
26529 b_conv.is_owned = false;
26530 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
26534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
26535 LDKRouteHop obj_conv;
26536 obj_conv.inner = (void*)(obj & (~1));
26537 obj_conv.is_owned = false;
26538 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
26539 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26540 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26541 CVec_u8Z_free(ret_var);
26545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26546 LDKu8slice ser_ref;
26547 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26548 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26549 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26550 *ret_conv = RouteHop_read(ser_ref);
26551 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26552 return (uint64_t)ret_conv;
26555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26556 LDKRoute this_obj_conv;
26557 this_obj_conv.inner = (void*)(this_obj & (~1));
26558 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26559 Route_free(this_obj_conv);
26562 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26563 LDKRoute this_ptr_conv;
26564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26565 this_ptr_conv.is_owned = false;
26566 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
26567 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
26569 for (size_t m = 0; m < ret_var.datalen; m++) {
26570 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
26571 int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
26572 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
26573 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
26574 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
26575 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26576 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26577 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
26578 if (ret_conv_12_conv_10_var.is_owned) {
26579 ret_conv_12_conv_10_ref |= 1;
26581 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
26583 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
26584 FREE(ret_conv_12_var.data);
26585 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
26587 FREE(ret_var.data);
26591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
26592 LDKRoute this_ptr_conv;
26593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26594 this_ptr_conv.is_owned = false;
26595 LDKCVec_CVec_RouteHopZZ val_constr;
26596 val_constr.datalen = (*env)->GetArrayLength(env, val);
26597 if (val_constr.datalen > 0)
26598 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26600 val_constr.data = NULL;
26601 for (size_t m = 0; m < val_constr.datalen; m++) {
26602 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
26603 LDKCVec_RouteHopZ val_conv_12_constr;
26604 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
26605 if (val_conv_12_constr.datalen > 0)
26606 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26608 val_conv_12_constr.data = NULL;
26609 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
26610 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
26611 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
26612 LDKRouteHop val_conv_12_conv_10_conv;
26613 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
26614 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
26615 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
26616 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
26618 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
26619 val_constr.data[m] = val_conv_12_constr;
26621 Route_set_paths(&this_ptr_conv, val_constr);
26624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
26625 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
26626 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
26627 if (paths_arg_constr.datalen > 0)
26628 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26630 paths_arg_constr.data = NULL;
26631 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
26632 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
26633 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
26634 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
26635 if (paths_arg_conv_12_constr.datalen > 0)
26636 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26638 paths_arg_conv_12_constr.data = NULL;
26639 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
26640 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
26641 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
26642 LDKRouteHop paths_arg_conv_12_conv_10_conv;
26643 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
26644 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
26645 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
26646 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
26648 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
26649 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
26651 LDKRoute ret_var = Route_new(paths_arg_constr);
26652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26654 uint64_t ret_ref = (uint64_t)ret_var.inner;
26655 if (ret_var.is_owned) {
26661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26662 LDKRoute orig_conv;
26663 orig_conv.inner = (void*)(orig & (~1));
26664 orig_conv.is_owned = false;
26665 LDKRoute ret_var = Route_clone(&orig_conv);
26666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26668 uint64_t ret_ref = (uint64_t)ret_var.inner;
26669 if (ret_var.is_owned) {
26675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
26677 o_conv.inner = (void*)(o & (~1));
26678 o_conv.is_owned = false;
26679 int64_t ret_val = Route_hash(&o_conv);
26683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26685 a_conv.inner = (void*)(a & (~1));
26686 a_conv.is_owned = false;
26688 b_conv.inner = (void*)(b & (~1));
26689 b_conv.is_owned = false;
26690 jboolean ret_val = Route_eq(&a_conv, &b_conv);
26694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
26695 LDKRoute this_arg_conv;
26696 this_arg_conv.inner = (void*)(this_arg & (~1));
26697 this_arg_conv.is_owned = false;
26698 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
26702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
26703 LDKRoute this_arg_conv;
26704 this_arg_conv.inner = (void*)(this_arg & (~1));
26705 this_arg_conv.is_owned = false;
26706 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
26710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
26712 obj_conv.inner = (void*)(obj & (~1));
26713 obj_conv.is_owned = false;
26714 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
26715 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26716 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26717 CVec_u8Z_free(ret_var);
26721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26722 LDKu8slice ser_ref;
26723 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26724 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26725 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26726 *ret_conv = Route_read(ser_ref);
26727 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26728 return (uint64_t)ret_conv;
26731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26732 LDKRouteHint this_obj_conv;
26733 this_obj_conv.inner = (void*)(this_obj & (~1));
26734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26735 RouteHint_free(this_obj_conv);
26738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26739 LDKRouteHint orig_conv;
26740 orig_conv.inner = (void*)(orig & (~1));
26741 orig_conv.is_owned = false;
26742 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
26743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26745 uint64_t ret_ref = (uint64_t)ret_var.inner;
26746 if (ret_var.is_owned) {
26752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26753 LDKRouteHint o_conv;
26754 o_conv.inner = (void*)(o & (~1));
26755 o_conv.is_owned = false;
26756 int64_t ret_val = RouteHint_hash(&o_conv);
26760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26761 LDKRouteHint a_conv;
26762 a_conv.inner = (void*)(a & (~1));
26763 a_conv.is_owned = false;
26764 LDKRouteHint b_conv;
26765 b_conv.inner = (void*)(b & (~1));
26766 b_conv.is_owned = false;
26767 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
26771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26772 LDKRouteHintHop this_obj_conv;
26773 this_obj_conv.inner = (void*)(this_obj & (~1));
26774 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26775 RouteHintHop_free(this_obj_conv);
26778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26779 LDKRouteHintHop this_ptr_conv;
26780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26781 this_ptr_conv.is_owned = false;
26782 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26783 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
26787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26788 LDKRouteHintHop this_ptr_conv;
26789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26790 this_ptr_conv.is_owned = false;
26791 LDKPublicKey val_ref;
26792 CHECK((*env)->GetArrayLength(env, val) == 33);
26793 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26794 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
26797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26798 LDKRouteHintHop this_ptr_conv;
26799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26800 this_ptr_conv.is_owned = false;
26801 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
26805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26806 LDKRouteHintHop this_ptr_conv;
26807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26808 this_ptr_conv.is_owned = false;
26809 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
26812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
26813 LDKRouteHintHop this_ptr_conv;
26814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26815 this_ptr_conv.is_owned = false;
26816 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
26817 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26818 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26819 uint64_t ret_ref = (uint64_t)ret_var.inner;
26820 if (ret_var.is_owned) {
26826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26827 LDKRouteHintHop this_ptr_conv;
26828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26829 this_ptr_conv.is_owned = false;
26830 LDKRoutingFees val_conv;
26831 val_conv.inner = (void*)(val & (~1));
26832 val_conv.is_owned = (val & 1) || (val == 0);
26833 val_conv = RoutingFees_clone(&val_conv);
26834 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
26837 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26838 LDKRouteHintHop this_ptr_conv;
26839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26840 this_ptr_conv.is_owned = false;
26841 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
26845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26846 LDKRouteHintHop this_ptr_conv;
26847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26848 this_ptr_conv.is_owned = false;
26849 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26853 LDKRouteHintHop this_ptr_conv;
26854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26855 this_ptr_conv.is_owned = false;
26856 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26857 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
26858 uint64_t ret_ref = (uint64_t)ret_copy;
26862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26863 LDKRouteHintHop this_ptr_conv;
26864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26865 this_ptr_conv.is_owned = false;
26866 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
26867 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26868 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
26871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26872 LDKRouteHintHop this_ptr_conv;
26873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26874 this_ptr_conv.is_owned = false;
26875 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26876 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
26877 uint64_t ret_ref = (uint64_t)ret_copy;
26881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26882 LDKRouteHintHop this_ptr_conv;
26883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26884 this_ptr_conv.is_owned = false;
26885 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
26886 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26887 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
26890 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) {
26891 LDKPublicKey src_node_id_arg_ref;
26892 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
26893 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
26894 LDKRoutingFees fees_arg_conv;
26895 fees_arg_conv.inner = (void*)(fees_arg & (~1));
26896 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
26897 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
26898 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
26899 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
26900 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
26901 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
26902 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);
26903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26905 uint64_t ret_ref = (uint64_t)ret_var.inner;
26906 if (ret_var.is_owned) {
26912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26913 LDKRouteHintHop orig_conv;
26914 orig_conv.inner = (void*)(orig & (~1));
26915 orig_conv.is_owned = false;
26916 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
26917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26919 uint64_t ret_ref = (uint64_t)ret_var.inner;
26920 if (ret_var.is_owned) {
26926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
26927 LDKRouteHintHop o_conv;
26928 o_conv.inner = (void*)(o & (~1));
26929 o_conv.is_owned = false;
26930 int64_t ret_val = RouteHintHop_hash(&o_conv);
26934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26935 LDKRouteHintHop a_conv;
26936 a_conv.inner = (void*)(a & (~1));
26937 a_conv.is_owned = false;
26938 LDKRouteHintHop b_conv;
26939 b_conv.inner = (void*)(b & (~1));
26940 b_conv.is_owned = false;
26941 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
26945 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) {
26946 LDKPublicKey our_node_id_ref;
26947 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
26948 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
26949 LDKNetworkGraph network_conv;
26950 network_conv.inner = (void*)(network & (~1));
26951 network_conv.is_owned = false;
26952 LDKPublicKey payee_ref;
26953 CHECK((*env)->GetArrayLength(env, payee) == 33);
26954 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
26955 LDKCVec_ChannelDetailsZ first_hops_constr;
26956 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
26957 if (first_hops != NULL) {
26958 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
26959 if (first_hops_constr.datalen > 0)
26960 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26962 first_hops_constr.data = NULL;
26963 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
26964 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
26965 int64_t first_hops_conv_16 = first_hops_vals[q];
26966 LDKChannelDetails first_hops_conv_16_conv;
26967 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
26968 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
26969 first_hops_constr.data[q] = first_hops_conv_16_conv;
26971 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
26972 first_hops_ptr = &first_hops_constr;
26974 LDKCVec_RouteHintZ last_hops_constr;
26975 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
26976 if (last_hops_constr.datalen > 0)
26977 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26979 last_hops_constr.data = NULL;
26980 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
26981 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
26982 int64_t last_hops_conv_11 = last_hops_vals[l];
26983 LDKRouteHint last_hops_conv_11_conv;
26984 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
26985 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
26986 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
26987 last_hops_constr.data[l] = last_hops_conv_11_conv;
26989 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
26990 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
26991 if (logger_conv.free == LDKLogger_JCalls_free) {
26992 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26993 LDKLogger_JCalls_cloned(&logger_conv);
26995 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26996 *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);
26997 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
26998 return (uint64_t)ret_conv;
27001 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) {
27002 LDKPublicKey our_node_id_ref;
27003 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
27004 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
27005 LDKNetworkGraph network_conv;
27006 network_conv.inner = (void*)(network & (~1));
27007 network_conv.is_owned = false;
27008 LDKPublicKey payee_ref;
27009 CHECK((*env)->GetArrayLength(env, payee) == 33);
27010 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
27011 LDKInvoiceFeatures payee_features_conv;
27012 payee_features_conv.inner = (void*)(payee_features & (~1));
27013 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
27014 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
27015 LDKCVec_ChannelDetailsZ first_hops_constr;
27016 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
27017 if (first_hops != NULL) {
27018 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
27019 if (first_hops_constr.datalen > 0)
27020 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27022 first_hops_constr.data = NULL;
27023 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
27024 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
27025 int64_t first_hops_conv_16 = first_hops_vals[q];
27026 LDKChannelDetails first_hops_conv_16_conv;
27027 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
27028 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
27029 first_hops_constr.data[q] = first_hops_conv_16_conv;
27031 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
27032 first_hops_ptr = &first_hops_constr;
27034 LDKCVec_RouteHintZ last_hops_constr;
27035 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
27036 if (last_hops_constr.datalen > 0)
27037 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
27039 last_hops_constr.data = NULL;
27040 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
27041 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
27042 int64_t last_hops_conv_11 = last_hops_vals[l];
27043 LDKRouteHint last_hops_conv_11_conv;
27044 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
27045 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
27046 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
27047 last_hops_constr.data[l] = last_hops_conv_11_conv;
27049 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
27050 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27051 if (logger_conv.free == LDKLogger_JCalls_free) {
27052 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27053 LDKLogger_JCalls_cloned(&logger_conv);
27055 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
27056 *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);
27057 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
27058 return (uint64_t)ret_conv;
27061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27062 LDKNetworkGraph this_obj_conv;
27063 this_obj_conv.inner = (void*)(this_obj & (~1));
27064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27065 NetworkGraph_free(this_obj_conv);
27068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27069 LDKReadOnlyNetworkGraph this_obj_conv;
27070 this_obj_conv.inner = (void*)(this_obj & (~1));
27071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27072 ReadOnlyNetworkGraph_free(this_obj_conv);
27075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27076 if ((this_ptr & 1) != 0) return;
27077 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
27078 FREE((void*)this_ptr);
27079 NetworkUpdate_free(this_ptr_conv);
27082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27083 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
27084 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27085 *ret_copy = NetworkUpdate_clone(orig_conv);
27086 uint64_t ret_ref = (uint64_t)ret_copy;
27090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
27091 LDKChannelUpdate msg_conv;
27092 msg_conv.inner = (void*)(msg & (~1));
27093 msg_conv.is_owned = (msg & 1) || (msg == 0);
27094 msg_conv = ChannelUpdate_clone(&msg_conv);
27095 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27096 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
27097 uint64_t ret_ref = (uint64_t)ret_copy;
27101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
27102 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27103 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
27104 uint64_t ret_ref = (uint64_t)ret_copy;
27108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
27109 LDKPublicKey node_id_ref;
27110 CHECK((*env)->GetArrayLength(env, node_id) == 33);
27111 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27112 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27113 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
27114 uint64_t ret_ref = (uint64_t)ret_copy;
27118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27119 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
27120 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
27121 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27122 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27123 CVec_u8Z_free(ret_var);
27127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27128 LDKNetGraphMsgHandler this_arg_conv;
27129 this_arg_conv.inner = (void*)(this_arg & (~1));
27130 this_arg_conv.is_owned = false;
27131 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
27132 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
27133 return (uint64_t)ret_ret;
27136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27137 LDKNetGraphMsgHandler this_obj_conv;
27138 this_obj_conv.inner = (void*)(this_obj & (~1));
27139 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27140 NetGraphMsgHandler_free(this_obj_conv);
27143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) {
27144 LDKNetGraphMsgHandler this_ptr_conv;
27145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27146 this_ptr_conv.is_owned = false;
27147 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
27148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27150 uint64_t ret_ref = (uint64_t)ret_var.inner;
27151 if (ret_var.is_owned) {
27157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27158 LDKNetGraphMsgHandler this_ptr_conv;
27159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27160 this_ptr_conv.is_owned = false;
27161 LDKNetworkGraph val_conv;
27162 val_conv.inner = (void*)(val & (~1));
27163 val_conv.is_owned = (val & 1) || (val == 0);
27164 // Warning: we need a move here but no clone is available for LDKNetworkGraph
27165 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
27168 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) {
27169 LDKNetworkGraph network_graph_conv;
27170 network_graph_conv.inner = (void*)(network_graph & (~1));
27171 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
27172 // Warning: we need a move here but no clone is available for LDKNetworkGraph
27173 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27174 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27175 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27176 // Manually implement clone for Java trait instances
27177 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27179 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27182 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27183 if (logger_conv.free == LDKLogger_JCalls_free) {
27184 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27185 LDKLogger_JCalls_cloned(&logger_conv);
27187 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
27188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27190 uint64_t ret_ref = (uint64_t)ret_var.inner;
27191 if (ret_var.is_owned) {
27197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
27198 LDKNetGraphMsgHandler this_arg_conv;
27199 this_arg_conv.inner = (void*)(this_arg & (~1));
27200 this_arg_conv.is_owned = false;
27201 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27202 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27203 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27204 // Manually implement clone for Java trait instances
27205 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27206 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27207 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27210 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
27213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27214 LDKNetGraphMsgHandler this_arg_conv;
27215 this_arg_conv.inner = (void*)(this_arg & (~1));
27216 this_arg_conv.is_owned = false;
27217 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
27218 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
27219 return (uint64_t)ret_ret;
27222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27223 LDKNetGraphMsgHandler this_arg_conv;
27224 this_arg_conv.inner = (void*)(this_arg & (~1));
27225 this_arg_conv.is_owned = false;
27226 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27227 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
27228 return (uint64_t)ret_ret;
27231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27232 LDKDirectionalChannelInfo this_obj_conv;
27233 this_obj_conv.inner = (void*)(this_obj & (~1));
27234 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27235 DirectionalChannelInfo_free(this_obj_conv);
27238 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
27239 LDKDirectionalChannelInfo this_ptr_conv;
27240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27241 this_ptr_conv.is_owned = false;
27242 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
27246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27247 LDKDirectionalChannelInfo this_ptr_conv;
27248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27249 this_ptr_conv.is_owned = false;
27250 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
27253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
27254 LDKDirectionalChannelInfo this_ptr_conv;
27255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27256 this_ptr_conv.is_owned = false;
27257 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
27261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27262 LDKDirectionalChannelInfo this_ptr_conv;
27263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27264 this_ptr_conv.is_owned = false;
27265 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
27268 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27269 LDKDirectionalChannelInfo this_ptr_conv;
27270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27271 this_ptr_conv.is_owned = false;
27272 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
27276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27277 LDKDirectionalChannelInfo this_ptr_conv;
27278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27279 this_ptr_conv.is_owned = false;
27280 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27284 LDKDirectionalChannelInfo this_ptr_conv;
27285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27286 this_ptr_conv.is_owned = false;
27287 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
27291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27292 LDKDirectionalChannelInfo this_ptr_conv;
27293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27294 this_ptr_conv.is_owned = false;
27295 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
27298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27299 LDKDirectionalChannelInfo this_ptr_conv;
27300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27301 this_ptr_conv.is_owned = false;
27302 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27303 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
27304 uint64_t ret_ref = (uint64_t)ret_copy;
27308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27309 LDKDirectionalChannelInfo this_ptr_conv;
27310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27311 this_ptr_conv.is_owned = false;
27312 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27313 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27314 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
27317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
27318 LDKDirectionalChannelInfo this_ptr_conv;
27319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27320 this_ptr_conv.is_owned = false;
27321 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
27322 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27323 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27324 uint64_t ret_ref = (uint64_t)ret_var.inner;
27325 if (ret_var.is_owned) {
27331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27332 LDKDirectionalChannelInfo this_ptr_conv;
27333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27334 this_ptr_conv.is_owned = false;
27335 LDKRoutingFees val_conv;
27336 val_conv.inner = (void*)(val & (~1));
27337 val_conv.is_owned = (val & 1) || (val == 0);
27338 val_conv = RoutingFees_clone(&val_conv);
27339 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
27342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27343 LDKDirectionalChannelInfo this_ptr_conv;
27344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27345 this_ptr_conv.is_owned = false;
27346 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
27347 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27348 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27349 uint64_t ret_ref = (uint64_t)ret_var.inner;
27350 if (ret_var.is_owned) {
27356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27357 LDKDirectionalChannelInfo this_ptr_conv;
27358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27359 this_ptr_conv.is_owned = false;
27360 LDKChannelUpdate val_conv;
27361 val_conv.inner = (void*)(val & (~1));
27362 val_conv.is_owned = (val & 1) || (val == 0);
27363 val_conv = ChannelUpdate_clone(&val_conv);
27364 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
27367 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) {
27368 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
27369 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
27370 LDKRoutingFees fees_arg_conv;
27371 fees_arg_conv.inner = (void*)(fees_arg & (~1));
27372 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
27373 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
27374 LDKChannelUpdate last_update_message_arg_conv;
27375 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
27376 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
27377 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
27378 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);
27379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27381 uint64_t ret_ref = (uint64_t)ret_var.inner;
27382 if (ret_var.is_owned) {
27388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27389 LDKDirectionalChannelInfo orig_conv;
27390 orig_conv.inner = (void*)(orig & (~1));
27391 orig_conv.is_owned = false;
27392 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
27393 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27394 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27395 uint64_t ret_ref = (uint64_t)ret_var.inner;
27396 if (ret_var.is_owned) {
27402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27403 LDKDirectionalChannelInfo obj_conv;
27404 obj_conv.inner = (void*)(obj & (~1));
27405 obj_conv.is_owned = false;
27406 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
27407 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27408 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27409 CVec_u8Z_free(ret_var);
27413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27414 LDKu8slice ser_ref;
27415 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27416 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27417 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
27418 *ret_conv = DirectionalChannelInfo_read(ser_ref);
27419 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27420 return (uint64_t)ret_conv;
27423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27424 LDKChannelInfo this_obj_conv;
27425 this_obj_conv.inner = (void*)(this_obj & (~1));
27426 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27427 ChannelInfo_free(this_obj_conv);
27430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27431 LDKChannelInfo this_ptr_conv;
27432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27433 this_ptr_conv.is_owned = false;
27434 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
27435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27437 uint64_t ret_ref = (uint64_t)ret_var.inner;
27438 if (ret_var.is_owned) {
27444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27445 LDKChannelInfo this_ptr_conv;
27446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27447 this_ptr_conv.is_owned = false;
27448 LDKChannelFeatures val_conv;
27449 val_conv.inner = (void*)(val & (~1));
27450 val_conv.is_owned = (val & 1) || (val == 0);
27451 val_conv = ChannelFeatures_clone(&val_conv);
27452 ChannelInfo_set_features(&this_ptr_conv, val_conv);
27455 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27456 LDKChannelInfo this_ptr_conv;
27457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27458 this_ptr_conv.is_owned = false;
27459 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27460 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
27464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27465 LDKChannelInfo this_ptr_conv;
27466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27467 this_ptr_conv.is_owned = false;
27468 LDKPublicKey val_ref;
27469 CHECK((*env)->GetArrayLength(env, val) == 33);
27470 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27471 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
27474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27475 LDKChannelInfo this_ptr_conv;
27476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27477 this_ptr_conv.is_owned = false;
27478 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
27479 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27480 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27481 uint64_t ret_ref = (uint64_t)ret_var.inner;
27482 if (ret_var.is_owned) {
27488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27489 LDKChannelInfo this_ptr_conv;
27490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27491 this_ptr_conv.is_owned = false;
27492 LDKDirectionalChannelInfo val_conv;
27493 val_conv.inner = (void*)(val & (~1));
27494 val_conv.is_owned = (val & 1) || (val == 0);
27495 val_conv = DirectionalChannelInfo_clone(&val_conv);
27496 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
27499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27500 LDKChannelInfo this_ptr_conv;
27501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27502 this_ptr_conv.is_owned = false;
27503 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27504 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
27508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27509 LDKChannelInfo this_ptr_conv;
27510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27511 this_ptr_conv.is_owned = false;
27512 LDKPublicKey val_ref;
27513 CHECK((*env)->GetArrayLength(env, val) == 33);
27514 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27515 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
27518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27519 LDKChannelInfo this_ptr_conv;
27520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27521 this_ptr_conv.is_owned = false;
27522 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
27523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27525 uint64_t ret_ref = (uint64_t)ret_var.inner;
27526 if (ret_var.is_owned) {
27532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27533 LDKChannelInfo this_ptr_conv;
27534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27535 this_ptr_conv.is_owned = false;
27536 LDKDirectionalChannelInfo val_conv;
27537 val_conv.inner = (void*)(val & (~1));
27538 val_conv.is_owned = (val & 1) || (val == 0);
27539 val_conv = DirectionalChannelInfo_clone(&val_conv);
27540 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
27543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
27544 LDKChannelInfo this_ptr_conv;
27545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27546 this_ptr_conv.is_owned = false;
27547 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27548 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
27549 uint64_t ret_ref = (uint64_t)ret_copy;
27553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27554 LDKChannelInfo this_ptr_conv;
27555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27556 this_ptr_conv.is_owned = false;
27557 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27558 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27559 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
27562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27563 LDKChannelInfo this_ptr_conv;
27564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27565 this_ptr_conv.is_owned = false;
27566 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
27567 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27568 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27569 uint64_t ret_ref = (uint64_t)ret_var.inner;
27570 if (ret_var.is_owned) {
27576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27577 LDKChannelInfo this_ptr_conv;
27578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27579 this_ptr_conv.is_owned = false;
27580 LDKChannelAnnouncement val_conv;
27581 val_conv.inner = (void*)(val & (~1));
27582 val_conv.is_owned = (val & 1) || (val == 0);
27583 val_conv = ChannelAnnouncement_clone(&val_conv);
27584 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
27587 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) {
27588 LDKChannelFeatures features_arg_conv;
27589 features_arg_conv.inner = (void*)(features_arg & (~1));
27590 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27591 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
27592 LDKPublicKey node_one_arg_ref;
27593 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
27594 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
27595 LDKDirectionalChannelInfo one_to_two_arg_conv;
27596 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
27597 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
27598 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
27599 LDKPublicKey node_two_arg_ref;
27600 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
27601 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
27602 LDKDirectionalChannelInfo two_to_one_arg_conv;
27603 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
27604 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
27605 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
27606 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
27607 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
27608 LDKChannelAnnouncement announcement_message_arg_conv;
27609 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
27610 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
27611 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
27612 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);
27613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27615 uint64_t ret_ref = (uint64_t)ret_var.inner;
27616 if (ret_var.is_owned) {
27622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27623 LDKChannelInfo orig_conv;
27624 orig_conv.inner = (void*)(orig & (~1));
27625 orig_conv.is_owned = false;
27626 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
27627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27629 uint64_t ret_ref = (uint64_t)ret_var.inner;
27630 if (ret_var.is_owned) {
27636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27637 LDKChannelInfo obj_conv;
27638 obj_conv.inner = (void*)(obj & (~1));
27639 obj_conv.is_owned = false;
27640 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
27641 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27642 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27643 CVec_u8Z_free(ret_var);
27647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27648 LDKu8slice ser_ref;
27649 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27650 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27651 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
27652 *ret_conv = ChannelInfo_read(ser_ref);
27653 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27654 return (uint64_t)ret_conv;
27657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27658 LDKRoutingFees this_obj_conv;
27659 this_obj_conv.inner = (void*)(this_obj & (~1));
27660 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27661 RoutingFees_free(this_obj_conv);
27664 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27665 LDKRoutingFees this_ptr_conv;
27666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27667 this_ptr_conv.is_owned = false;
27668 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
27672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27673 LDKRoutingFees this_ptr_conv;
27674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27675 this_ptr_conv.is_owned = false;
27676 RoutingFees_set_base_msat(&this_ptr_conv, val);
27679 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27680 LDKRoutingFees this_ptr_conv;
27681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27682 this_ptr_conv.is_owned = false;
27683 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
27687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27688 LDKRoutingFees this_ptr_conv;
27689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27690 this_ptr_conv.is_owned = false;
27691 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
27694 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) {
27695 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
27696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27698 uint64_t ret_ref = (uint64_t)ret_var.inner;
27699 if (ret_var.is_owned) {
27705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27706 LDKRoutingFees a_conv;
27707 a_conv.inner = (void*)(a & (~1));
27708 a_conv.is_owned = false;
27709 LDKRoutingFees b_conv;
27710 b_conv.inner = (void*)(b & (~1));
27711 b_conv.is_owned = false;
27712 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
27716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27717 LDKRoutingFees orig_conv;
27718 orig_conv.inner = (void*)(orig & (~1));
27719 orig_conv.is_owned = false;
27720 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
27721 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27722 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27723 uint64_t ret_ref = (uint64_t)ret_var.inner;
27724 if (ret_var.is_owned) {
27730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
27731 LDKRoutingFees o_conv;
27732 o_conv.inner = (void*)(o & (~1));
27733 o_conv.is_owned = false;
27734 int64_t ret_val = RoutingFees_hash(&o_conv);
27738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
27739 LDKRoutingFees obj_conv;
27740 obj_conv.inner = (void*)(obj & (~1));
27741 obj_conv.is_owned = false;
27742 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
27743 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27744 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27745 CVec_u8Z_free(ret_var);
27749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27750 LDKu8slice ser_ref;
27751 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27752 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27753 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
27754 *ret_conv = RoutingFees_read(ser_ref);
27755 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27756 return (uint64_t)ret_conv;
27759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27760 LDKNodeAnnouncementInfo this_obj_conv;
27761 this_obj_conv.inner = (void*)(this_obj & (~1));
27762 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27763 NodeAnnouncementInfo_free(this_obj_conv);
27766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27767 LDKNodeAnnouncementInfo this_ptr_conv;
27768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27769 this_ptr_conv.is_owned = false;
27770 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
27771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27773 uint64_t ret_ref = (uint64_t)ret_var.inner;
27774 if (ret_var.is_owned) {
27780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27781 LDKNodeAnnouncementInfo this_ptr_conv;
27782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27783 this_ptr_conv.is_owned = false;
27784 LDKNodeFeatures val_conv;
27785 val_conv.inner = (void*)(val & (~1));
27786 val_conv.is_owned = (val & 1) || (val == 0);
27787 val_conv = NodeFeatures_clone(&val_conv);
27788 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
27791 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
27792 LDKNodeAnnouncementInfo this_ptr_conv;
27793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27794 this_ptr_conv.is_owned = false;
27795 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
27799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27800 LDKNodeAnnouncementInfo this_ptr_conv;
27801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27802 this_ptr_conv.is_owned = false;
27803 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
27806 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
27807 LDKNodeAnnouncementInfo this_ptr_conv;
27808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27809 this_ptr_conv.is_owned = false;
27810 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
27811 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
27815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27816 LDKNodeAnnouncementInfo this_ptr_conv;
27817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27818 this_ptr_conv.is_owned = false;
27819 LDKThreeBytes val_ref;
27820 CHECK((*env)->GetArrayLength(env, val) == 3);
27821 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
27822 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
27825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
27826 LDKNodeAnnouncementInfo this_ptr_conv;
27827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27828 this_ptr_conv.is_owned = false;
27829 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27830 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
27834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27835 LDKNodeAnnouncementInfo this_ptr_conv;
27836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27837 this_ptr_conv.is_owned = false;
27838 LDKThirtyTwoBytes val_ref;
27839 CHECK((*env)->GetArrayLength(env, val) == 32);
27840 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27841 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
27844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
27845 LDKNodeAnnouncementInfo this_ptr_conv;
27846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27847 this_ptr_conv.is_owned = false;
27848 LDKCVec_NetAddressZ val_constr;
27849 val_constr.datalen = (*env)->GetArrayLength(env, val);
27850 if (val_constr.datalen > 0)
27851 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
27853 val_constr.data = NULL;
27854 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
27855 for (size_t m = 0; m < val_constr.datalen; m++) {
27856 int64_t val_conv_12 = val_vals[m];
27857 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
27858 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
27859 val_constr.data[m] = val_conv_12_conv;
27861 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
27862 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
27865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27866 LDKNodeAnnouncementInfo this_ptr_conv;
27867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27868 this_ptr_conv.is_owned = false;
27869 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
27870 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27871 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27872 uint64_t ret_ref = (uint64_t)ret_var.inner;
27873 if (ret_var.is_owned) {
27879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27880 LDKNodeAnnouncementInfo this_ptr_conv;
27881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27882 this_ptr_conv.is_owned = false;
27883 LDKNodeAnnouncement val_conv;
27884 val_conv.inner = (void*)(val & (~1));
27885 val_conv.is_owned = (val & 1) || (val == 0);
27886 val_conv = NodeAnnouncement_clone(&val_conv);
27887 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
27890 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) {
27891 LDKNodeFeatures features_arg_conv;
27892 features_arg_conv.inner = (void*)(features_arg & (~1));
27893 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27894 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
27895 LDKThreeBytes rgb_arg_ref;
27896 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
27897 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
27898 LDKThirtyTwoBytes alias_arg_ref;
27899 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
27900 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
27901 LDKCVec_NetAddressZ addresses_arg_constr;
27902 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
27903 if (addresses_arg_constr.datalen > 0)
27904 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
27906 addresses_arg_constr.data = NULL;
27907 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
27908 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
27909 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
27910 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
27911 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
27913 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
27914 LDKNodeAnnouncement announcement_message_arg_conv;
27915 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
27916 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
27917 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
27918 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
27919 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27920 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27921 uint64_t ret_ref = (uint64_t)ret_var.inner;
27922 if (ret_var.is_owned) {
27928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27929 LDKNodeAnnouncementInfo orig_conv;
27930 orig_conv.inner = (void*)(orig & (~1));
27931 orig_conv.is_owned = false;
27932 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
27933 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27934 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27935 uint64_t ret_ref = (uint64_t)ret_var.inner;
27936 if (ret_var.is_owned) {
27942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27943 LDKNodeAnnouncementInfo obj_conv;
27944 obj_conv.inner = (void*)(obj & (~1));
27945 obj_conv.is_owned = false;
27946 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
27947 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27948 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27949 CVec_u8Z_free(ret_var);
27953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27954 LDKu8slice ser_ref;
27955 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27956 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27957 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
27958 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
27959 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27960 return (uint64_t)ret_conv;
27963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27964 LDKNodeInfo this_obj_conv;
27965 this_obj_conv.inner = (void*)(this_obj & (~1));
27966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27967 NodeInfo_free(this_obj_conv);
27970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
27971 LDKNodeInfo this_ptr_conv;
27972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27973 this_ptr_conv.is_owned = false;
27974 LDKCVec_u64Z val_constr;
27975 val_constr.datalen = (*env)->GetArrayLength(env, val);
27976 if (val_constr.datalen > 0)
27977 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
27979 val_constr.data = NULL;
27980 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
27981 for (size_t g = 0; g < val_constr.datalen; g++) {
27982 int64_t val_conv_6 = val_vals[g];
27983 val_constr.data[g] = val_conv_6;
27985 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
27986 NodeInfo_set_channels(&this_ptr_conv, val_constr);
27989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
27990 LDKNodeInfo this_ptr_conv;
27991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27992 this_ptr_conv.is_owned = false;
27993 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
27994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27996 uint64_t ret_ref = (uint64_t)ret_var.inner;
27997 if (ret_var.is_owned) {
28003 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) {
28004 LDKNodeInfo this_ptr_conv;
28005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28006 this_ptr_conv.is_owned = false;
28007 LDKRoutingFees val_conv;
28008 val_conv.inner = (void*)(val & (~1));
28009 val_conv.is_owned = (val & 1) || (val == 0);
28010 val_conv = RoutingFees_clone(&val_conv);
28011 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
28014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28015 LDKNodeInfo this_ptr_conv;
28016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28017 this_ptr_conv.is_owned = false;
28018 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
28019 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28020 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28021 uint64_t ret_ref = (uint64_t)ret_var.inner;
28022 if (ret_var.is_owned) {
28028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28029 LDKNodeInfo this_ptr_conv;
28030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28031 this_ptr_conv.is_owned = false;
28032 LDKNodeAnnouncementInfo val_conv;
28033 val_conv.inner = (void*)(val & (~1));
28034 val_conv.is_owned = (val & 1) || (val == 0);
28035 val_conv = NodeAnnouncementInfo_clone(&val_conv);
28036 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
28039 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) {
28040 LDKCVec_u64Z channels_arg_constr;
28041 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28042 if (channels_arg_constr.datalen > 0)
28043 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
28045 channels_arg_constr.data = NULL;
28046 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28047 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
28048 int64_t channels_arg_conv_6 = channels_arg_vals[g];
28049 channels_arg_constr.data[g] = channels_arg_conv_6;
28051 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28052 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
28053 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
28054 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
28055 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
28056 LDKNodeAnnouncementInfo announcement_info_arg_conv;
28057 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
28058 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
28059 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
28060 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
28061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28063 uint64_t ret_ref = (uint64_t)ret_var.inner;
28064 if (ret_var.is_owned) {
28070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28071 LDKNodeInfo orig_conv;
28072 orig_conv.inner = (void*)(orig & (~1));
28073 orig_conv.is_owned = false;
28074 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
28075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28077 uint64_t ret_ref = (uint64_t)ret_var.inner;
28078 if (ret_var.is_owned) {
28084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28085 LDKNodeInfo obj_conv;
28086 obj_conv.inner = (void*)(obj & (~1));
28087 obj_conv.is_owned = false;
28088 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
28089 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28090 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28091 CVec_u8Z_free(ret_var);
28095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28096 LDKu8slice ser_ref;
28097 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28098 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28099 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
28100 *ret_conv = NodeInfo_read(ser_ref);
28101 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28102 return (uint64_t)ret_conv;
28105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
28106 LDKNetworkGraph obj_conv;
28107 obj_conv.inner = (void*)(obj & (~1));
28108 obj_conv.is_owned = false;
28109 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
28110 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28111 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28112 CVec_u8Z_free(ret_var);
28116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28117 LDKu8slice ser_ref;
28118 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28119 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28120 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
28121 *ret_conv = NetworkGraph_read(ser_ref);
28122 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28123 return (uint64_t)ret_conv;
28126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
28127 LDKThirtyTwoBytes genesis_hash_ref;
28128 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
28129 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
28130 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
28131 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28132 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28133 uint64_t ret_ref = (uint64_t)ret_var.inner;
28134 if (ret_var.is_owned) {
28140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
28141 LDKNetworkGraph this_arg_conv;
28142 this_arg_conv.inner = (void*)(this_arg & (~1));
28143 this_arg_conv.is_owned = false;
28144 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
28145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28147 uint64_t ret_ref = (uint64_t)ret_var.inner;
28148 if (ret_var.is_owned) {
28154 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) {
28155 LDKNetworkGraph this_arg_conv;
28156 this_arg_conv.inner = (void*)(this_arg & (~1));
28157 this_arg_conv.is_owned = false;
28158 LDKNodeAnnouncement msg_conv;
28159 msg_conv.inner = (void*)(msg & (~1));
28160 msg_conv.is_owned = false;
28161 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28162 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
28163 return (uint64_t)ret_conv;
28166 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) {
28167 LDKNetworkGraph this_arg_conv;
28168 this_arg_conv.inner = (void*)(this_arg & (~1));
28169 this_arg_conv.is_owned = false;
28170 LDKUnsignedNodeAnnouncement msg_conv;
28171 msg_conv.inner = (void*)(msg & (~1));
28172 msg_conv.is_owned = false;
28173 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28174 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
28175 return (uint64_t)ret_conv;
28178 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) {
28179 LDKNetworkGraph this_arg_conv;
28180 this_arg_conv.inner = (void*)(this_arg & (~1));
28181 this_arg_conv.is_owned = false;
28182 LDKChannelAnnouncement msg_conv;
28183 msg_conv.inner = (void*)(msg & (~1));
28184 msg_conv.is_owned = false;
28185 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28186 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28187 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28188 // Manually implement clone for Java trait instances
28189 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28190 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28191 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28194 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28195 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28196 return (uint64_t)ret_conv;
28199 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) {
28200 LDKNetworkGraph this_arg_conv;
28201 this_arg_conv.inner = (void*)(this_arg & (~1));
28202 this_arg_conv.is_owned = false;
28203 LDKUnsignedChannelAnnouncement msg_conv;
28204 msg_conv.inner = (void*)(msg & (~1));
28205 msg_conv.is_owned = false;
28206 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28207 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28208 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28209 // Manually implement clone for Java trait instances
28210 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28211 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28212 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28215 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28216 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28217 return (uint64_t)ret_conv;
28220 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) {
28221 LDKNetworkGraph this_arg_conv;
28222 this_arg_conv.inner = (void*)(this_arg & (~1));
28223 this_arg_conv.is_owned = false;
28224 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
28227 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) {
28228 LDKNetworkGraph this_arg_conv;
28229 this_arg_conv.inner = (void*)(this_arg & (~1));
28230 this_arg_conv.is_owned = false;
28231 LDKPublicKey _node_id_ref;
28232 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
28233 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
28234 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
28237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28238 LDKNetworkGraph this_arg_conv;
28239 this_arg_conv.inner = (void*)(this_arg & (~1));
28240 this_arg_conv.is_owned = false;
28241 LDKChannelUpdate msg_conv;
28242 msg_conv.inner = (void*)(msg & (~1));
28243 msg_conv.is_owned = false;
28244 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28245 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
28246 return (uint64_t)ret_conv;
28249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28250 LDKNetworkGraph this_arg_conv;
28251 this_arg_conv.inner = (void*)(this_arg & (~1));
28252 this_arg_conv.is_owned = false;
28253 LDKUnsignedChannelUpdate msg_conv;
28254 msg_conv.inner = (void*)(msg & (~1));
28255 msg_conv.is_owned = false;
28256 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28257 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
28258 return (uint64_t)ret_conv;
28261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28262 LDKFilesystemPersister this_obj_conv;
28263 this_obj_conv.inner = (void*)(this_obj & (~1));
28264 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28265 FilesystemPersister_free(this_obj_conv);
28268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
28269 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
28270 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
28271 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28272 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28273 uint64_t ret_ref = (uint64_t)ret_var.inner;
28274 if (ret_var.is_owned) {
28280 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
28281 LDKFilesystemPersister this_arg_conv;
28282 this_arg_conv.inner = (void*)(this_arg & (~1));
28283 this_arg_conv.is_owned = false;
28284 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
28285 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
28290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
28291 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
28292 LDKChannelManager manager_conv;
28293 manager_conv.inner = (void*)(manager & (~1));
28294 manager_conv.is_owned = false;
28295 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28296 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
28297 return (uint64_t)ret_conv;
28300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
28301 LDKFilesystemPersister this_arg_conv;
28302 this_arg_conv.inner = (void*)(this_arg & (~1));
28303 this_arg_conv.is_owned = false;
28304 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
28305 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28306 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28307 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28309 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
28310 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
28311 return (uint64_t)ret_conv;
28314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
28315 LDKFilesystemPersister this_arg_conv;
28316 this_arg_conv.inner = (void*)(this_arg & (~1));
28317 this_arg_conv.is_owned = false;
28318 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
28319 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
28320 return (uint64_t)ret_ret;
28323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28324 LDKBackgroundProcessor this_obj_conv;
28325 this_obj_conv.inner = (void*)(this_obj & (~1));
28326 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28327 BackgroundProcessor_free(this_obj_conv);
28330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28331 if ((this_ptr & 1) != 0) return;
28332 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
28333 FREE((void*)this_ptr);
28334 ChannelManagerPersister_free(this_ptr_conv);
28337 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) {
28338 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
28339 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
28340 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28341 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
28343 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
28344 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
28345 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28346 LDKEventHandler_JCalls_cloned(&event_handler_conv);
28348 LDKChainMonitor chain_monitor_conv;
28349 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
28350 chain_monitor_conv.is_owned = false;
28351 LDKChannelManager channel_manager_conv;
28352 channel_manager_conv.inner = (void*)(channel_manager & (~1));
28353 channel_manager_conv.is_owned = false;
28354 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
28355 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
28356 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
28357 LDKPeerManager peer_manager_conv;
28358 peer_manager_conv.inner = (void*)(peer_manager & (~1));
28359 peer_manager_conv.is_owned = false;
28360 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
28361 if (logger_conv.free == LDKLogger_JCalls_free) {
28362 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28363 LDKLogger_JCalls_cloned(&logger_conv);
28365 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);
28366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28368 uint64_t ret_ref = (uint64_t)ret_var.inner;
28369 if (ret_var.is_owned) {
28375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
28376 LDKBackgroundProcessor this_arg_conv;
28377 this_arg_conv.inner = (void*)(this_arg & (~1));
28378 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28379 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28380 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28381 *ret_conv = BackgroundProcessor_join(this_arg_conv);
28382 return (uint64_t)ret_conv;
28385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
28386 LDKBackgroundProcessor this_arg_conv;
28387 this_arg_conv.inner = (void*)(this_arg & (~1));
28388 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28389 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28390 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28391 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
28392 return (uint64_t)ret_conv;
28395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
28399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28400 LDKInvoice this_obj_conv;
28401 this_obj_conv.inner = (void*)(this_obj & (~1));
28402 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28403 Invoice_free(this_obj_conv);
28406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28408 a_conv.inner = (void*)(a & (~1));
28409 a_conv.is_owned = false;
28411 b_conv.inner = (void*)(b & (~1));
28412 b_conv.is_owned = false;
28413 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
28417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28418 LDKInvoice orig_conv;
28419 orig_conv.inner = (void*)(orig & (~1));
28420 orig_conv.is_owned = false;
28421 LDKInvoice ret_var = Invoice_clone(&orig_conv);
28422 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28423 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28424 uint64_t ret_ref = (uint64_t)ret_var.inner;
28425 if (ret_var.is_owned) {
28431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28432 LDKSignedRawInvoice this_obj_conv;
28433 this_obj_conv.inner = (void*)(this_obj & (~1));
28434 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28435 SignedRawInvoice_free(this_obj_conv);
28438 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28439 LDKSignedRawInvoice a_conv;
28440 a_conv.inner = (void*)(a & (~1));
28441 a_conv.is_owned = false;
28442 LDKSignedRawInvoice b_conv;
28443 b_conv.inner = (void*)(b & (~1));
28444 b_conv.is_owned = false;
28445 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
28449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28450 LDKSignedRawInvoice orig_conv;
28451 orig_conv.inner = (void*)(orig & (~1));
28452 orig_conv.is_owned = false;
28453 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
28454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28456 uint64_t ret_ref = (uint64_t)ret_var.inner;
28457 if (ret_var.is_owned) {
28463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28464 LDKRawInvoice 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 RawInvoice_free(this_obj_conv);
28470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
28471 LDKRawInvoice this_ptr_conv;
28472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28473 this_ptr_conv.is_owned = false;
28474 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
28475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28477 uint64_t ret_ref = (uint64_t)ret_var.inner;
28478 if (ret_var.is_owned) {
28484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28485 LDKRawInvoice this_ptr_conv;
28486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28487 this_ptr_conv.is_owned = false;
28488 LDKRawDataPart val_conv;
28489 val_conv.inner = (void*)(val & (~1));
28490 val_conv.is_owned = (val & 1) || (val == 0);
28491 val_conv = RawDataPart_clone(&val_conv);
28492 RawInvoice_set_data(&this_ptr_conv, val_conv);
28495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28496 LDKRawInvoice a_conv;
28497 a_conv.inner = (void*)(a & (~1));
28498 a_conv.is_owned = false;
28499 LDKRawInvoice b_conv;
28500 b_conv.inner = (void*)(b & (~1));
28501 b_conv.is_owned = false;
28502 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
28506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28507 LDKRawInvoice orig_conv;
28508 orig_conv.inner = (void*)(orig & (~1));
28509 orig_conv.is_owned = false;
28510 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
28511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28513 uint64_t ret_ref = (uint64_t)ret_var.inner;
28514 if (ret_var.is_owned) {
28520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28521 LDKRawDataPart this_obj_conv;
28522 this_obj_conv.inner = (void*)(this_obj & (~1));
28523 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28524 RawDataPart_free(this_obj_conv);
28527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
28528 LDKRawDataPart this_ptr_conv;
28529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28530 this_ptr_conv.is_owned = false;
28531 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
28532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28534 uint64_t ret_ref = (uint64_t)ret_var.inner;
28535 if (ret_var.is_owned) {
28541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28542 LDKRawDataPart this_ptr_conv;
28543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28544 this_ptr_conv.is_owned = false;
28545 LDKPositiveTimestamp val_conv;
28546 val_conv.inner = (void*)(val & (~1));
28547 val_conv.is_owned = (val & 1) || (val == 0);
28548 val_conv = PositiveTimestamp_clone(&val_conv);
28549 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
28552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28553 LDKRawDataPart a_conv;
28554 a_conv.inner = (void*)(a & (~1));
28555 a_conv.is_owned = false;
28556 LDKRawDataPart b_conv;
28557 b_conv.inner = (void*)(b & (~1));
28558 b_conv.is_owned = false;
28559 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
28563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28564 LDKRawDataPart orig_conv;
28565 orig_conv.inner = (void*)(orig & (~1));
28566 orig_conv.is_owned = false;
28567 LDKRawDataPart ret_var = RawDataPart_clone(&orig_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 void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28578 LDKPositiveTimestamp this_obj_conv;
28579 this_obj_conv.inner = (void*)(this_obj & (~1));
28580 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28581 PositiveTimestamp_free(this_obj_conv);
28584 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28585 LDKPositiveTimestamp a_conv;
28586 a_conv.inner = (void*)(a & (~1));
28587 a_conv.is_owned = false;
28588 LDKPositiveTimestamp b_conv;
28589 b_conv.inner = (void*)(b & (~1));
28590 b_conv.is_owned = false;
28591 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
28595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28596 LDKPositiveTimestamp orig_conv;
28597 orig_conv.inner = (void*)(orig & (~1));
28598 orig_conv.is_owned = false;
28599 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
28600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28602 uint64_t ret_ref = (uint64_t)ret_var.inner;
28603 if (ret_var.is_owned) {
28609 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28610 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
28611 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
28615 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
28616 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
28620 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
28621 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
28625 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
28626 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
28630 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
28631 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
28635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28636 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
28637 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
28638 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
28642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
28643 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
28644 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
28648 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28649 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
28650 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
28654 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
28655 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
28659 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
28660 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
28664 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
28665 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
28669 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
28670 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
28674 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
28675 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
28679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
28680 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
28681 int64_t ret_val = Currency_hash(o_conv);
28685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28686 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
28687 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
28688 jboolean ret_val = Currency_eq(a_conv, b_conv);
28692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28693 LDKSha256 this_obj_conv;
28694 this_obj_conv.inner = (void*)(this_obj & (~1));
28695 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28696 Sha256_free(this_obj_conv);
28699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28700 LDKSha256 orig_conv;
28701 orig_conv.inner = (void*)(orig & (~1));
28702 orig_conv.is_owned = false;
28703 LDKSha256 ret_var = Sha256_clone(&orig_conv);
28704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28706 uint64_t ret_ref = (uint64_t)ret_var.inner;
28707 if (ret_var.is_owned) {
28713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
28715 o_conv.inner = (void*)(o & (~1));
28716 o_conv.is_owned = false;
28717 int64_t ret_val = Sha256_hash(&o_conv);
28721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28723 a_conv.inner = (void*)(a & (~1));
28724 a_conv.is_owned = false;
28726 b_conv.inner = (void*)(b & (~1));
28727 b_conv.is_owned = false;
28728 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
28732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28733 LDKDescription this_obj_conv;
28734 this_obj_conv.inner = (void*)(this_obj & (~1));
28735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28736 Description_free(this_obj_conv);
28739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28740 LDKDescription orig_conv;
28741 orig_conv.inner = (void*)(orig & (~1));
28742 orig_conv.is_owned = false;
28743 LDKDescription ret_var = Description_clone(&orig_conv);
28744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28746 uint64_t ret_ref = (uint64_t)ret_var.inner;
28747 if (ret_var.is_owned) {
28753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
28754 LDKDescription o_conv;
28755 o_conv.inner = (void*)(o & (~1));
28756 o_conv.is_owned = false;
28757 int64_t ret_val = Description_hash(&o_conv);
28761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28762 LDKDescription a_conv;
28763 a_conv.inner = (void*)(a & (~1));
28764 a_conv.is_owned = false;
28765 LDKDescription b_conv;
28766 b_conv.inner = (void*)(b & (~1));
28767 b_conv.is_owned = false;
28768 jboolean ret_val = Description_eq(&a_conv, &b_conv);
28772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28773 LDKPayeePubKey this_obj_conv;
28774 this_obj_conv.inner = (void*)(this_obj & (~1));
28775 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28776 PayeePubKey_free(this_obj_conv);
28779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28780 LDKPayeePubKey orig_conv;
28781 orig_conv.inner = (void*)(orig & (~1));
28782 orig_conv.is_owned = false;
28783 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
28784 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28785 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28786 uint64_t ret_ref = (uint64_t)ret_var.inner;
28787 if (ret_var.is_owned) {
28793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
28794 LDKPayeePubKey o_conv;
28795 o_conv.inner = (void*)(o & (~1));
28796 o_conv.is_owned = false;
28797 int64_t ret_val = PayeePubKey_hash(&o_conv);
28801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28802 LDKPayeePubKey a_conv;
28803 a_conv.inner = (void*)(a & (~1));
28804 a_conv.is_owned = false;
28805 LDKPayeePubKey b_conv;
28806 b_conv.inner = (void*)(b & (~1));
28807 b_conv.is_owned = false;
28808 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
28812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28813 LDKExpiryTime this_obj_conv;
28814 this_obj_conv.inner = (void*)(this_obj & (~1));
28815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28816 ExpiryTime_free(this_obj_conv);
28819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28820 LDKExpiryTime orig_conv;
28821 orig_conv.inner = (void*)(orig & (~1));
28822 orig_conv.is_owned = false;
28823 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
28824 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28825 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28826 uint64_t ret_ref = (uint64_t)ret_var.inner;
28827 if (ret_var.is_owned) {
28833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
28834 LDKExpiryTime o_conv;
28835 o_conv.inner = (void*)(o & (~1));
28836 o_conv.is_owned = false;
28837 int64_t ret_val = ExpiryTime_hash(&o_conv);
28841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28842 LDKExpiryTime a_conv;
28843 a_conv.inner = (void*)(a & (~1));
28844 a_conv.is_owned = false;
28845 LDKExpiryTime b_conv;
28846 b_conv.inner = (void*)(b & (~1));
28847 b_conv.is_owned = false;
28848 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
28852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28853 LDKMinFinalCltvExpiry this_obj_conv;
28854 this_obj_conv.inner = (void*)(this_obj & (~1));
28855 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28856 MinFinalCltvExpiry_free(this_obj_conv);
28859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28860 LDKMinFinalCltvExpiry orig_conv;
28861 orig_conv.inner = (void*)(orig & (~1));
28862 orig_conv.is_owned = false;
28863 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
28864 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28865 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28866 uint64_t ret_ref = (uint64_t)ret_var.inner;
28867 if (ret_var.is_owned) {
28873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
28874 LDKMinFinalCltvExpiry o_conv;
28875 o_conv.inner = (void*)(o & (~1));
28876 o_conv.is_owned = false;
28877 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
28881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28882 LDKMinFinalCltvExpiry a_conv;
28883 a_conv.inner = (void*)(a & (~1));
28884 a_conv.is_owned = false;
28885 LDKMinFinalCltvExpiry b_conv;
28886 b_conv.inner = (void*)(b & (~1));
28887 b_conv.is_owned = false;
28888 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
28892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28893 if ((this_ptr & 1) != 0) return;
28894 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
28895 FREE((void*)this_ptr);
28896 Fallback_free(this_ptr_conv);
28899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28900 LDKFallback* orig_conv = (LDKFallback*)orig;
28901 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28902 *ret_copy = Fallback_clone(orig_conv);
28903 uint64_t ret_ref = (uint64_t)ret_copy;
28907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
28909 LDKCVec_u8Z program_ref;
28910 program_ref.datalen = (*env)->GetArrayLength(env, program);
28911 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
28912 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
28913 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28914 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
28915 uint64_t ret_ref = (uint64_t)ret_copy;
28919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
28920 LDKTwentyBytes a_ref;
28921 CHECK((*env)->GetArrayLength(env, a) == 20);
28922 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
28923 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28924 *ret_copy = Fallback_pub_key_hash(a_ref);
28925 uint64_t ret_ref = (uint64_t)ret_copy;
28929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
28930 LDKTwentyBytes a_ref;
28931 CHECK((*env)->GetArrayLength(env, a) == 20);
28932 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
28933 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28934 *ret_copy = Fallback_script_hash(a_ref);
28935 uint64_t ret_ref = (uint64_t)ret_copy;
28939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
28940 LDKFallback* o_conv = (LDKFallback*)o;
28941 int64_t ret_val = Fallback_hash(o_conv);
28945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28946 LDKFallback* a_conv = (LDKFallback*)a;
28947 LDKFallback* b_conv = (LDKFallback*)b;
28948 jboolean ret_val = Fallback_eq(a_conv, b_conv);
28952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28953 LDKInvoiceSignature this_obj_conv;
28954 this_obj_conv.inner = (void*)(this_obj & (~1));
28955 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28956 InvoiceSignature_free(this_obj_conv);
28959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28960 LDKInvoiceSignature orig_conv;
28961 orig_conv.inner = (void*)(orig & (~1));
28962 orig_conv.is_owned = false;
28963 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
28964 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28965 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28966 uint64_t ret_ref = (uint64_t)ret_var.inner;
28967 if (ret_var.is_owned) {
28973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28974 LDKInvoiceSignature a_conv;
28975 a_conv.inner = (void*)(a & (~1));
28976 a_conv.is_owned = false;
28977 LDKInvoiceSignature b_conv;
28978 b_conv.inner = (void*)(b & (~1));
28979 b_conv.is_owned = false;
28980 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
28984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28985 LDKPrivateRoute this_obj_conv;
28986 this_obj_conv.inner = (void*)(this_obj & (~1));
28987 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28988 PrivateRoute_free(this_obj_conv);
28991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28992 LDKPrivateRoute orig_conv;
28993 orig_conv.inner = (void*)(orig & (~1));
28994 orig_conv.is_owned = false;
28995 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
28996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28998 uint64_t ret_ref = (uint64_t)ret_var.inner;
28999 if (ret_var.is_owned) {
29005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
29006 LDKPrivateRoute o_conv;
29007 o_conv.inner = (void*)(o & (~1));
29008 o_conv.is_owned = false;
29009 int64_t ret_val = PrivateRoute_hash(&o_conv);
29013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29014 LDKPrivateRoute a_conv;
29015 a_conv.inner = (void*)(a & (~1));
29016 a_conv.is_owned = false;
29017 LDKPrivateRoute b_conv;
29018 b_conv.inner = (void*)(b & (~1));
29019 b_conv.is_owned = false;
29020 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
29024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
29025 LDKSignedRawInvoice this_arg_conv;
29026 this_arg_conv.inner = (void*)(this_arg & (~1));
29027 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29028 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
29029 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
29030 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
29031 return (uint64_t)ret_ref;
29034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
29035 LDKSignedRawInvoice this_arg_conv;
29036 this_arg_conv.inner = (void*)(this_arg & (~1));
29037 this_arg_conv.is_owned = false;
29038 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
29039 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29040 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29041 uint64_t ret_ref = (uint64_t)ret_var.inner;
29042 if (ret_var.is_owned) {
29048 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29049 LDKSignedRawInvoice this_arg_conv;
29050 this_arg_conv.inner = (void*)(this_arg & (~1));
29051 this_arg_conv.is_owned = false;
29052 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29053 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
29057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29058 LDKSignedRawInvoice this_arg_conv;
29059 this_arg_conv.inner = (void*)(this_arg & (~1));
29060 this_arg_conv.is_owned = false;
29061 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
29062 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29063 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29064 uint64_t ret_ref = (uint64_t)ret_var.inner;
29065 if (ret_var.is_owned) {
29071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29072 LDKSignedRawInvoice this_arg_conv;
29073 this_arg_conv.inner = (void*)(this_arg & (~1));
29074 this_arg_conv.is_owned = false;
29075 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
29076 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
29077 return (uint64_t)ret_conv;
29080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29081 LDKSignedRawInvoice this_arg_conv;
29082 this_arg_conv.inner = (void*)(this_arg & (~1));
29083 this_arg_conv.is_owned = false;
29084 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
29088 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29089 LDKRawInvoice this_arg_conv;
29090 this_arg_conv.inner = (void*)(this_arg & (~1));
29091 this_arg_conv.is_owned = false;
29092 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29093 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
29097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29098 LDKRawInvoice this_arg_conv;
29099 this_arg_conv.inner = (void*)(this_arg & (~1));
29100 this_arg_conv.is_owned = false;
29101 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
29102 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29103 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29104 uint64_t ret_ref = (uint64_t)ret_var.inner;
29105 if (ret_var.is_owned) {
29111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
29112 LDKRawInvoice this_arg_conv;
29113 this_arg_conv.inner = (void*)(this_arg & (~1));
29114 this_arg_conv.is_owned = false;
29115 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
29116 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29117 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29118 uint64_t ret_ref = (uint64_t)ret_var.inner;
29119 if (ret_var.is_owned) {
29125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29126 LDKRawInvoice this_arg_conv;
29127 this_arg_conv.inner = (void*)(this_arg & (~1));
29128 this_arg_conv.is_owned = false;
29129 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
29130 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29131 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29132 uint64_t ret_ref = (uint64_t)ret_var.inner;
29133 if (ret_var.is_owned) {
29139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29140 LDKRawInvoice this_arg_conv;
29141 this_arg_conv.inner = (void*)(this_arg & (~1));
29142 this_arg_conv.is_owned = false;
29143 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
29144 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29145 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29146 uint64_t ret_ref = (uint64_t)ret_var.inner;
29147 if (ret_var.is_owned) {
29153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29154 LDKRawInvoice this_arg_conv;
29155 this_arg_conv.inner = (void*)(this_arg & (~1));
29156 this_arg_conv.is_owned = false;
29157 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
29158 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29159 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29160 uint64_t ret_ref = (uint64_t)ret_var.inner;
29161 if (ret_var.is_owned) {
29167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
29168 LDKRawInvoice this_arg_conv;
29169 this_arg_conv.inner = (void*)(this_arg & (~1));
29170 this_arg_conv.is_owned = false;
29171 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
29172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29174 uint64_t ret_ref = (uint64_t)ret_var.inner;
29175 if (ret_var.is_owned) {
29181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29182 LDKRawInvoice this_arg_conv;
29183 this_arg_conv.inner = (void*)(this_arg & (~1));
29184 this_arg_conv.is_owned = false;
29185 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29186 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
29190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
29191 LDKRawInvoice this_arg_conv;
29192 this_arg_conv.inner = (void*)(this_arg & (~1));
29193 this_arg_conv.is_owned = false;
29194 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
29195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29197 uint64_t ret_ref = (uint64_t)ret_var.inner;
29198 if (ret_var.is_owned) {
29204 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
29205 LDKRawInvoice this_arg_conv;
29206 this_arg_conv.inner = (void*)(this_arg & (~1));
29207 this_arg_conv.is_owned = false;
29208 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
29209 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29210 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29211 for (size_t o = 0; o < ret_var.datalen; o++) {
29212 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29213 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29214 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29215 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29216 if (ret_conv_14_var.is_owned) {
29217 ret_conv_14_ref |= 1;
29219 ret_arr_ptr[o] = ret_conv_14_ref;
29221 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29222 FREE(ret_var.data);
29226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
29227 LDKRawInvoice this_arg_conv;
29228 this_arg_conv.inner = (void*)(this_arg & (~1));
29229 this_arg_conv.is_owned = false;
29230 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29231 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
29232 uint64_t ret_ref = (uint64_t)ret_copy;
29236 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
29237 LDKRawInvoice this_arg_conv;
29238 this_arg_conv.inner = (void*)(this_arg & (~1));
29239 this_arg_conv.is_owned = false;
29240 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
29244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
29245 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29246 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
29247 return (uint64_t)ret_conv;
29250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
29251 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29252 *ret_conv = PositiveTimestamp_from_system_time(time);
29253 return (uint64_t)ret_conv;
29256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
29257 LDKPositiveTimestamp this_arg_conv;
29258 this_arg_conv.inner = (void*)(this_arg & (~1));
29259 this_arg_conv.is_owned = false;
29260 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
29264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29265 LDKPositiveTimestamp this_arg_conv;
29266 this_arg_conv.inner = (void*)(this_arg & (~1));
29267 this_arg_conv.is_owned = false;
29268 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
29272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
29273 LDKInvoice this_arg_conv;
29274 this_arg_conv.inner = (void*)(this_arg & (~1));
29275 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29276 this_arg_conv = Invoice_clone(&this_arg_conv);
29277 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
29278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29280 uint64_t ret_ref = (uint64_t)ret_var.inner;
29281 if (ret_var.is_owned) {
29287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29288 LDKInvoice this_arg_conv;
29289 this_arg_conv.inner = (void*)(this_arg & (~1));
29290 this_arg_conv.is_owned = false;
29291 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
29292 *ret_conv = Invoice_check_signature(&this_arg_conv);
29293 return (uint64_t)ret_conv;
29296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
29297 LDKSignedRawInvoice signed_invoice_conv;
29298 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
29299 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
29300 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
29301 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
29302 *ret_conv = Invoice_from_signed(signed_invoice_conv);
29303 return (uint64_t)ret_conv;
29306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
29307 LDKInvoice this_arg_conv;
29308 this_arg_conv.inner = (void*)(this_arg & (~1));
29309 this_arg_conv.is_owned = false;
29310 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
29314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29315 LDKInvoice this_arg_conv;
29316 this_arg_conv.inner = (void*)(this_arg & (~1));
29317 this_arg_conv.is_owned = false;
29318 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29319 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
29323 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29324 LDKInvoice this_arg_conv;
29325 this_arg_conv.inner = (void*)(this_arg & (~1));
29326 this_arg_conv.is_owned = false;
29327 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29328 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
29332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29333 LDKInvoice this_arg_conv;
29334 this_arg_conv.inner = (void*)(this_arg & (~1));
29335 this_arg_conv.is_owned = false;
29336 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29337 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
29341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
29342 LDKInvoice this_arg_conv;
29343 this_arg_conv.inner = (void*)(this_arg & (~1));
29344 this_arg_conv.is_owned = false;
29345 LDKInvoiceFeatures ret_var = Invoice_features(&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 int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29356 LDKInvoice this_arg_conv;
29357 this_arg_conv.inner = (void*)(this_arg & (~1));
29358 this_arg_conv.is_owned = false;
29359 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29360 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
29364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29365 LDKInvoice this_arg_conv;
29366 this_arg_conv.inner = (void*)(this_arg & (~1));
29367 this_arg_conv.is_owned = false;
29368 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
29372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
29373 LDKInvoice this_arg_conv;
29374 this_arg_conv.inner = (void*)(this_arg & (~1));
29375 this_arg_conv.is_owned = false;
29376 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
29380 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
29381 LDKInvoice this_arg_conv;
29382 this_arg_conv.inner = (void*)(this_arg & (~1));
29383 this_arg_conv.is_owned = false;
29384 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
29385 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29386 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29387 for (size_t o = 0; o < ret_var.datalen; o++) {
29388 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29389 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29390 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29391 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29392 if (ret_conv_14_var.is_owned) {
29393 ret_conv_14_ref |= 1;
29395 ret_arr_ptr[o] = ret_conv_14_ref;
29397 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29398 FREE(ret_var.data);
29402 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
29403 LDKInvoice this_arg_conv;
29404 this_arg_conv.inner = (void*)(this_arg & (~1));
29405 this_arg_conv.is_owned = false;
29406 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
29407 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29408 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29409 for (size_t l = 0; l < ret_var.datalen; l++) {
29410 LDKRouteHint ret_conv_11_var = ret_var.data[l];
29411 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29412 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29413 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
29414 if (ret_conv_11_var.is_owned) {
29415 ret_conv_11_ref |= 1;
29417 ret_arr_ptr[l] = ret_conv_11_ref;
29419 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29420 FREE(ret_var.data);
29424 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
29425 LDKInvoice this_arg_conv;
29426 this_arg_conv.inner = (void*)(this_arg & (~1));
29427 this_arg_conv.is_owned = false;
29428 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
29432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
29433 LDKInvoice this_arg_conv;
29434 this_arg_conv.inner = (void*)(this_arg & (~1));
29435 this_arg_conv.is_owned = false;
29436 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29437 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
29438 uint64_t ret_ref = (uint64_t)ret_copy;
29442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
29443 LDKStr description_conv = java_to_owned_str(env, description);
29444 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
29445 *ret_conv = Description_new(description_conv);
29446 return (uint64_t)ret_conv;
29449 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
29450 LDKDescription this_arg_conv;
29451 this_arg_conv.inner = (void*)(this_arg & (~1));
29452 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29453 this_arg_conv = Description_clone(&this_arg_conv);
29454 LDKStr ret_str = Description_into_inner(this_arg_conv);
29455 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
29461 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29462 *ret_conv = ExpiryTime_from_seconds(seconds);
29463 return (uint64_t)ret_conv;
29466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
29467 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29468 *ret_conv = ExpiryTime_from_duration(duration);
29469 return (uint64_t)ret_conv;
29472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
29473 LDKExpiryTime this_arg_conv;
29474 this_arg_conv.inner = (void*)(this_arg & (~1));
29475 this_arg_conv.is_owned = false;
29476 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
29480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
29481 LDKExpiryTime this_arg_conv;
29482 this_arg_conv.inner = (void*)(this_arg & (~1));
29483 this_arg_conv.is_owned = false;
29484 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
29488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
29489 LDKRouteHint hops_conv;
29490 hops_conv.inner = (void*)(hops & (~1));
29491 hops_conv.is_owned = (hops & 1) || (hops == 0);
29492 hops_conv = RouteHint_clone(&hops_conv);
29493 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
29494 *ret_conv = PrivateRoute_new(hops_conv);
29495 return (uint64_t)ret_conv;
29498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
29499 LDKPrivateRoute this_arg_conv;
29500 this_arg_conv.inner = (void*)(this_arg & (~1));
29501 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29502 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
29503 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
29504 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29505 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29506 uint64_t ret_ref = (uint64_t)ret_var.inner;
29507 if (ret_var.is_owned) {
29513 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29514 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
29515 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
29519 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
29520 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
29524 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
29525 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
29529 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
29530 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
29534 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
29535 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
29539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29540 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
29541 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
29542 jboolean ret_val = CreationError_eq(a_conv, b_conv);
29546 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29547 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
29548 LDKStr ret_str = CreationError_to_str(o_conv);
29549 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29554 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29555 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
29556 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
29560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
29561 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
29565 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
29566 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
29570 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
29571 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
29575 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
29576 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
29580 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
29581 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
29585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
29586 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
29590 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
29591 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
29595 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
29596 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
29600 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
29601 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
29605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
29606 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
29610 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29611 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
29612 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
29613 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
29617 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29618 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
29619 LDKStr ret_str = SemanticError_to_str(o_conv);
29620 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29626 if ((this_ptr & 1) != 0) return;
29627 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
29628 FREE((void*)this_ptr);
29629 SignOrCreationError_free(this_ptr_conv);
29632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29633 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
29634 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29635 *ret_copy = SignOrCreationError_clone(orig_conv);
29636 uint64_t ret_ref = (uint64_t)ret_copy;
29640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
29641 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29642 *ret_copy = SignOrCreationError_sign_error();
29643 uint64_t ret_ref = (uint64_t)ret_copy;
29647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
29648 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
29649 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29650 *ret_copy = SignOrCreationError_creation_error(a_conv);
29651 uint64_t ret_ref = (uint64_t)ret_copy;
29655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29656 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
29657 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
29658 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
29662 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29663 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
29664 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
29665 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29670 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) {
29671 LDKChannelManager channelmanager_conv;
29672 channelmanager_conv.inner = (void*)(channelmanager & (~1));
29673 channelmanager_conv.is_owned = false;
29674 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
29675 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29676 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29677 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29679 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
29680 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
29681 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
29682 LDKStr description_conv = java_to_owned_str(env, description);
29683 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
29684 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
29685 return (uint64_t)ret_conv;
29688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29689 LDKStr s_conv = java_to_owned_str(env, s);
29690 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
29691 *ret_conv = SiPrefix_from_str(s_conv);
29692 return (uint64_t)ret_conv;
29695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29696 LDKStr s_conv = java_to_owned_str(env, s);
29697 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
29698 *ret_conv = Invoice_from_str(s_conv);
29699 return (uint64_t)ret_conv;
29702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29703 LDKStr s_conv = java_to_owned_str(env, s);
29704 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
29705 *ret_conv = SignedRawInvoice_from_str(s_conv);
29706 return (uint64_t)ret_conv;
29709 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29711 o_conv.inner = (void*)(o & (~1));
29712 o_conv.is_owned = false;
29713 LDKStr ret_str = Invoice_to_str(&o_conv);
29714 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29719 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29720 LDKSignedRawInvoice o_conv;
29721 o_conv.inner = (void*)(o & (~1));
29722 o_conv.is_owned = false;
29723 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
29724 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29729 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29730 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
29731 LDKStr ret_str = Currency_to_str(o_conv);
29732 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29737 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29738 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
29739 LDKStr ret_str = SiPrefix_to_str(o_conv);
29740 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);