1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
4 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
6 #include "org_ldk_impl_bindings.h"
12 #define LIKELY(v) __builtin_expect(!!(v), 1)
13 #define UNLIKELY(v) __builtin_expect(!!(v), 0)
15 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
16 #define MALLOC(a, _) malloc(a)
17 #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); }
18 #define CHECK_ACCESS(p)
19 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
20 #define DO_ASSERT(a) (void)(a)
23 static jmethodID ordinal_meth = NULL;
24 static jmethodID slicedef_meth = NULL;
25 static jclass slicedef_cls = NULL;
26 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
27 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
28 CHECK(ordinal_meth != NULL);
29 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
30 CHECK(slicedef_meth != NULL);
31 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
32 CHECK(slicedef_cls != NULL);
35 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
38 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
41 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
44 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
45 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
46 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
49 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
50 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
51 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
52 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
55 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
56 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
57 vec->datalen = (*env)->GetArrayLength(env, bytes);
58 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
59 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
62 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
63 LDKTransaction *txdata = (LDKTransaction*)ptr;
65 slice.data = txdata->data;
66 slice.datalen = txdata->datalen;
67 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
69 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
70 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
71 txdata->datalen = (*env)->GetArrayLength(env, bytes);
72 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
73 txdata->data_is_owned = false;
74 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
75 return (uint64_t)txdata;
77 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
78 LDKTransaction *tx = (LDKTransaction*)ptr;
79 tx->data_is_owned = true;
80 Transaction_free(*tx);
83 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
84 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
85 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
86 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
87 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
88 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
89 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
90 return (uint64_t)vec->datalen;
92 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
93 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
94 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
95 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
96 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
97 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
98 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
101 return (uint64_t)vec;
104 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
105 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
106 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
107 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
109 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
110 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
111 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
113 typedef jlongArray int64_tArray;
114 typedef jbyteArray int8_tArray;
116 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
117 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
118 char* conv_buf = MALLOC(len + 1, "str conv buf");
119 memcpy(conv_buf, chars, len);
121 jstring ret = (*env)->NewStringUTF(env, conv_buf);
125 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
126 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
127 char* newchars = MALLOC(str_len + 1, "String chars");
128 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
129 memcpy(newchars, jchars, str_len);
130 newchars[str_len] = 0;
131 (*env)->ReleaseStringUTFChars(env, str, jchars);
135 .chars_is_owned = true
140 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
141 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
143 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
144 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
147 static jclass arr_of_B_clz = NULL;
148 static jclass arr_of_J_clz = NULL;
149 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
150 arr_of_B_clz = (*env)->FindClass(env, "[B");
151 CHECK(arr_of_B_clz != NULL);
152 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
153 arr_of_J_clz = (*env)->FindClass(env, "[J");
154 CHECK(arr_of_J_clz != NULL);
155 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
157 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
158 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
159 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
160 if (UNLIKELY((*env)->ExceptionCheck(env))) {
161 (*env)->ExceptionDescribe(env);
162 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception.");
165 case 0: return LDKAccessError_UnknownChain;
166 case 1: return LDKAccessError_UnknownTx;
168 (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value.");
169 abort(); // Unreachable, but will let the compiler know we don't return here
171 static jclass AccessError_class = NULL;
172 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
173 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
174 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
175 AccessError_class = (*env)->NewGlobalRef(env, clz);
176 CHECK(AccessError_class != NULL);
177 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
178 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
179 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
180 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
182 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
184 case LDKAccessError_UnknownChain:
185 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
186 case LDKAccessError_UnknownTx:
187 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
192 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
193 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
194 if (UNLIKELY((*env)->ExceptionCheck(env))) {
195 (*env)->ExceptionDescribe(env);
196 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
199 case 0: return LDKCOption_NoneZ_Some;
200 case 1: return LDKCOption_NoneZ_None;
202 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
203 abort(); // Unreachable, but will let the compiler know we don't return here
205 static jclass COption_NoneZ_class = NULL;
206 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
207 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
208 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
209 COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
210 CHECK(COption_NoneZ_class != NULL);
211 COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
212 CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
213 COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
214 CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
216 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
218 case LDKCOption_NoneZ_Some:
219 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
220 case LDKCOption_NoneZ_None:
221 return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
226 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
227 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
228 if (UNLIKELY((*env)->ExceptionCheck(env))) {
229 (*env)->ExceptionDescribe(env);
230 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception.");
233 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
234 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
236 (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value.");
237 abort(); // Unreachable, but will let the compiler know we don't return here
239 static jclass ChannelMonitorUpdateErr_class = NULL;
240 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
241 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
242 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
243 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
244 CHECK(ChannelMonitorUpdateErr_class != NULL);
245 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
246 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
247 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
248 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
250 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
252 case LDKChannelMonitorUpdateErr_TemporaryFailure:
253 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
254 case LDKChannelMonitorUpdateErr_PermanentFailure:
255 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
260 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
261 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
262 if (UNLIKELY((*env)->ExceptionCheck(env))) {
263 (*env)->ExceptionDescribe(env);
264 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
267 case 0: return LDKConfirmationTarget_Background;
268 case 1: return LDKConfirmationTarget_Normal;
269 case 2: return LDKConfirmationTarget_HighPriority;
271 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
272 abort(); // Unreachable, but will let the compiler know we don't return here
274 static jclass ConfirmationTarget_class = NULL;
275 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
276 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
277 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
278 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
279 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
280 CHECK(ConfirmationTarget_class != NULL);
281 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
282 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
283 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
284 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
285 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
286 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
288 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
290 case LDKConfirmationTarget_Background:
291 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
292 case LDKConfirmationTarget_Normal:
293 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
294 case LDKConfirmationTarget_HighPriority:
295 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
300 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
301 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
302 if (UNLIKELY((*env)->ExceptionCheck(env))) {
303 (*env)->ExceptionDescribe(env);
304 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
307 case 0: return LDKCreationError_DescriptionTooLong;
308 case 1: return LDKCreationError_RouteTooLong;
309 case 2: return LDKCreationError_TimestampOutOfBounds;
310 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
311 case 4: return LDKCreationError_InvalidAmount;
313 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
314 abort(); // Unreachable, but will let the compiler know we don't return here
316 static jclass CreationError_class = NULL;
317 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
318 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
319 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
320 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
321 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
322 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
323 CreationError_class = (*env)->NewGlobalRef(env, clz);
324 CHECK(CreationError_class != NULL);
325 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
326 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
327 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
328 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
329 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
330 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
331 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
332 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
333 CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
334 CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
336 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
338 case LDKCreationError_DescriptionTooLong:
339 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
340 case LDKCreationError_RouteTooLong:
341 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
342 case LDKCreationError_TimestampOutOfBounds:
343 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
344 case LDKCreationError_ExpiryTimeOutOfBounds:
345 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
346 case LDKCreationError_InvalidAmount:
347 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
352 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
353 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
354 if (UNLIKELY((*env)->ExceptionCheck(env))) {
355 (*env)->ExceptionDescribe(env);
356 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
359 case 0: return LDKCurrency_Bitcoin;
360 case 1: return LDKCurrency_BitcoinTestnet;
361 case 2: return LDKCurrency_Regtest;
362 case 3: return LDKCurrency_Simnet;
363 case 4: return LDKCurrency_Signet;
365 (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
366 abort(); // Unreachable, but will let the compiler know we don't return here
368 static jclass Currency_class = NULL;
369 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
370 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
371 static jfieldID Currency_LDKCurrency_Regtest = NULL;
372 static jfieldID Currency_LDKCurrency_Simnet = NULL;
373 static jfieldID Currency_LDKCurrency_Signet = NULL;
374 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
375 Currency_class = (*env)->NewGlobalRef(env, clz);
376 CHECK(Currency_class != NULL);
377 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
378 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
379 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
380 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
381 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
382 CHECK(Currency_LDKCurrency_Regtest != NULL);
383 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
384 CHECK(Currency_LDKCurrency_Simnet != NULL);
385 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
386 CHECK(Currency_LDKCurrency_Signet != NULL);
388 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
390 case LDKCurrency_Bitcoin:
391 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
392 case LDKCurrency_BitcoinTestnet:
393 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
394 case LDKCurrency_Regtest:
395 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
396 case LDKCurrency_Simnet:
397 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
398 case LDKCurrency_Signet:
399 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
404 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
405 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
406 if (UNLIKELY((*env)->ExceptionCheck(env))) {
407 (*env)->ExceptionDescribe(env);
408 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
411 case 0: return LDKIOError_NotFound;
412 case 1: return LDKIOError_PermissionDenied;
413 case 2: return LDKIOError_ConnectionRefused;
414 case 3: return LDKIOError_ConnectionReset;
415 case 4: return LDKIOError_ConnectionAborted;
416 case 5: return LDKIOError_NotConnected;
417 case 6: return LDKIOError_AddrInUse;
418 case 7: return LDKIOError_AddrNotAvailable;
419 case 8: return LDKIOError_BrokenPipe;
420 case 9: return LDKIOError_AlreadyExists;
421 case 10: return LDKIOError_WouldBlock;
422 case 11: return LDKIOError_InvalidInput;
423 case 12: return LDKIOError_InvalidData;
424 case 13: return LDKIOError_TimedOut;
425 case 14: return LDKIOError_WriteZero;
426 case 15: return LDKIOError_Interrupted;
427 case 16: return LDKIOError_Other;
428 case 17: return LDKIOError_UnexpectedEof;
430 (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
431 abort(); // Unreachable, but will let the compiler know we don't return here
433 static jclass IOError_class = NULL;
434 static jfieldID IOError_LDKIOError_NotFound = NULL;
435 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
436 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
437 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
438 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
439 static jfieldID IOError_LDKIOError_NotConnected = NULL;
440 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
441 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
442 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
443 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
444 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
445 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
446 static jfieldID IOError_LDKIOError_InvalidData = NULL;
447 static jfieldID IOError_LDKIOError_TimedOut = NULL;
448 static jfieldID IOError_LDKIOError_WriteZero = NULL;
449 static jfieldID IOError_LDKIOError_Interrupted = NULL;
450 static jfieldID IOError_LDKIOError_Other = NULL;
451 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
452 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
453 IOError_class = (*env)->NewGlobalRef(env, clz);
454 CHECK(IOError_class != NULL);
455 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
456 CHECK(IOError_LDKIOError_NotFound != NULL);
457 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
458 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
459 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
460 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
461 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
462 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
463 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
464 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
465 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
466 CHECK(IOError_LDKIOError_NotConnected != NULL);
467 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
468 CHECK(IOError_LDKIOError_AddrInUse != NULL);
469 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
470 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
471 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
472 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
473 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
474 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
475 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
476 CHECK(IOError_LDKIOError_WouldBlock != NULL);
477 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
478 CHECK(IOError_LDKIOError_InvalidInput != NULL);
479 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
480 CHECK(IOError_LDKIOError_InvalidData != NULL);
481 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
482 CHECK(IOError_LDKIOError_TimedOut != NULL);
483 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
484 CHECK(IOError_LDKIOError_WriteZero != NULL);
485 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
486 CHECK(IOError_LDKIOError_Interrupted != NULL);
487 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
488 CHECK(IOError_LDKIOError_Other != NULL);
489 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
490 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
492 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
494 case LDKIOError_NotFound:
495 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
496 case LDKIOError_PermissionDenied:
497 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
498 case LDKIOError_ConnectionRefused:
499 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
500 case LDKIOError_ConnectionReset:
501 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
502 case LDKIOError_ConnectionAborted:
503 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
504 case LDKIOError_NotConnected:
505 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
506 case LDKIOError_AddrInUse:
507 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
508 case LDKIOError_AddrNotAvailable:
509 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
510 case LDKIOError_BrokenPipe:
511 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
512 case LDKIOError_AlreadyExists:
513 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
514 case LDKIOError_WouldBlock:
515 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
516 case LDKIOError_InvalidInput:
517 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
518 case LDKIOError_InvalidData:
519 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
520 case LDKIOError_TimedOut:
521 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
522 case LDKIOError_WriteZero:
523 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
524 case LDKIOError_Interrupted:
525 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
526 case LDKIOError_Other:
527 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
528 case LDKIOError_UnexpectedEof:
529 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
534 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
535 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
536 if (UNLIKELY((*env)->ExceptionCheck(env))) {
537 (*env)->ExceptionDescribe(env);
538 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
541 case 0: return LDKLevel_Gossip;
542 case 1: return LDKLevel_Trace;
543 case 2: return LDKLevel_Debug;
544 case 3: return LDKLevel_Info;
545 case 4: return LDKLevel_Warn;
546 case 5: return LDKLevel_Error;
548 (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
549 abort(); // Unreachable, but will let the compiler know we don't return here
551 static jclass Level_class = NULL;
552 static jfieldID Level_LDKLevel_Gossip = NULL;
553 static jfieldID Level_LDKLevel_Trace = NULL;
554 static jfieldID Level_LDKLevel_Debug = NULL;
555 static jfieldID Level_LDKLevel_Info = NULL;
556 static jfieldID Level_LDKLevel_Warn = NULL;
557 static jfieldID Level_LDKLevel_Error = NULL;
558 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
559 Level_class = (*env)->NewGlobalRef(env, clz);
560 CHECK(Level_class != NULL);
561 Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
562 CHECK(Level_LDKLevel_Gossip != NULL);
563 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
564 CHECK(Level_LDKLevel_Trace != NULL);
565 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
566 CHECK(Level_LDKLevel_Debug != NULL);
567 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
568 CHECK(Level_LDKLevel_Info != NULL);
569 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
570 CHECK(Level_LDKLevel_Warn != NULL);
571 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
572 CHECK(Level_LDKLevel_Error != NULL);
574 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
576 case LDKLevel_Gossip:
577 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
579 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
581 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
583 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
585 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
587 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
592 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
593 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
594 if (UNLIKELY((*env)->ExceptionCheck(env))) {
595 (*env)->ExceptionDescribe(env);
596 (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception.");
599 case 0: return LDKNetwork_Bitcoin;
600 case 1: return LDKNetwork_Testnet;
601 case 2: return LDKNetwork_Regtest;
602 case 3: return LDKNetwork_Signet;
604 (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
605 abort(); // Unreachable, but will let the compiler know we don't return here
607 static jclass Network_class = NULL;
608 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
609 static jfieldID Network_LDKNetwork_Testnet = NULL;
610 static jfieldID Network_LDKNetwork_Regtest = NULL;
611 static jfieldID Network_LDKNetwork_Signet = NULL;
612 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
613 Network_class = (*env)->NewGlobalRef(env, clz);
614 CHECK(Network_class != NULL);
615 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
616 CHECK(Network_LDKNetwork_Bitcoin != NULL);
617 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
618 CHECK(Network_LDKNetwork_Testnet != NULL);
619 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
620 CHECK(Network_LDKNetwork_Regtest != NULL);
621 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
622 CHECK(Network_LDKNetwork_Signet != NULL);
624 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
626 case LDKNetwork_Bitcoin:
627 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
628 case LDKNetwork_Testnet:
629 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
630 case LDKNetwork_Regtest:
631 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
632 case LDKNetwork_Signet:
633 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
638 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
639 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
640 if (UNLIKELY((*env)->ExceptionCheck(env))) {
641 (*env)->ExceptionDescribe(env);
642 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
645 case 0: return LDKSecp256k1Error_IncorrectSignature;
646 case 1: return LDKSecp256k1Error_InvalidMessage;
647 case 2: return LDKSecp256k1Error_InvalidPublicKey;
648 case 3: return LDKSecp256k1Error_InvalidSignature;
649 case 4: return LDKSecp256k1Error_InvalidSecretKey;
650 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
651 case 6: return LDKSecp256k1Error_InvalidTweak;
652 case 7: return LDKSecp256k1Error_TweakCheckFailed;
653 case 8: return LDKSecp256k1Error_NotEnoughMemory;
655 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
656 abort(); // Unreachable, but will let the compiler know we don't return here
658 static jclass Secp256k1Error_class = NULL;
659 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
660 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
661 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
662 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
663 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
664 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
665 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
666 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
667 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
668 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
669 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
670 CHECK(Secp256k1Error_class != NULL);
671 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
672 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
673 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
674 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
675 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
676 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
677 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
678 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
679 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
680 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
681 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
682 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
683 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
684 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
685 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
686 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
687 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
688 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
690 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
692 case LDKSecp256k1Error_IncorrectSignature:
693 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
694 case LDKSecp256k1Error_InvalidMessage:
695 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
696 case LDKSecp256k1Error_InvalidPublicKey:
697 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
698 case LDKSecp256k1Error_InvalidSignature:
699 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
700 case LDKSecp256k1Error_InvalidSecretKey:
701 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
702 case LDKSecp256k1Error_InvalidRecoveryId:
703 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
704 case LDKSecp256k1Error_InvalidTweak:
705 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
706 case LDKSecp256k1Error_TweakCheckFailed:
707 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
708 case LDKSecp256k1Error_NotEnoughMemory:
709 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
714 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
715 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
716 if (UNLIKELY((*env)->ExceptionCheck(env))) {
717 (*env)->ExceptionDescribe(env);
718 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
721 case 0: return LDKSemanticError_NoPaymentHash;
722 case 1: return LDKSemanticError_MultiplePaymentHashes;
723 case 2: return LDKSemanticError_NoDescription;
724 case 3: return LDKSemanticError_MultipleDescriptions;
725 case 4: return LDKSemanticError_NoPaymentSecret;
726 case 5: return LDKSemanticError_MultiplePaymentSecrets;
727 case 6: return LDKSemanticError_InvalidFeatures;
728 case 7: return LDKSemanticError_InvalidRecoveryId;
729 case 8: return LDKSemanticError_InvalidSignature;
730 case 9: return LDKSemanticError_ImpreciseAmount;
732 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
733 abort(); // Unreachable, but will let the compiler know we don't return here
735 static jclass SemanticError_class = NULL;
736 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
737 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
738 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
739 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
740 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
741 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
742 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
743 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
744 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
745 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
746 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
747 SemanticError_class = (*env)->NewGlobalRef(env, clz);
748 CHECK(SemanticError_class != NULL);
749 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
750 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
751 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
752 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
753 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
754 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
755 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
756 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
757 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
758 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
759 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
760 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
761 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
762 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
763 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
764 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
765 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
766 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
767 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
768 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
770 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
772 case LDKSemanticError_NoPaymentHash:
773 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
774 case LDKSemanticError_MultiplePaymentHashes:
775 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
776 case LDKSemanticError_NoDescription:
777 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
778 case LDKSemanticError_MultipleDescriptions:
779 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
780 case LDKSemanticError_NoPaymentSecret:
781 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
782 case LDKSemanticError_MultiplePaymentSecrets:
783 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
784 case LDKSemanticError_InvalidFeatures:
785 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
786 case LDKSemanticError_InvalidRecoveryId:
787 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
788 case LDKSemanticError_InvalidSignature:
789 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
790 case LDKSemanticError_ImpreciseAmount:
791 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
796 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
797 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
798 if (UNLIKELY((*env)->ExceptionCheck(env))) {
799 (*env)->ExceptionDescribe(env);
800 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
803 case 0: return LDKSiPrefix_Milli;
804 case 1: return LDKSiPrefix_Micro;
805 case 2: return LDKSiPrefix_Nano;
806 case 3: return LDKSiPrefix_Pico;
808 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
809 abort(); // Unreachable, but will let the compiler know we don't return here
811 static jclass SiPrefix_class = NULL;
812 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
813 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
814 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
815 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
816 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
817 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
818 CHECK(SiPrefix_class != NULL);
819 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
820 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
821 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
822 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
823 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
824 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
825 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
826 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
828 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
830 case LDKSiPrefix_Milli:
831 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
832 case LDKSiPrefix_Micro:
833 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
834 case LDKSiPrefix_Nano:
835 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
836 case LDKSiPrefix_Pico:
837 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
842 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
843 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
844 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
847 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) {
848 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
849 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
850 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
851 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
852 CVec_u8Z_free(ret_var);
856 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) {
857 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
858 int64_t ret_val = TxOut_get_value(thing_conv);
862 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
863 CHECK(owner->result_ok);
864 return *owner->contents.result;
866 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
867 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
868 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
869 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
873 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
874 CHECK(!owner->result_ok);
875 return *owner->contents.err;
877 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
878 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
879 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
883 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
884 CHECK(owner->result_ok);
885 return *owner->contents.result;
887 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
888 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
889 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
890 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
894 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
895 CHECK(!owner->result_ok);
896 return *owner->contents.err;
898 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
899 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
900 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
904 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
905 CHECK(owner->result_ok);
906 return TxCreationKeys_clone(&*owner->contents.result);
908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
909 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
910 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
911 uintptr_t ret_ref = 0;
912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
915 ret_ref = (uintptr_t)ret_var.inner;
916 if (ret_var.is_owned) {
922 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
923 CHECK(!owner->result_ok);
924 return DecodeError_clone(&*owner->contents.err);
926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
927 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
928 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
929 uintptr_t ret_ref = 0;
930 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
931 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
933 ret_ref = (uintptr_t)ret_var.inner;
934 if (ret_var.is_owned) {
940 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
941 CHECK(owner->result_ok);
942 return ChannelPublicKeys_clone(&*owner->contents.result);
944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
945 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
946 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
947 uintptr_t ret_ref = 0;
948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
951 ret_ref = (uintptr_t)ret_var.inner;
952 if (ret_var.is_owned) {
958 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
959 CHECK(!owner->result_ok);
960 return DecodeError_clone(&*owner->contents.err);
962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
963 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
964 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
965 uintptr_t ret_ref = 0;
966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
969 ret_ref = (uintptr_t)ret_var.inner;
970 if (ret_var.is_owned) {
976 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
977 CHECK(owner->result_ok);
978 return TxCreationKeys_clone(&*owner->contents.result);
980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
981 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
982 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
983 uintptr_t ret_ref = 0;
984 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
985 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
987 ret_ref = (uintptr_t)ret_var.inner;
988 if (ret_var.is_owned) {
994 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
995 CHECK(!owner->result_ok);
996 return *owner->contents.err;
998 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
999 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1000 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1004 static jclass LDKCOption_u32Z_Some_class = NULL;
1005 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1006 static jclass LDKCOption_u32Z_None_class = NULL;
1007 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1009 LDKCOption_u32Z_Some_class =
1010 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1011 CHECK(LDKCOption_u32Z_Some_class != NULL);
1012 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1013 CHECK(LDKCOption_u32Z_Some_meth != NULL);
1014 LDKCOption_u32Z_None_class =
1015 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1016 CHECK(LDKCOption_u32Z_None_class != NULL);
1017 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1018 CHECK(LDKCOption_u32Z_None_meth != NULL);
1020 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1021 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
1023 case LDKCOption_u32Z_Some: {
1024 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
1026 case LDKCOption_u32Z_None: {
1027 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1032 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1033 CHECK(owner->result_ok);
1034 return HTLCOutputInCommitment_clone(&*owner->contents.result);
1036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1037 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1038 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1039 uintptr_t ret_ref = 0;
1040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1043 ret_ref = (uintptr_t)ret_var.inner;
1044 if (ret_var.is_owned) {
1050 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1051 CHECK(!owner->result_ok);
1052 return DecodeError_clone(&*owner->contents.err);
1054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1055 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1056 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1057 uintptr_t ret_ref = 0;
1058 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1059 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1060 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1061 ret_ref = (uintptr_t)ret_var.inner;
1062 if (ret_var.is_owned) {
1068 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1069 CHECK(owner->result_ok);
1070 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1073 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1074 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1075 uintptr_t ret_ref = 0;
1076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1079 ret_ref = (uintptr_t)ret_var.inner;
1080 if (ret_var.is_owned) {
1086 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1087 CHECK(!owner->result_ok);
1088 return DecodeError_clone(&*owner->contents.err);
1090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1091 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1092 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1093 uintptr_t ret_ref = 0;
1094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1097 ret_ref = (uintptr_t)ret_var.inner;
1098 if (ret_var.is_owned) {
1104 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1105 CHECK(owner->result_ok);
1106 return ChannelTransactionParameters_clone(&*owner->contents.result);
1108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1109 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1110 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1111 uintptr_t ret_ref = 0;
1112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1115 ret_ref = (uintptr_t)ret_var.inner;
1116 if (ret_var.is_owned) {
1122 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1123 CHECK(!owner->result_ok);
1124 return DecodeError_clone(&*owner->contents.err);
1126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1127 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1128 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1129 uintptr_t ret_ref = 0;
1130 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1131 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1132 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1133 ret_ref = (uintptr_t)ret_var.inner;
1134 if (ret_var.is_owned) {
1140 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1141 CHECK(owner->result_ok);
1142 return HolderCommitmentTransaction_clone(&*owner->contents.result);
1144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1145 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1146 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1147 uintptr_t ret_ref = 0;
1148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1151 ret_ref = (uintptr_t)ret_var.inner;
1152 if (ret_var.is_owned) {
1158 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1159 CHECK(!owner->result_ok);
1160 return DecodeError_clone(&*owner->contents.err);
1162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1163 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1164 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1165 uintptr_t ret_ref = 0;
1166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1169 ret_ref = (uintptr_t)ret_var.inner;
1170 if (ret_var.is_owned) {
1176 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1177 CHECK(owner->result_ok);
1178 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1181 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1182 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1183 uintptr_t ret_ref = 0;
1184 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1185 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1186 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1187 ret_ref = (uintptr_t)ret_var.inner;
1188 if (ret_var.is_owned) {
1194 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1195 CHECK(!owner->result_ok);
1196 return DecodeError_clone(&*owner->contents.err);
1198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1199 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1200 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1201 uintptr_t ret_ref = 0;
1202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1205 ret_ref = (uintptr_t)ret_var.inner;
1206 if (ret_var.is_owned) {
1212 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1213 CHECK(owner->result_ok);
1214 return &*owner->contents.result;
1216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1217 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1218 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1219 uintptr_t ret_ref = 0;
1220 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1221 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1222 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1223 ret_ref = (uintptr_t)ret_var.inner & ~1;
1227 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1228 CHECK(!owner->result_ok);
1229 return *owner->contents.err;
1231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1232 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1233 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1236 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1237 CHECK(owner->result_ok);
1238 return CommitmentTransaction_clone(&*owner->contents.result);
1240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1241 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1242 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1243 uintptr_t ret_ref = 0;
1244 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1245 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1247 ret_ref = (uintptr_t)ret_var.inner;
1248 if (ret_var.is_owned) {
1254 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1255 CHECK(!owner->result_ok);
1256 return DecodeError_clone(&*owner->contents.err);
1258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1259 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1260 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1261 uintptr_t ret_ref = 0;
1262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1265 ret_ref = (uintptr_t)ret_var.inner;
1266 if (ret_var.is_owned) {
1272 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1273 CHECK(owner->result_ok);
1274 return &*owner->contents.result;
1276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1277 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1278 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1279 uintptr_t ret_ref = 0;
1280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1283 ret_ref = (uintptr_t)ret_var.inner & ~1;
1287 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1288 CHECK(!owner->result_ok);
1289 return *owner->contents.err;
1291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1292 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1293 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1296 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1297 CHECK(owner->result_ok);
1298 return *owner->contents.result;
1300 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1301 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1302 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1303 jobjectArray ret_arr = NULL;
1304 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1306 for (size_t i = 0; i < ret_var.datalen; i++) {
1307 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1308 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1309 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1315 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1316 CHECK(!owner->result_ok);
1317 return *owner->contents.err;
1319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1320 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1321 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1324 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1325 CHECK(owner->result_ok);
1326 return ShutdownScript_clone(&*owner->contents.result);
1328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1329 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1330 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1331 uintptr_t ret_ref = 0;
1332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1335 ret_ref = (uintptr_t)ret_var.inner;
1336 if (ret_var.is_owned) {
1342 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1343 CHECK(!owner->result_ok);
1344 return DecodeError_clone(&*owner->contents.err);
1346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1347 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1348 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1349 uintptr_t ret_ref = 0;
1350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1353 ret_ref = (uintptr_t)ret_var.inner;
1354 if (ret_var.is_owned) {
1360 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1361 CHECK(owner->result_ok);
1362 return ShutdownScript_clone(&*owner->contents.result);
1364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1365 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1366 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1367 uintptr_t ret_ref = 0;
1368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1371 ret_ref = (uintptr_t)ret_var.inner;
1372 if (ret_var.is_owned) {
1378 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1379 CHECK(!owner->result_ok);
1380 return InvalidShutdownScript_clone(&*owner->contents.err);
1382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1383 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1384 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1385 uintptr_t ret_ref = 0;
1386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1389 ret_ref = (uintptr_t)ret_var.inner;
1390 if (ret_var.is_owned) {
1396 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1397 CHECK(owner->result_ok);
1398 return *owner->contents.result;
1400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1401 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1402 CResult_NoneErrorZ_get_ok(owner_conv);
1405 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1406 CHECK(!owner->result_ok);
1407 return *owner->contents.err;
1409 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1410 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1411 jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1415 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1416 CHECK(owner->result_ok);
1417 return RouteHop_clone(&*owner->contents.result);
1419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1420 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1421 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1422 uintptr_t ret_ref = 0;
1423 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1424 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1425 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1426 ret_ref = (uintptr_t)ret_var.inner;
1427 if (ret_var.is_owned) {
1433 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1434 CHECK(!owner->result_ok);
1435 return DecodeError_clone(&*owner->contents.err);
1437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1438 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1439 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1440 uintptr_t ret_ref = 0;
1441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1444 ret_ref = (uintptr_t)ret_var.inner;
1445 if (ret_var.is_owned) {
1451 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1452 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1453 for (size_t i = 0; i < ret.datalen; i++) {
1454 ret.data[i] = RouteHop_clone(&orig->data[i]);
1458 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1459 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1460 for (size_t i = 0; i < ret.datalen; i++) {
1461 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1465 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1466 CHECK(owner->result_ok);
1467 return Route_clone(&*owner->contents.result);
1469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1470 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1471 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1472 uintptr_t ret_ref = 0;
1473 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1474 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1475 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1476 ret_ref = (uintptr_t)ret_var.inner;
1477 if (ret_var.is_owned) {
1483 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1484 CHECK(!owner->result_ok);
1485 return DecodeError_clone(&*owner->contents.err);
1487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1488 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1489 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1490 uintptr_t ret_ref = 0;
1491 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1492 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1493 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1494 ret_ref = (uintptr_t)ret_var.inner;
1495 if (ret_var.is_owned) {
1501 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1502 CHECK(owner->result_ok);
1503 return RouteParameters_clone(&*owner->contents.result);
1505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1506 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1507 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1508 uintptr_t ret_ref = 0;
1509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1512 ret_ref = (uintptr_t)ret_var.inner;
1513 if (ret_var.is_owned) {
1519 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1520 CHECK(!owner->result_ok);
1521 return DecodeError_clone(&*owner->contents.err);
1523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1524 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1525 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1526 uintptr_t ret_ref = 0;
1527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1530 ret_ref = (uintptr_t)ret_var.inner;
1531 if (ret_var.is_owned) {
1537 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1538 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1539 for (size_t i = 0; i < ret.datalen; i++) {
1540 ret.data[i] = RouteHint_clone(&orig->data[i]);
1544 static jclass LDKCOption_u64Z_Some_class = NULL;
1545 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1546 static jclass LDKCOption_u64Z_None_class = NULL;
1547 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1549 LDKCOption_u64Z_Some_class =
1550 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1551 CHECK(LDKCOption_u64Z_Some_class != NULL);
1552 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1553 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1554 LDKCOption_u64Z_None_class =
1555 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1556 CHECK(LDKCOption_u64Z_None_class != NULL);
1557 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1558 CHECK(LDKCOption_u64Z_None_meth != NULL);
1560 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1561 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1563 case LDKCOption_u64Z_Some: {
1564 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1566 case LDKCOption_u64Z_None: {
1567 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1572 static inline struct LDKPayee CResult_PayeeDecodeErrorZ_get_ok(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
1573 CHECK(owner->result_ok);
1574 return Payee_clone(&*owner->contents.result);
1576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1577 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
1578 LDKPayee ret_var = CResult_PayeeDecodeErrorZ_get_ok(owner_conv);
1579 uintptr_t ret_ref = 0;
1580 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1581 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1582 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1583 ret_ref = (uintptr_t)ret_var.inner;
1584 if (ret_var.is_owned) {
1590 static inline struct LDKDecodeError CResult_PayeeDecodeErrorZ_get_err(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR owner){
1591 CHECK(!owner->result_ok);
1592 return DecodeError_clone(&*owner->contents.err);
1594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1595 LDKCResult_PayeeDecodeErrorZ* owner_conv = (LDKCResult_PayeeDecodeErrorZ*)(owner & ~1);
1596 LDKDecodeError ret_var = CResult_PayeeDecodeErrorZ_get_err(owner_conv);
1597 uintptr_t ret_ref = 0;
1598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1601 ret_ref = (uintptr_t)ret_var.inner;
1602 if (ret_var.is_owned) {
1608 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1609 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1610 for (size_t i = 0; i < ret.datalen; i++) {
1611 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1615 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1616 CHECK(owner->result_ok);
1617 return RouteHint_clone(&*owner->contents.result);
1619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1620 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1621 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1622 uintptr_t ret_ref = 0;
1623 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1624 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1626 ret_ref = (uintptr_t)ret_var.inner;
1627 if (ret_var.is_owned) {
1633 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1634 CHECK(!owner->result_ok);
1635 return DecodeError_clone(&*owner->contents.err);
1637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1638 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1639 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1640 uintptr_t ret_ref = 0;
1641 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1642 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1644 ret_ref = (uintptr_t)ret_var.inner;
1645 if (ret_var.is_owned) {
1651 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1652 CHECK(owner->result_ok);
1653 return RouteHintHop_clone(&*owner->contents.result);
1655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1656 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1657 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1658 uintptr_t ret_ref = 0;
1659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1662 ret_ref = (uintptr_t)ret_var.inner;
1663 if (ret_var.is_owned) {
1669 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1670 CHECK(!owner->result_ok);
1671 return DecodeError_clone(&*owner->contents.err);
1673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1674 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1675 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1676 uintptr_t ret_ref = 0;
1677 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1678 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1680 ret_ref = (uintptr_t)ret_var.inner;
1681 if (ret_var.is_owned) {
1687 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1688 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1689 for (size_t i = 0; i < ret.datalen; i++) {
1690 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1694 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1695 CHECK(owner->result_ok);
1696 return Route_clone(&*owner->contents.result);
1698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1699 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1700 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1701 uintptr_t ret_ref = 0;
1702 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1703 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1705 ret_ref = (uintptr_t)ret_var.inner;
1706 if (ret_var.is_owned) {
1712 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1713 CHECK(!owner->result_ok);
1714 return LightningError_clone(&*owner->contents.err);
1716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1717 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1718 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1719 uintptr_t ret_ref = 0;
1720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1723 ret_ref = (uintptr_t)ret_var.inner;
1724 if (ret_var.is_owned) {
1730 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1731 CHECK(owner->result_ok);
1732 return TxOut_clone(&*owner->contents.result);
1734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1735 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1736 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1737 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
1738 return (uintptr_t)ret_ref;
1741 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1742 CHECK(!owner->result_ok);
1743 return AccessError_clone(&*owner->contents.err);
1745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1746 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1747 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
1751 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1754 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1755 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1756 intptr_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1760 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1764 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1765 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1766 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1767 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1771 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1772 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1773 for (size_t i = 0; i < ret.datalen; i++) {
1774 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1778 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1779 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1780 for (size_t i = 0; i < ret.datalen; i++) {
1781 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1785 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1786 CHECK(owner->result_ok);
1787 return *owner->contents.result;
1789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1790 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1791 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
1794 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1795 CHECK(!owner->result_ok);
1796 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
1798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1799 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1800 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
1804 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1805 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1806 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1807 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1808 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
1809 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
1810 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
1811 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
1812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1813 LDKMonitorEvent_HTLCEvent_class =
1814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
1815 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1816 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1817 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1818 LDKMonitorEvent_CommitmentTxConfirmed_class =
1819 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
1820 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1821 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1822 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1823 LDKMonitorEvent_UpdateCompleted_class =
1824 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
1825 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
1826 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
1827 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
1828 LDKMonitorEvent_UpdateFailed_class =
1829 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
1830 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
1831 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
1832 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
1834 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1835 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1837 case LDKMonitorEvent_HTLCEvent: {
1838 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1839 uintptr_t htlc_event_ref = 0;
1840 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1841 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1842 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1843 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
1844 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1846 case LDKMonitorEvent_CommitmentTxConfirmed: {
1847 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1848 uintptr_t commitment_tx_confirmed_ref = 0;
1849 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1850 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1851 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1852 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
1853 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1855 case LDKMonitorEvent_UpdateCompleted: {
1856 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1857 uintptr_t funding_txo_ref = 0;
1858 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1859 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1860 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1861 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
1862 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, obj->update_completed.monitor_update_id);
1864 case LDKMonitorEvent_UpdateFailed: {
1865 LDKOutPoint update_failed_var = obj->update_failed;
1866 uintptr_t update_failed_ref = 0;
1867 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1868 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1869 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1870 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
1871 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
1876 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1877 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1878 for (size_t i = 0; i < ret.datalen; i++) {
1879 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1883 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1884 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1885 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1886 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1888 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1889 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
1890 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1891 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1892 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1893 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1894 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
1895 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1896 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1897 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1899 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1900 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1902 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1903 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1904 *some_conv = obj->some;
1905 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1906 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((uintptr_t)some_conv));
1908 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1909 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1914 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
1915 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
1916 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
1917 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
1918 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
1919 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
1920 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
1921 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
1922 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
1923 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
1924 static jclass LDKClosureReason_ProcessingError_class = NULL;
1925 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
1926 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
1927 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
1928 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
1929 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
1930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
1931 LDKClosureReason_CounterpartyForceClosed_class =
1932 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
1933 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
1934 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
1935 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
1936 LDKClosureReason_HolderForceClosed_class =
1937 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
1938 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
1939 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
1940 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
1941 LDKClosureReason_CooperativeClosure_class =
1942 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
1943 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
1944 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
1945 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
1946 LDKClosureReason_CommitmentTxConfirmed_class =
1947 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
1948 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
1949 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
1950 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
1951 LDKClosureReason_FundingTimedOut_class =
1952 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
1953 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
1954 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
1955 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
1956 LDKClosureReason_ProcessingError_class =
1957 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
1958 CHECK(LDKClosureReason_ProcessingError_class != NULL);
1959 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
1960 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
1961 LDKClosureReason_DisconnectedPeer_class =
1962 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
1963 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
1964 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
1965 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
1966 LDKClosureReason_OutdatedChannelManager_class =
1967 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
1968 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
1969 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
1970 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
1972 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1973 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
1975 case LDKClosureReason_CounterpartyForceClosed: {
1976 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1977 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
1978 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
1980 case LDKClosureReason_HolderForceClosed: {
1981 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
1983 case LDKClosureReason_CooperativeClosure: {
1984 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
1986 case LDKClosureReason_CommitmentTxConfirmed: {
1987 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
1989 case LDKClosureReason_FundingTimedOut: {
1990 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
1992 case LDKClosureReason_ProcessingError: {
1993 LDKStr err_str = obj->processing_error.err;
1994 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1995 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
1997 case LDKClosureReason_DisconnectedPeer: {
1998 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2000 case LDKClosureReason_OutdatedChannelManager: {
2001 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2006 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2007 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2008 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2009 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2011 LDKCOption_ClosureReasonZ_Some_class =
2012 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2013 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2014 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2015 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2016 LDKCOption_ClosureReasonZ_None_class =
2017 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2018 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2019 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2020 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2022 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2023 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2025 case LDKCOption_ClosureReasonZ_Some: {
2026 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
2027 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2029 case LDKCOption_ClosureReasonZ_None: {
2030 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2035 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2036 CHECK(owner->result_ok);
2037 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2040 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2041 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2042 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2043 uintptr_t ret_ref = (uintptr_t)ret_copy;
2047 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2048 CHECK(!owner->result_ok);
2049 return DecodeError_clone(&*owner->contents.err);
2051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2052 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2053 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2054 uintptr_t ret_ref = 0;
2055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2058 ret_ref = (uintptr_t)ret_var.inner;
2059 if (ret_var.is_owned) {
2065 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2066 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2067 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
2068 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
2069 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2070 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2072 LDKNetworkUpdate_ChannelUpdateMessage_class =
2073 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2074 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2075 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2076 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2077 LDKNetworkUpdate_ChannelClosed_class =
2078 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed"));
2079 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
2080 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
2081 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
2082 LDKNetworkUpdate_NodeFailure_class =
2083 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2084 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2085 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2086 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2088 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2089 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2091 case LDKNetworkUpdate_ChannelUpdateMessage: {
2092 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2093 uintptr_t msg_ref = 0;
2094 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2095 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2096 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2097 msg_ref = (uintptr_t)msg_var.inner & ~1;
2098 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2100 case LDKNetworkUpdate_ChannelClosed: {
2101 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
2103 case LDKNetworkUpdate_NodeFailure: {
2104 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2105 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2106 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
2111 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2112 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2113 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2114 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2116 LDKCOption_NetworkUpdateZ_Some_class =
2117 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2118 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2119 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2120 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2121 LDKCOption_NetworkUpdateZ_None_class =
2122 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2123 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2124 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2125 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2127 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2128 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2130 case LDKCOption_NetworkUpdateZ_Some: {
2131 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
2132 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2134 case LDKCOption_NetworkUpdateZ_None: {
2135 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2140 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2141 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2142 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2143 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2144 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2145 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2147 LDKSpendableOutputDescriptor_StaticOutput_class =
2148 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2149 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2150 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2151 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2152 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2153 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2154 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2155 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2156 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2157 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2158 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2159 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2160 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2161 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2163 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2164 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2166 case LDKSpendableOutputDescriptor_StaticOutput: {
2167 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2168 uintptr_t outpoint_ref = 0;
2169 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2170 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2171 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2172 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2173 uintptr_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2174 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uintptr_t)output_ref);
2176 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2177 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2178 uintptr_t delayed_payment_output_ref = 0;
2179 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2180 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2181 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2182 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2183 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2185 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2186 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2187 uintptr_t static_payment_output_ref = 0;
2188 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2189 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2190 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2191 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2192 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2197 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2198 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2199 for (size_t i = 0; i < ret.datalen; i++) {
2200 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2204 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
2205 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
2206 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
2207 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
2208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
2209 LDKPaymentPurpose_InvoicePayment_class =
2210 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
2211 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
2212 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
2213 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
2214 LDKPaymentPurpose_SpontaneousPayment_class =
2215 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
2216 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
2217 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
2218 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
2220 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2221 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
2223 case LDKPaymentPurpose_InvoicePayment: {
2224 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2225 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
2226 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
2227 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
2228 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
2230 case LDKPaymentPurpose_SpontaneousPayment: {
2231 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
2232 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
2233 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
2238 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2239 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2240 static jclass LDKEvent_PaymentReceived_class = NULL;
2241 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2242 static jclass LDKEvent_PaymentSent_class = NULL;
2243 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2244 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2245 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2246 static jclass LDKEvent_PaymentFailed_class = NULL;
2247 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2248 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2249 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2250 static jclass LDKEvent_SpendableOutputs_class = NULL;
2251 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2252 static jclass LDKEvent_PaymentForwarded_class = NULL;
2253 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2254 static jclass LDKEvent_ChannelClosed_class = NULL;
2255 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2256 static jclass LDKEvent_DiscardFunding_class = NULL;
2257 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2258 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2259 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2261 LDKEvent_FundingGenerationReady_class =
2262 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2263 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2264 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
2265 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2266 LDKEvent_PaymentReceived_class =
2267 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2268 CHECK(LDKEvent_PaymentReceived_class != NULL);
2269 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2270 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2271 LDKEvent_PaymentSent_class =
2272 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2273 CHECK(LDKEvent_PaymentSent_class != NULL);
2274 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2275 CHECK(LDKEvent_PaymentSent_meth != NULL);
2276 LDKEvent_PaymentPathFailed_class =
2277 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2278 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2279 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2280 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2281 LDKEvent_PaymentFailed_class =
2282 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2283 CHECK(LDKEvent_PaymentFailed_class != NULL);
2284 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2285 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2286 LDKEvent_PendingHTLCsForwardable_class =
2287 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2288 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2289 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2290 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2291 LDKEvent_SpendableOutputs_class =
2292 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2293 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2294 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2295 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2296 LDKEvent_PaymentForwarded_class =
2297 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2298 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2299 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
2300 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2301 LDKEvent_ChannelClosed_class =
2302 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2303 CHECK(LDKEvent_ChannelClosed_class != NULL);
2304 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2305 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2306 LDKEvent_DiscardFunding_class =
2307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2308 CHECK(LDKEvent_DiscardFunding_class != NULL);
2309 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2310 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2311 LDKEvent_PaymentPathSuccessful_class =
2312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2313 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2314 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2315 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2317 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2318 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2320 case LDKEvent_FundingGenerationReady: {
2321 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2322 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2323 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2324 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2325 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2326 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);
2328 case LDKEvent_PaymentReceived: {
2329 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2330 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2331 uintptr_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2332 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
2334 case LDKEvent_PaymentSent: {
2335 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2336 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2337 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2338 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2339 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2340 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2341 uintptr_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2342 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2344 case LDKEvent_PaymentPathFailed: {
2345 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2346 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2347 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2348 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2349 uintptr_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2350 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2351 int64_tArray path_arr = NULL;
2352 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2353 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2354 for (size_t k = 0; k < path_var.datalen; k++) {
2355 LDKRouteHop path_conv_10_var = path_var.data[k];
2356 uintptr_t path_conv_10_ref = 0;
2357 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2358 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2359 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2360 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2361 path_arr_ptr[k] = path_conv_10_ref;
2363 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2364 uintptr_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2365 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2366 uintptr_t retry_ref = 0;
2367 if ((uintptr_t)retry_var.inner > 4096) {
2368 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2369 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2370 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2371 retry_ref = (uintptr_t)retry_var.inner & ~1;
2373 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref, retry_ref);
2375 case LDKEvent_PaymentFailed: {
2376 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2377 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2378 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2379 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2380 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2382 case LDKEvent_PendingHTLCsForwardable: {
2383 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
2385 case LDKEvent_SpendableOutputs: {
2386 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2387 int64_tArray outputs_arr = NULL;
2388 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2389 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2390 for (size_t b = 0; b < outputs_var.datalen; b++) {
2391 uintptr_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2392 outputs_arr_ptr[b] = outputs_conv_27_ref;
2394 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2395 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2397 case LDKEvent_PaymentForwarded: {
2398 uintptr_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2399 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
2401 case LDKEvent_ChannelClosed: {
2402 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2403 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2404 uintptr_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2405 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
2407 case LDKEvent_DiscardFunding: {
2408 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2409 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2410 LDKTransaction transaction_var = obj->discard_funding.transaction;
2411 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2412 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2413 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2415 case LDKEvent_PaymentPathSuccessful: {
2416 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2417 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2418 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2419 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2420 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2421 int64_tArray path_arr = NULL;
2422 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2423 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2424 for (size_t k = 0; k < path_var.datalen; k++) {
2425 LDKRouteHop path_conv_10_var = path_var.data[k];
2426 uintptr_t path_conv_10_ref = 0;
2427 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2428 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2429 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2430 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2431 path_arr_ptr[k] = path_conv_10_ref;
2433 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2434 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2439 static jclass LDKCOption_EventZ_Some_class = NULL;
2440 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2441 static jclass LDKCOption_EventZ_None_class = NULL;
2442 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2444 LDKCOption_EventZ_Some_class =
2445 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2446 CHECK(LDKCOption_EventZ_Some_class != NULL);
2447 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2448 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2449 LDKCOption_EventZ_None_class =
2450 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2451 CHECK(LDKCOption_EventZ_None_class != NULL);
2452 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2453 CHECK(LDKCOption_EventZ_None_meth != NULL);
2455 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2456 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2458 case LDKCOption_EventZ_Some: {
2459 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
2460 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2462 case LDKCOption_EventZ_None: {
2463 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2468 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2469 CHECK(owner->result_ok);
2470 return COption_EventZ_clone(&*owner->contents.result);
2472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2473 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2474 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2475 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2476 uintptr_t ret_ref = (uintptr_t)ret_copy;
2480 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2481 CHECK(!owner->result_ok);
2482 return DecodeError_clone(&*owner->contents.err);
2484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2485 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2486 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2487 uintptr_t ret_ref = 0;
2488 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2489 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2490 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2491 ret_ref = (uintptr_t)ret_var.inner;
2492 if (ret_var.is_owned) {
2498 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2499 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2500 static jclass LDKErrorAction_IgnoreError_class = NULL;
2501 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2502 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2503 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2504 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2505 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2506 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2507 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2509 LDKErrorAction_DisconnectPeer_class =
2510 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2511 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2512 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2513 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2514 LDKErrorAction_IgnoreError_class =
2515 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2516 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2517 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2518 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2519 LDKErrorAction_IgnoreAndLog_class =
2520 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2521 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2522 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2523 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2524 LDKErrorAction_IgnoreDuplicateGossip_class =
2525 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2526 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2527 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2528 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2529 LDKErrorAction_SendErrorMessage_class =
2530 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2531 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2532 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2533 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2535 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2536 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2538 case LDKErrorAction_DisconnectPeer: {
2539 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2540 uintptr_t msg_ref = 0;
2541 if ((uintptr_t)msg_var.inner > 4096) {
2542 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2543 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2544 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2545 msg_ref = (uintptr_t)msg_var.inner & ~1;
2547 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2549 case LDKErrorAction_IgnoreError: {
2550 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2552 case LDKErrorAction_IgnoreAndLog: {
2553 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2554 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2556 case LDKErrorAction_IgnoreDuplicateGossip: {
2557 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2559 case LDKErrorAction_SendErrorMessage: {
2560 LDKErrorMessage msg_var = obj->send_error_message.msg;
2561 uintptr_t msg_ref = 0;
2562 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2563 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2564 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2565 msg_ref = (uintptr_t)msg_var.inner & ~1;
2566 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2571 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2572 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2573 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2574 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2575 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2576 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2577 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2578 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2579 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
2580 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
2581 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2582 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2583 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2584 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2585 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2586 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2587 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2588 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2589 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2590 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2591 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2592 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2593 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2594 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2595 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2596 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2597 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2598 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2599 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2600 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2601 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2602 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2603 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2604 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2605 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2606 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2607 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2608 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2610 LDKMessageSendEvent_SendAcceptChannel_class =
2611 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2612 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2613 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2614 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2615 LDKMessageSendEvent_SendOpenChannel_class =
2616 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2617 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2618 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2619 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2620 LDKMessageSendEvent_SendFundingCreated_class =
2621 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2622 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2623 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2624 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2625 LDKMessageSendEvent_SendFundingSigned_class =
2626 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2627 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2628 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2629 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2630 LDKMessageSendEvent_SendFundingLocked_class =
2631 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked"));
2632 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
2633 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
2634 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
2635 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2636 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2637 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2638 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2639 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2640 LDKMessageSendEvent_UpdateHTLCs_class =
2641 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2642 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2643 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2644 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2645 LDKMessageSendEvent_SendRevokeAndACK_class =
2646 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2647 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2648 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2649 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2650 LDKMessageSendEvent_SendClosingSigned_class =
2651 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2652 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2653 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2654 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2655 LDKMessageSendEvent_SendShutdown_class =
2656 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2657 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2658 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2659 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2660 LDKMessageSendEvent_SendChannelReestablish_class =
2661 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2662 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2663 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2664 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2665 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2666 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2667 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2668 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2669 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2670 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2671 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2672 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2673 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2674 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2675 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2676 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2677 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2678 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2679 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2680 LDKMessageSendEvent_SendChannelUpdate_class =
2681 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2682 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2683 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2684 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2685 LDKMessageSendEvent_HandleError_class =
2686 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2687 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2688 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2689 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2690 LDKMessageSendEvent_SendChannelRangeQuery_class =
2691 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2692 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2693 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2694 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2695 LDKMessageSendEvent_SendShortIdsQuery_class =
2696 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2697 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2698 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2699 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2700 LDKMessageSendEvent_SendReplyChannelRange_class =
2701 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2702 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2703 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2704 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2706 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2707 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2709 case LDKMessageSendEvent_SendAcceptChannel: {
2710 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2711 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2712 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2713 uintptr_t msg_ref = 0;
2714 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2715 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2716 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2717 msg_ref = (uintptr_t)msg_var.inner & ~1;
2718 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2720 case LDKMessageSendEvent_SendOpenChannel: {
2721 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2722 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2723 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2724 uintptr_t msg_ref = 0;
2725 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2726 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2727 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2728 msg_ref = (uintptr_t)msg_var.inner & ~1;
2729 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2731 case LDKMessageSendEvent_SendFundingCreated: {
2732 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2733 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2734 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2735 uintptr_t msg_ref = 0;
2736 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2737 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2738 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2739 msg_ref = (uintptr_t)msg_var.inner & ~1;
2740 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2742 case LDKMessageSendEvent_SendFundingSigned: {
2743 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2744 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2745 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2746 uintptr_t msg_ref = 0;
2747 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2748 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2749 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2750 msg_ref = (uintptr_t)msg_var.inner & ~1;
2751 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2753 case LDKMessageSendEvent_SendFundingLocked: {
2754 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2755 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
2756 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2757 uintptr_t msg_ref = 0;
2758 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2759 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2760 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2761 msg_ref = (uintptr_t)msg_var.inner & ~1;
2762 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
2764 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2765 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2766 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2767 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2768 uintptr_t msg_ref = 0;
2769 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2770 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2771 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2772 msg_ref = (uintptr_t)msg_var.inner & ~1;
2773 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2775 case LDKMessageSendEvent_UpdateHTLCs: {
2776 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2777 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2778 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2779 uintptr_t updates_ref = 0;
2780 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2781 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2782 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2783 updates_ref = (uintptr_t)updates_var.inner & ~1;
2784 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2786 case LDKMessageSendEvent_SendRevokeAndACK: {
2787 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2788 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2789 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2790 uintptr_t msg_ref = 0;
2791 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2792 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2793 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2794 msg_ref = (uintptr_t)msg_var.inner & ~1;
2795 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2797 case LDKMessageSendEvent_SendClosingSigned: {
2798 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2799 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2800 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2801 uintptr_t msg_ref = 0;
2802 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2803 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2804 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2805 msg_ref = (uintptr_t)msg_var.inner & ~1;
2806 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2808 case LDKMessageSendEvent_SendShutdown: {
2809 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2810 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2811 LDKShutdown msg_var = obj->send_shutdown.msg;
2812 uintptr_t msg_ref = 0;
2813 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2814 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2815 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2816 msg_ref = (uintptr_t)msg_var.inner & ~1;
2817 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2819 case LDKMessageSendEvent_SendChannelReestablish: {
2820 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2821 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2822 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2823 uintptr_t msg_ref = 0;
2824 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2825 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2826 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2827 msg_ref = (uintptr_t)msg_var.inner & ~1;
2828 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2830 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2831 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2832 uintptr_t msg_ref = 0;
2833 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2834 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2835 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2836 msg_ref = (uintptr_t)msg_var.inner & ~1;
2837 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2838 uintptr_t update_msg_ref = 0;
2839 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2840 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2841 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2842 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2843 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2845 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2846 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2847 uintptr_t msg_ref = 0;
2848 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2849 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2850 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2851 msg_ref = (uintptr_t)msg_var.inner & ~1;
2852 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2854 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2855 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2856 uintptr_t msg_ref = 0;
2857 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2858 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2859 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2860 msg_ref = (uintptr_t)msg_var.inner & ~1;
2861 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2863 case LDKMessageSendEvent_SendChannelUpdate: {
2864 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2865 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2866 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2867 uintptr_t msg_ref = 0;
2868 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2869 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2870 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2871 msg_ref = (uintptr_t)msg_var.inner & ~1;
2872 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2874 case LDKMessageSendEvent_HandleError: {
2875 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2876 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2877 uintptr_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2878 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2880 case LDKMessageSendEvent_SendChannelRangeQuery: {
2881 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2882 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
2883 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2884 uintptr_t msg_ref = 0;
2885 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2886 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2887 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2888 msg_ref = (uintptr_t)msg_var.inner & ~1;
2889 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
2891 case LDKMessageSendEvent_SendShortIdsQuery: {
2892 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2893 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
2894 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2895 uintptr_t msg_ref = 0;
2896 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2897 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2898 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2899 msg_ref = (uintptr_t)msg_var.inner & ~1;
2900 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
2902 case LDKMessageSendEvent_SendReplyChannelRange: {
2903 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2904 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
2905 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2906 uintptr_t msg_ref = 0;
2907 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2908 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2909 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2910 msg_ref = (uintptr_t)msg_var.inner & ~1;
2911 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
2916 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2917 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2918 for (size_t i = 0; i < ret.datalen; i++) {
2919 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2923 static inline struct LDKScoringParameters *CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
2924 CHECK(owner->result_ok);
2925 return &*owner->contents.result;
2927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2928 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
2929 LDKScoringParameters ret_var = *CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
2930 uintptr_t ret_ref = 0;
2931 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2932 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2933 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2934 ret_ref = (uintptr_t)ret_var.inner & ~1;
2938 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
2939 CHECK(!owner->result_ok);
2940 return DecodeError_clone(&*owner->contents.err);
2942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2943 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
2944 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
2945 uintptr_t ret_ref = 0;
2946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2949 ret_ref = (uintptr_t)ret_var.inner;
2950 if (ret_var.is_owned) {
2956 static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
2957 CHECK(owner->result_ok);
2958 return &*owner->contents.result;
2960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2961 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
2962 LDKScorer ret_var = *CResult_ScorerDecodeErrorZ_get_ok(owner_conv);
2963 uintptr_t ret_ref = 0;
2964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2967 ret_ref = (uintptr_t)ret_var.inner & ~1;
2971 static inline struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
2972 CHECK(!owner->result_ok);
2973 return DecodeError_clone(&*owner->contents.err);
2975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2976 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
2977 LDKDecodeError ret_var = CResult_ScorerDecodeErrorZ_get_err(owner_conv);
2978 uintptr_t ret_ref = 0;
2979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2982 ret_ref = (uintptr_t)ret_var.inner;
2983 if (ret_var.is_owned) {
2989 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2990 CHECK(owner->result_ok);
2991 return InitFeatures_clone(&*owner->contents.result);
2993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2994 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
2995 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2996 uintptr_t ret_ref = 0;
2997 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2998 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3000 ret_ref = (uintptr_t)ret_var.inner;
3001 if (ret_var.is_owned) {
3007 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3008 CHECK(!owner->result_ok);
3009 return DecodeError_clone(&*owner->contents.err);
3011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3012 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3013 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3014 uintptr_t ret_ref = 0;
3015 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3016 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3018 ret_ref = (uintptr_t)ret_var.inner;
3019 if (ret_var.is_owned) {
3025 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3026 CHECK(owner->result_ok);
3027 return ChannelFeatures_clone(&*owner->contents.result);
3029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3030 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3031 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3032 uintptr_t ret_ref = 0;
3033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3036 ret_ref = (uintptr_t)ret_var.inner;
3037 if (ret_var.is_owned) {
3043 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3044 CHECK(!owner->result_ok);
3045 return DecodeError_clone(&*owner->contents.err);
3047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3048 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3049 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3050 uintptr_t ret_ref = 0;
3051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3054 ret_ref = (uintptr_t)ret_var.inner;
3055 if (ret_var.is_owned) {
3061 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3062 CHECK(owner->result_ok);
3063 return NodeFeatures_clone(&*owner->contents.result);
3065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3066 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3067 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3068 uintptr_t ret_ref = 0;
3069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3072 ret_ref = (uintptr_t)ret_var.inner;
3073 if (ret_var.is_owned) {
3079 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3080 CHECK(!owner->result_ok);
3081 return DecodeError_clone(&*owner->contents.err);
3083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3084 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3085 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3086 uintptr_t ret_ref = 0;
3087 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3088 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3090 ret_ref = (uintptr_t)ret_var.inner;
3091 if (ret_var.is_owned) {
3097 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3098 CHECK(owner->result_ok);
3099 return InvoiceFeatures_clone(&*owner->contents.result);
3101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3102 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3103 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3104 uintptr_t ret_ref = 0;
3105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3108 ret_ref = (uintptr_t)ret_var.inner;
3109 if (ret_var.is_owned) {
3115 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3116 CHECK(!owner->result_ok);
3117 return DecodeError_clone(&*owner->contents.err);
3119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3120 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3121 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3122 uintptr_t ret_ref = 0;
3123 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3124 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3126 ret_ref = (uintptr_t)ret_var.inner;
3127 if (ret_var.is_owned) {
3133 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3134 CHECK(owner->result_ok);
3135 return ChannelTypeFeatures_clone(&*owner->contents.result);
3137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3138 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3139 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3140 uintptr_t ret_ref = 0;
3141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3144 ret_ref = (uintptr_t)ret_var.inner;
3145 if (ret_var.is_owned) {
3151 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3152 CHECK(!owner->result_ok);
3153 return DecodeError_clone(&*owner->contents.err);
3155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3156 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3157 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3158 uintptr_t ret_ref = 0;
3159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3162 ret_ref = (uintptr_t)ret_var.inner;
3163 if (ret_var.is_owned) {
3169 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3170 CHECK(owner->result_ok);
3171 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3174 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3175 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3176 uintptr_t ret_ref = 0;
3177 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3178 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3180 ret_ref = (uintptr_t)ret_var.inner;
3181 if (ret_var.is_owned) {
3187 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3188 CHECK(!owner->result_ok);
3189 return DecodeError_clone(&*owner->contents.err);
3191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3192 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3193 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3194 uintptr_t ret_ref = 0;
3195 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3196 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3197 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3198 ret_ref = (uintptr_t)ret_var.inner;
3199 if (ret_var.is_owned) {
3205 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3206 CHECK(owner->result_ok);
3207 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3210 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3211 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3212 uintptr_t ret_ref = 0;
3213 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3214 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3216 ret_ref = (uintptr_t)ret_var.inner;
3217 if (ret_var.is_owned) {
3223 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3224 CHECK(!owner->result_ok);
3225 return DecodeError_clone(&*owner->contents.err);
3227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3228 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3229 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3230 uintptr_t ret_ref = 0;
3231 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3232 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3234 ret_ref = (uintptr_t)ret_var.inner;
3235 if (ret_var.is_owned) {
3241 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3242 CHECK(owner->result_ok);
3243 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3246 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3247 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3248 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3249 uintptr_t ret_ref = (uintptr_t)ret_copy;
3253 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3254 CHECK(!owner->result_ok);
3255 return DecodeError_clone(&*owner->contents.err);
3257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3258 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3259 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3260 uintptr_t ret_ref = 0;
3261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3264 ret_ref = (uintptr_t)ret_var.inner;
3265 if (ret_var.is_owned) {
3271 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
3272 CHECK(owner->result_ok);
3273 return *owner->contents.result;
3275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3276 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
3277 CResult_NoneNoneZ_get_ok(owner_conv);
3280 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
3281 CHECK(!owner->result_ok);
3282 return *owner->contents.err;
3284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3285 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
3286 CResult_NoneNoneZ_get_err(owner_conv);
3289 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3293 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3294 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3295 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
3299 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3302 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3303 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3304 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3305 jobjectArray ret_arr = NULL;
3306 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3308 for (size_t i = 0; i < ret_var.datalen; i++) {
3309 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
3310 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
3311 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3317 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3318 CHECK(owner->result_ok);
3319 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3322 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3323 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3324 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3325 return ((uintptr_t)ret_conv);
3328 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3329 CHECK(!owner->result_ok);
3330 return *owner->contents.err;
3332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3333 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3334 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3337 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3338 CHECK(owner->result_ok);
3339 return *owner->contents.result;
3341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3342 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3343 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3344 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
3348 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3349 CHECK(!owner->result_ok);
3350 return *owner->contents.err;
3352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3353 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3354 CResult_SignatureNoneZ_get_err(owner_conv);
3357 typedef struct LDKBaseSign_JCalls {
3358 atomic_size_t refcnt;
3361 jmethodID get_per_commitment_point_meth;
3362 jmethodID release_commitment_secret_meth;
3363 jmethodID validate_holder_commitment_meth;
3364 jmethodID channel_keys_id_meth;
3365 jmethodID sign_counterparty_commitment_meth;
3366 jmethodID validate_counterparty_revocation_meth;
3367 jmethodID sign_holder_commitment_and_htlcs_meth;
3368 jmethodID sign_justice_revoked_output_meth;
3369 jmethodID sign_justice_revoked_htlc_meth;
3370 jmethodID sign_counterparty_htlc_transaction_meth;
3371 jmethodID sign_closing_transaction_meth;
3372 jmethodID sign_channel_announcement_meth;
3373 jmethodID ready_channel_meth;
3374 } LDKBaseSign_JCalls;
3375 static void LDKBaseSign_JCalls_free(void* this_arg) {
3376 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3377 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3379 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3380 if (get_jenv_res == JNI_EDETACHED) {
3381 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3383 DO_ASSERT(get_jenv_res == JNI_OK);
3385 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3386 if (get_jenv_res == JNI_EDETACHED) {
3387 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3392 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3393 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3395 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3396 if (get_jenv_res == JNI_EDETACHED) {
3397 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3399 DO_ASSERT(get_jenv_res == JNI_OK);
3401 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3403 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
3404 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3405 (*env)->ExceptionDescribe(env);
3406 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
3408 LDKPublicKey ret_ref;
3409 CHECK((*env)->GetArrayLength(env, ret) == 33);
3410 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3411 if (get_jenv_res == JNI_EDETACHED) {
3412 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3416 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3417 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3419 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3420 if (get_jenv_res == JNI_EDETACHED) {
3421 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3423 DO_ASSERT(get_jenv_res == JNI_OK);
3425 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3427 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
3428 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3429 (*env)->ExceptionDescribe(env);
3430 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
3432 LDKThirtyTwoBytes ret_ref;
3433 CHECK((*env)->GetArrayLength(env, ret) == 32);
3434 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3435 if (get_jenv_res == JNI_EDETACHED) {
3436 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3440 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
3441 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3443 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3444 if (get_jenv_res == JNI_EDETACHED) {
3445 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3447 DO_ASSERT(get_jenv_res == JNI_OK);
3449 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3450 uintptr_t holder_tx_ref = 0;
3451 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
3452 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3453 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3454 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3455 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3456 if (holder_tx_var.is_owned) {
3459 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3461 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
3462 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3463 (*env)->ExceptionDescribe(env);
3464 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
3466 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3467 CHECK_ACCESS(ret_ptr);
3468 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3470 if (get_jenv_res == JNI_EDETACHED) {
3471 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3475 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3476 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3478 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3479 if (get_jenv_res == JNI_EDETACHED) {
3480 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3482 DO_ASSERT(get_jenv_res == JNI_OK);
3484 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3486 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3487 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3488 (*env)->ExceptionDescribe(env);
3489 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
3491 LDKThirtyTwoBytes ret_ref;
3492 CHECK((*env)->GetArrayLength(env, ret) == 32);
3493 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3494 if (get_jenv_res == JNI_EDETACHED) {
3495 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3499 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
3500 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3502 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3503 if (get_jenv_res == JNI_EDETACHED) {
3504 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3506 DO_ASSERT(get_jenv_res == JNI_OK);
3508 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3509 uintptr_t commitment_tx_ref = 0;
3510 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
3511 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3512 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3513 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3514 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3515 if (commitment_tx_var.is_owned) {
3516 commitment_tx_ref |= 1;
3518 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3520 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
3521 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3522 (*env)->ExceptionDescribe(env);
3523 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
3525 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3526 CHECK_ACCESS(ret_ptr);
3527 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3529 if (get_jenv_res == JNI_EDETACHED) {
3530 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3534 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3535 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3537 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3538 if (get_jenv_res == JNI_EDETACHED) {
3539 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3541 DO_ASSERT(get_jenv_res == JNI_OK);
3543 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3544 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3545 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3547 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
3548 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3549 (*env)->ExceptionDescribe(env);
3550 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
3552 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3553 CHECK_ACCESS(ret_ptr);
3554 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3556 if (get_jenv_res == JNI_EDETACHED) {
3557 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3561 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3562 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3564 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3565 if (get_jenv_res == JNI_EDETACHED) {
3566 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3568 DO_ASSERT(get_jenv_res == JNI_OK);
3570 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3571 uintptr_t commitment_tx_ref = 0;
3572 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
3573 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3574 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3575 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3576 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3577 if (commitment_tx_var.is_owned) {
3578 commitment_tx_ref |= 1;
3580 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3582 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
3583 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3584 (*env)->ExceptionDescribe(env);
3585 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
3587 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3588 CHECK_ACCESS(ret_ptr);
3589 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3591 if (get_jenv_res == JNI_EDETACHED) {
3592 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3596 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]) {
3597 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3599 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3600 if (get_jenv_res == JNI_EDETACHED) {
3601 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3603 DO_ASSERT(get_jenv_res == JNI_OK);
3605 LDKTransaction justice_tx_var = justice_tx;
3606 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3607 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3608 Transaction_free(justice_tx_var);
3609 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3610 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3611 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3613 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
3614 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3615 (*env)->ExceptionDescribe(env);
3616 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
3618 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3619 CHECK_ACCESS(ret_ptr);
3620 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3622 if (get_jenv_res == JNI_EDETACHED) {
3623 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3627 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) {
3628 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3630 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3631 if (get_jenv_res == JNI_EDETACHED) {
3632 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3634 DO_ASSERT(get_jenv_res == JNI_OK);
3636 LDKTransaction justice_tx_var = justice_tx;
3637 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3638 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3639 Transaction_free(justice_tx_var);
3640 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3641 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3642 LDKHTLCOutputInCommitment htlc_var = *htlc;
3643 uintptr_t htlc_ref = 0;
3644 htlc_var = HTLCOutputInCommitment_clone(htlc);
3645 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3646 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3647 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3648 htlc_ref = (uintptr_t)htlc_var.inner;
3649 if (htlc_var.is_owned) {
3652 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3654 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);
3655 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3656 (*env)->ExceptionDescribe(env);
3657 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
3659 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3660 CHECK_ACCESS(ret_ptr);
3661 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3663 if (get_jenv_res == JNI_EDETACHED) {
3664 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3668 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) {
3669 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3671 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3672 if (get_jenv_res == JNI_EDETACHED) {
3673 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3675 DO_ASSERT(get_jenv_res == JNI_OK);
3677 LDKTransaction htlc_tx_var = htlc_tx;
3678 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3679 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3680 Transaction_free(htlc_tx_var);
3681 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3682 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3683 LDKHTLCOutputInCommitment htlc_var = *htlc;
3684 uintptr_t htlc_ref = 0;
3685 htlc_var = HTLCOutputInCommitment_clone(htlc);
3686 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3687 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3688 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3689 htlc_ref = (uintptr_t)htlc_var.inner;
3690 if (htlc_var.is_owned) {
3693 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3695 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);
3696 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3697 (*env)->ExceptionDescribe(env);
3698 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
3700 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3701 CHECK_ACCESS(ret_ptr);
3702 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3704 if (get_jenv_res == JNI_EDETACHED) {
3705 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3709 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3710 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3712 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3713 if (get_jenv_res == JNI_EDETACHED) {
3714 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3716 DO_ASSERT(get_jenv_res == JNI_OK);
3718 LDKClosingTransaction closing_tx_var = *closing_tx;
3719 uintptr_t closing_tx_ref = 0;
3720 closing_tx_var = ClosingTransaction_clone(closing_tx);
3721 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3722 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3723 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3724 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
3725 if (closing_tx_var.is_owned) {
3726 closing_tx_ref |= 1;
3728 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3730 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3731 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3732 (*env)->ExceptionDescribe(env);
3733 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
3735 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3736 CHECK_ACCESS(ret_ptr);
3737 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3739 if (get_jenv_res == JNI_EDETACHED) {
3740 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3744 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3745 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3747 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3748 if (get_jenv_res == JNI_EDETACHED) {
3749 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3751 DO_ASSERT(get_jenv_res == JNI_OK);
3753 LDKUnsignedChannelAnnouncement msg_var = *msg;
3754 uintptr_t msg_ref = 0;
3755 msg_var = UnsignedChannelAnnouncement_clone(msg);
3756 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3757 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3758 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3759 msg_ref = (uintptr_t)msg_var.inner;
3760 if (msg_var.is_owned) {
3763 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3765 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
3766 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3767 (*env)->ExceptionDescribe(env);
3768 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
3770 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3771 CHECK_ACCESS(ret_ptr);
3772 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3774 if (get_jenv_res == JNI_EDETACHED) {
3775 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3779 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3780 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3782 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3783 if (get_jenv_res == JNI_EDETACHED) {
3784 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3786 DO_ASSERT(get_jenv_res == JNI_OK);
3788 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3789 uintptr_t channel_parameters_ref = 0;
3790 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
3791 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3792 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3793 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3794 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
3795 if (channel_parameters_var.is_owned) {
3796 channel_parameters_ref |= 1;
3798 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3800 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
3801 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3802 (*env)->ExceptionDescribe(env);
3803 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
3805 if (get_jenv_res == JNI_EDETACHED) {
3806 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3809 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3810 jclass c = (*env)->GetObjectClass(env, o);
3812 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3813 atomic_init(&calls->refcnt, 1);
3814 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3815 calls->o = (*env)->NewWeakGlobalRef(env, o);
3816 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
3817 CHECK(calls->get_per_commitment_point_meth != NULL);
3818 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
3819 CHECK(calls->release_commitment_secret_meth != NULL);
3820 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
3821 CHECK(calls->validate_holder_commitment_meth != NULL);
3822 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
3823 CHECK(calls->channel_keys_id_meth != NULL);
3824 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
3825 CHECK(calls->sign_counterparty_commitment_meth != NULL);
3826 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3827 CHECK(calls->validate_counterparty_revocation_meth != NULL);
3828 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
3829 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
3830 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3831 CHECK(calls->sign_justice_revoked_output_meth != NULL);
3832 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3833 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3834 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3835 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3836 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3837 CHECK(calls->sign_closing_transaction_meth != NULL);
3838 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
3839 CHECK(calls->sign_channel_announcement_meth != NULL);
3840 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
3841 CHECK(calls->ready_channel_meth != NULL);
3843 LDKChannelPublicKeys pubkeys_conv;
3844 pubkeys_conv.inner = (void*)(pubkeys & (~1));
3845 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
3846 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3849 .this_arg = (void*) calls,
3850 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3851 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3852 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3853 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3854 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3855 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3856 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3857 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3858 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3859 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3860 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3861 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3862 .ready_channel = ready_channel_LDKBaseSign_jcall,
3863 .free = LDKBaseSign_JCalls_free,
3864 .pubkeys = pubkeys_conv,
3865 .set_pubkeys = NULL,
3869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3870 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3871 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
3872 return (uint64_t)res_ptr;
3874 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) {
3875 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3876 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3877 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3878 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3879 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
3883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
3884 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3885 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3886 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3887 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3888 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
3892 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) {
3893 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3894 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3895 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3896 LDKHolderCommitmentTransaction holder_tx_conv;
3897 holder_tx_conv.inner = (void*)(holder_tx & (~1));
3898 holder_tx_conv.is_owned = false;
3899 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3900 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3901 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
3902 return (uintptr_t)ret_conv;
3905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
3906 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3907 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3908 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3909 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3910 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
3914 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) {
3915 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3916 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3917 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3918 LDKCommitmentTransaction commitment_tx_conv;
3919 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3920 commitment_tx_conv.is_owned = false;
3921 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3922 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3923 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3924 return (uintptr_t)ret_conv;
3927 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) {
3928 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3929 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3930 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3931 unsigned char secret_arr[32];
3932 CHECK((*env)->GetArrayLength(env, secret) == 32);
3933 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3934 unsigned char (*secret_ref)[32] = &secret_arr;
3935 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3936 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3937 return (uintptr_t)ret_conv;
3940 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) {
3941 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3942 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3943 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3944 LDKHolderCommitmentTransaction commitment_tx_conv;
3945 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
3946 commitment_tx_conv.is_owned = false;
3947 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3948 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3949 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
3950 return (uintptr_t)ret_conv;
3953 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, intptr_t input, int64_t amount, int8_tArray per_commitment_key) {
3954 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3955 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3956 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3957 LDKTransaction justice_tx_ref;
3958 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3959 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3960 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3961 justice_tx_ref.data_is_owned = true;
3962 unsigned char per_commitment_key_arr[32];
3963 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3964 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3965 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3966 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3967 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3968 return (uintptr_t)ret_conv;
3971 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, intptr_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
3972 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3973 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3974 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3975 LDKTransaction justice_tx_ref;
3976 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3977 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3978 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3979 justice_tx_ref.data_is_owned = true;
3980 unsigned char per_commitment_key_arr[32];
3981 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3982 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3983 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3984 LDKHTLCOutputInCommitment htlc_conv;
3985 htlc_conv.inner = (void*)(htlc & (~1));
3986 htlc_conv.is_owned = false;
3987 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3988 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3989 *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);
3990 return (uintptr_t)ret_conv;
3993 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, intptr_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
3994 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
3995 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
3996 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3997 LDKTransaction htlc_tx_ref;
3998 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3999 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4000 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
4001 htlc_tx_ref.data_is_owned = true;
4002 LDKPublicKey per_commitment_point_ref;
4003 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
4004 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
4005 LDKHTLCOutputInCommitment htlc_conv;
4006 htlc_conv.inner = (void*)(htlc & (~1));
4007 htlc_conv.is_owned = false;
4008 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4009 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4010 *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);
4011 return (uintptr_t)ret_conv;
4014 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) {
4015 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4016 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4017 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4018 LDKClosingTransaction closing_tx_conv;
4019 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4020 closing_tx_conv.is_owned = false;
4021 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4022 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4023 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4024 return (uintptr_t)ret_conv;
4027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
4028 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4029 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4030 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4031 LDKUnsignedChannelAnnouncement msg_conv;
4032 msg_conv.inner = (void*)(msg & (~1));
4033 msg_conv.is_owned = false;
4034 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4035 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4036 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4037 return (uintptr_t)ret_conv;
4040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
4041 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4042 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4043 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4044 LDKChannelTransactionParameters channel_parameters_conv;
4045 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4046 channel_parameters_conv.is_owned = false;
4047 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4048 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4051 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4052 if (this_arg->set_pubkeys != NULL)
4053 this_arg->set_pubkeys(this_arg);
4054 return this_arg->pubkeys;
4056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
4057 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4058 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4059 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4060 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4061 uintptr_t ret_ref = 0;
4062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4065 ret_ref = (uintptr_t)ret_var.inner;
4066 if (ret_var.is_owned) {
4072 typedef struct LDKSign_JCalls {
4073 atomic_size_t refcnt;
4076 LDKBaseSign_JCalls* BaseSign;
4077 jmethodID write_meth;
4079 static void LDKSign_JCalls_free(void* this_arg) {
4080 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4081 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4083 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4084 if (get_jenv_res == JNI_EDETACHED) {
4085 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4087 DO_ASSERT(get_jenv_res == JNI_OK);
4089 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4090 if (get_jenv_res == JNI_EDETACHED) {
4091 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4096 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4097 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4099 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4100 if (get_jenv_res == JNI_EDETACHED) {
4101 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4103 DO_ASSERT(get_jenv_res == JNI_OK);
4105 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4107 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4108 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4109 (*env)->ExceptionDescribe(env);
4110 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
4112 LDKCVec_u8Z ret_ref;
4113 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4114 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4115 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4116 if (get_jenv_res == JNI_EDETACHED) {
4117 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4121 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4122 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4123 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4124 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4126 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4127 jclass c = (*env)->GetObjectClass(env, o);
4129 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4130 atomic_init(&calls->refcnt, 1);
4131 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4132 calls->o = (*env)->NewWeakGlobalRef(env, o);
4133 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4134 CHECK(calls->write_meth != NULL);
4136 LDKChannelPublicKeys pubkeys_conv;
4137 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4138 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4139 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4142 .this_arg = (void*) calls,
4143 .write = write_LDKSign_jcall,
4144 .cloned = LDKSign_JCalls_cloned,
4145 .free = LDKSign_JCalls_free,
4146 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
4148 calls->BaseSign = ret.BaseSign.this_arg;
4151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4152 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4153 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
4154 return (uint64_t)res_ptr;
4156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
4157 LDKSign *inp = (LDKSign *)(arg & ~1);
4158 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
4159 DO_ASSERT((res_ptr & 1) == 0);
4160 return (int64_t)(res_ptr | 1);
4162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4163 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4164 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4165 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4166 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4167 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4168 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4169 CVec_u8Z_free(ret_var);
4173 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4174 CHECK(owner->result_ok);
4175 return Sign_clone(&*owner->contents.result);
4177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4178 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4179 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4180 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4181 return (uintptr_t)ret_ret;
4184 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4185 CHECK(!owner->result_ok);
4186 return DecodeError_clone(&*owner->contents.err);
4188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4189 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4190 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4191 uintptr_t ret_ref = 0;
4192 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4193 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4194 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4195 ret_ref = (uintptr_t)ret_var.inner;
4196 if (ret_var.is_owned) {
4202 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4203 CHECK(owner->result_ok);
4204 return *owner->contents.result;
4206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4207 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4208 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
4209 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
4213 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4214 CHECK(!owner->result_ok);
4215 return *owner->contents.err;
4217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4218 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4219 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4222 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4223 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4224 for (size_t i = 0; i < ret.datalen; i++) {
4225 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4229 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4230 CHECK(owner->result_ok);
4231 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4233 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4234 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4235 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4236 jobjectArray ret_arr = NULL;
4237 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4239 for (size_t i = 0; i < ret_var.datalen; i++) {
4240 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
4241 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
4242 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
4243 CVec_u8Z_free(ret_conv_8_var);
4244 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4251 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4252 CHECK(!owner->result_ok);
4253 return *owner->contents.err;
4255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4256 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4257 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4260 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4261 CHECK(owner->result_ok);
4262 return InMemorySigner_clone(&*owner->contents.result);
4264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4265 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4266 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4267 uintptr_t ret_ref = 0;
4268 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4269 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4270 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4271 ret_ref = (uintptr_t)ret_var.inner;
4272 if (ret_var.is_owned) {
4278 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4279 CHECK(!owner->result_ok);
4280 return DecodeError_clone(&*owner->contents.err);
4282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4283 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4284 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4285 uintptr_t ret_ref = 0;
4286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4289 ret_ref = (uintptr_t)ret_var.inner;
4290 if (ret_var.is_owned) {
4296 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4297 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4298 for (size_t i = 0; i < ret.datalen; i++) {
4299 ret.data[i] = TxOut_clone(&orig->data[i]);
4303 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4304 CHECK(owner->result_ok);
4305 return *owner->contents.result;
4307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4308 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4309 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4310 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4311 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4315 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4316 CHECK(!owner->result_ok);
4317 return *owner->contents.err;
4319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4320 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4321 CResult_TransactionNoneZ_get_err(owner_conv);
4324 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4325 return ThirtyTwoBytes_clone(&owner->a);
4327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4328 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4329 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4330 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
4334 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4335 return ChannelMonitor_clone(&owner->b);
4337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4338 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4339 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
4340 uintptr_t ret_ref = 0;
4341 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4342 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4344 ret_ref = (uintptr_t)ret_var.inner;
4345 if (ret_var.is_owned) {
4351 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
4352 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
4353 for (size_t i = 0; i < ret.datalen; i++) {
4354 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
4358 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4359 CHECK(owner->result_ok);
4360 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
4362 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4363 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4364 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
4365 int64_tArray ret_arr = NULL;
4366 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4367 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4368 for (size_t j = 0; j < ret_var.datalen; j++) {
4369 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4370 *ret_conv_35_conv = ret_var.data[j];
4371 ret_arr_ptr[j] = ((uintptr_t)ret_conv_35_conv);
4373 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4378 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4379 CHECK(!owner->result_ok);
4380 return *owner->contents.err;
4382 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4383 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4384 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
4388 static jclass LDKCOption_u16Z_Some_class = NULL;
4389 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4390 static jclass LDKCOption_u16Z_None_class = NULL;
4391 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4393 LDKCOption_u16Z_Some_class =
4394 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4395 CHECK(LDKCOption_u16Z_Some_class != NULL);
4396 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4397 CHECK(LDKCOption_u16Z_Some_meth != NULL);
4398 LDKCOption_u16Z_None_class =
4399 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4400 CHECK(LDKCOption_u16Z_None_class != NULL);
4401 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4402 CHECK(LDKCOption_u16Z_None_meth != NULL);
4404 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4405 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4407 case LDKCOption_u16Z_Some: {
4408 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
4410 case LDKCOption_u16Z_None: {
4411 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4416 static jclass LDKAPIError_APIMisuseError_class = NULL;
4417 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
4418 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
4419 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
4420 static jclass LDKAPIError_RouteError_class = NULL;
4421 static jmethodID LDKAPIError_RouteError_meth = NULL;
4422 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
4423 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
4424 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
4425 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
4426 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
4427 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
4428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
4429 LDKAPIError_APIMisuseError_class =
4430 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
4431 CHECK(LDKAPIError_APIMisuseError_class != NULL);
4432 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
4433 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
4434 LDKAPIError_FeeRateTooHigh_class =
4435 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
4436 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
4437 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
4438 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
4439 LDKAPIError_RouteError_class =
4440 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
4441 CHECK(LDKAPIError_RouteError_class != NULL);
4442 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
4443 CHECK(LDKAPIError_RouteError_meth != NULL);
4444 LDKAPIError_ChannelUnavailable_class =
4445 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
4446 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
4447 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
4448 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
4449 LDKAPIError_MonitorUpdateFailed_class =
4450 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
4451 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
4452 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
4453 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
4454 LDKAPIError_IncompatibleShutdownScript_class =
4455 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
4456 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
4457 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
4458 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
4460 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4461 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4463 case LDKAPIError_APIMisuseError: {
4464 LDKStr err_str = obj->api_misuse_error.err;
4465 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4466 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
4468 case LDKAPIError_FeeRateTooHigh: {
4469 LDKStr err_str = obj->fee_rate_too_high.err;
4470 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4471 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
4473 case LDKAPIError_RouteError: {
4474 LDKStr err_str = obj->route_error.err;
4475 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4476 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
4478 case LDKAPIError_ChannelUnavailable: {
4479 LDKStr err_str = obj->channel_unavailable.err;
4480 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4481 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
4483 case LDKAPIError_MonitorUpdateFailed: {
4484 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
4486 case LDKAPIError_IncompatibleShutdownScript: {
4487 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4488 uintptr_t script_ref = 0;
4489 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4490 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4491 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4492 script_ref = (uintptr_t)script_var.inner & ~1;
4493 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
4498 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4499 CHECK(owner->result_ok);
4500 return *owner->contents.result;
4502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4503 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4504 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4507 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4508 CHECK(!owner->result_ok);
4509 return APIError_clone(&*owner->contents.err);
4511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4512 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4513 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4514 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4515 uintptr_t ret_ref = (uintptr_t)ret_copy;
4519 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4520 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4521 for (size_t i = 0; i < ret.datalen; i++) {
4522 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4526 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4527 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4528 for (size_t i = 0; i < ret.datalen; i++) {
4529 ret.data[i] = APIError_clone(&orig->data[i]);
4533 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4534 CHECK(owner->result_ok);
4535 return ThirtyTwoBytes_clone(&*owner->contents.result);
4537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4538 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4539 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4540 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
4544 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4545 CHECK(!owner->result_ok);
4546 return APIError_clone(&*owner->contents.err);
4548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4549 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4550 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4551 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4552 uintptr_t ret_ref = (uintptr_t)ret_copy;
4556 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
4557 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
4558 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
4559 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
4560 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
4561 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
4562 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
4563 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
4564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
4565 LDKPaymentSendFailure_ParameterError_class =
4566 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
4567 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
4568 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
4569 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
4570 LDKPaymentSendFailure_PathParameterError_class =
4571 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
4572 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
4573 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
4574 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
4575 LDKPaymentSendFailure_AllFailedRetrySafe_class =
4576 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
4577 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
4578 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
4579 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
4580 LDKPaymentSendFailure_PartialFailure_class =
4581 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
4582 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
4583 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
4584 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
4586 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4587 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4589 case LDKPaymentSendFailure_ParameterError: {
4590 uintptr_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
4591 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
4593 case LDKPaymentSendFailure_PathParameterError: {
4594 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4595 int64_tArray path_parameter_error_arr = NULL;
4596 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
4597 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
4598 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4599 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4600 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4601 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4602 path_parameter_error_arr_ptr[w] = (uintptr_t)path_parameter_error_conv_22_conv;
4604 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
4605 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
4607 case LDKPaymentSendFailure_AllFailedRetrySafe: {
4608 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4609 int64_tArray all_failed_retry_safe_arr = NULL;
4610 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
4611 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
4612 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4613 uintptr_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
4614 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4616 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
4617 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
4619 case LDKPaymentSendFailure_PartialFailure: {
4620 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4621 int64_tArray results_arr = NULL;
4622 results_arr = (*env)->NewLongArray(env, results_var.datalen);
4623 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
4624 for (size_t w = 0; w < results_var.datalen; w++) {
4625 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4626 *results_conv_22_conv = results_var.data[w];
4627 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4628 results_arr_ptr[w] = (uintptr_t)results_conv_22_conv;
4630 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
4631 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4632 uintptr_t failed_paths_retry_ref = 0;
4633 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
4634 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4635 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4636 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4637 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
4639 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
4640 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
4641 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
4646 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4647 CHECK(owner->result_ok);
4648 return ThirtyTwoBytes_clone(&*owner->contents.result);
4650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4651 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4652 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4653 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
4657 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4658 CHECK(!owner->result_ok);
4659 return PaymentSendFailure_clone(&*owner->contents.err);
4661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4662 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
4663 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4664 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4665 uintptr_t ret_ref = (uintptr_t)ret_copy;
4669 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4670 CHECK(owner->result_ok);
4671 return *owner->contents.result;
4673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4674 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4675 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4678 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4679 CHECK(!owner->result_ok);
4680 return PaymentSendFailure_clone(&*owner->contents.err);
4682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4683 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
4684 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4685 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4686 uintptr_t ret_ref = (uintptr_t)ret_copy;
4690 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4691 return ThirtyTwoBytes_clone(&owner->a);
4693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4694 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4695 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4696 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
4700 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4701 return ThirtyTwoBytes_clone(&owner->b);
4703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4704 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
4705 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4706 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
4710 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4711 CHECK(owner->result_ok);
4712 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4715 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4716 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4717 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4718 return ((uintptr_t)ret_conv);
4721 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4722 CHECK(!owner->result_ok);
4723 return PaymentSendFailure_clone(&*owner->contents.err);
4725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4726 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
4727 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4728 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4729 uintptr_t ret_ref = (uintptr_t)ret_copy;
4733 static jclass LDKNetAddress_IPv4_class = NULL;
4734 static jmethodID LDKNetAddress_IPv4_meth = NULL;
4735 static jclass LDKNetAddress_IPv6_class = NULL;
4736 static jmethodID LDKNetAddress_IPv6_meth = NULL;
4737 static jclass LDKNetAddress_OnionV2_class = NULL;
4738 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
4739 static jclass LDKNetAddress_OnionV3_class = NULL;
4740 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
4741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
4742 LDKNetAddress_IPv4_class =
4743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
4744 CHECK(LDKNetAddress_IPv4_class != NULL);
4745 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
4746 CHECK(LDKNetAddress_IPv4_meth != NULL);
4747 LDKNetAddress_IPv6_class =
4748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
4749 CHECK(LDKNetAddress_IPv6_class != NULL);
4750 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
4751 CHECK(LDKNetAddress_IPv6_meth != NULL);
4752 LDKNetAddress_OnionV2_class =
4753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
4754 CHECK(LDKNetAddress_OnionV2_class != NULL);
4755 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
4756 CHECK(LDKNetAddress_OnionV2_meth != NULL);
4757 LDKNetAddress_OnionV3_class =
4758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
4759 CHECK(LDKNetAddress_OnionV3_class != NULL);
4760 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
4761 CHECK(LDKNetAddress_OnionV3_meth != NULL);
4763 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4764 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
4766 case LDKNetAddress_IPv4: {
4767 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
4768 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
4769 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
4771 case LDKNetAddress_IPv6: {
4772 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
4773 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
4774 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
4776 case LDKNetAddress_OnionV2: {
4777 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
4778 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
4779 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
4781 case LDKNetAddress_OnionV3: {
4782 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
4783 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
4784 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);
4789 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
4790 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
4791 for (size_t i = 0; i < ret.datalen; i++) {
4792 ret.data[i] = NetAddress_clone(&orig->data[i]);
4796 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4797 return ThirtyTwoBytes_clone(&owner->a);
4799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4800 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4801 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4802 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
4806 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4807 return ThirtyTwoBytes_clone(&owner->b);
4809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4810 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
4811 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4812 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
4816 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4817 CHECK(owner->result_ok);
4818 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4821 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4822 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4823 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4824 return ((uintptr_t)ret_conv);
4827 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4828 CHECK(!owner->result_ok);
4829 return *owner->contents.err;
4831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4832 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
4833 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4836 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4837 CHECK(owner->result_ok);
4838 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4841 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4842 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4843 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4844 return ((uintptr_t)ret_conv);
4847 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4848 CHECK(!owner->result_ok);
4849 return APIError_clone(&*owner->contents.err);
4851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4852 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
4853 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4854 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4855 uintptr_t ret_ref = (uintptr_t)ret_copy;
4859 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4860 CHECK(owner->result_ok);
4861 return ThirtyTwoBytes_clone(&*owner->contents.result);
4863 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4864 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4865 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4866 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
4870 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4871 CHECK(!owner->result_ok);
4872 return *owner->contents.err;
4874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4875 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
4876 CResult_PaymentSecretNoneZ_get_err(owner_conv);
4879 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4880 CHECK(owner->result_ok);
4881 return ThirtyTwoBytes_clone(&*owner->contents.result);
4883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4884 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4885 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4886 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
4890 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4891 CHECK(!owner->result_ok);
4892 return APIError_clone(&*owner->contents.err);
4894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4895 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
4896 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4897 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4898 uintptr_t ret_ref = (uintptr_t)ret_copy;
4902 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4903 CHECK(owner->result_ok);
4904 return ThirtyTwoBytes_clone(&*owner->contents.result);
4906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4907 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4908 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4909 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
4913 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4914 CHECK(!owner->result_ok);
4915 return APIError_clone(&*owner->contents.err);
4917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4918 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
4919 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4920 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4921 uintptr_t ret_ref = (uintptr_t)ret_copy;
4925 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4926 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4927 for (size_t i = 0; i < ret.datalen; i++) {
4928 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4932 typedef struct LDKWatch_JCalls {
4933 atomic_size_t refcnt;
4936 jmethodID watch_channel_meth;
4937 jmethodID update_channel_meth;
4938 jmethodID release_pending_monitor_events_meth;
4940 static void LDKWatch_JCalls_free(void* this_arg) {
4941 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4942 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4944 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4945 if (get_jenv_res == JNI_EDETACHED) {
4946 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4948 DO_ASSERT(get_jenv_res == JNI_OK);
4950 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4951 if (get_jenv_res == JNI_EDETACHED) {
4952 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4957 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4958 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4960 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4961 if (get_jenv_res == JNI_EDETACHED) {
4962 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4964 DO_ASSERT(get_jenv_res == JNI_OK);
4966 LDKOutPoint funding_txo_var = funding_txo;
4967 uintptr_t funding_txo_ref = 0;
4968 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4969 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4970 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4971 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
4972 if (funding_txo_var.is_owned) {
4973 funding_txo_ref |= 1;
4975 LDKChannelMonitor monitor_var = monitor;
4976 uintptr_t monitor_ref = 0;
4977 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4978 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4979 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4980 monitor_ref = (uintptr_t)monitor_var.inner;
4981 if (monitor_var.is_owned) {
4984 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4986 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
4987 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4988 (*env)->ExceptionDescribe(env);
4989 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
4991 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4992 CHECK_ACCESS(ret_ptr);
4993 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4995 if (get_jenv_res == JNI_EDETACHED) {
4996 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5000 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5001 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5003 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5004 if (get_jenv_res == JNI_EDETACHED) {
5005 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5007 DO_ASSERT(get_jenv_res == JNI_OK);
5009 LDKOutPoint funding_txo_var = funding_txo;
5010 uintptr_t funding_txo_ref = 0;
5011 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5012 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5013 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5014 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5015 if (funding_txo_var.is_owned) {
5016 funding_txo_ref |= 1;
5018 LDKChannelMonitorUpdate update_var = update;
5019 uintptr_t update_ref = 0;
5020 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5021 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5022 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5023 update_ref = (uintptr_t)update_var.inner;
5024 if (update_var.is_owned) {
5027 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5029 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
5030 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5031 (*env)->ExceptionDescribe(env);
5032 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
5034 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5035 CHECK_ACCESS(ret_ptr);
5036 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5038 if (get_jenv_res == JNI_EDETACHED) {
5039 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5043 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5044 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5046 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5047 if (get_jenv_res == JNI_EDETACHED) {
5048 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5050 DO_ASSERT(get_jenv_res == JNI_OK);
5052 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5054 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
5055 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5056 (*env)->ExceptionDescribe(env);
5057 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
5059 LDKCVec_MonitorEventZ ret_constr;
5060 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5061 if (ret_constr.datalen > 0)
5062 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5064 ret_constr.data = NULL;
5065 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5066 for (size_t o = 0; o < ret_constr.datalen; o++) {
5067 int64_t ret_conv_14 = ret_vals[o];
5068 void* ret_conv_14_ptr = (void*)(((uintptr_t)ret_conv_14) & ~1);
5069 CHECK_ACCESS(ret_conv_14_ptr);
5070 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
5071 FREE((void*)ret_conv_14);
5072 ret_constr.data[o] = ret_conv_14_conv;
5074 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5075 if (get_jenv_res == JNI_EDETACHED) {
5076 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5080 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5081 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5082 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5084 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
5085 jclass c = (*env)->GetObjectClass(env, o);
5087 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5088 atomic_init(&calls->refcnt, 1);
5089 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5090 calls->o = (*env)->NewWeakGlobalRef(env, o);
5091 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
5092 CHECK(calls->watch_channel_meth != NULL);
5093 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
5094 CHECK(calls->update_channel_meth != NULL);
5095 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
5096 CHECK(calls->release_pending_monitor_events_meth != NULL);
5099 .this_arg = (void*) calls,
5100 .watch_channel = watch_channel_LDKWatch_jcall,
5101 .update_channel = update_channel_LDKWatch_jcall,
5102 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5103 .free = LDKWatch_JCalls_free,
5107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
5108 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5109 *res_ptr = LDKWatch_init(env, clz, o);
5110 return (uint64_t)res_ptr;
5112 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) {
5113 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5114 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5115 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5116 LDKOutPoint funding_txo_conv;
5117 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5118 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5119 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5120 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5121 LDKChannelMonitor monitor_conv;
5122 monitor_conv.inner = (void*)(monitor & (~1));
5123 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5124 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5125 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5126 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5127 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5128 return (uintptr_t)ret_conv;
5131 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) {
5132 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5133 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5134 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5135 LDKOutPoint funding_txo_conv;
5136 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5137 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5138 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5139 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5140 LDKChannelMonitorUpdate update_conv;
5141 update_conv.inner = (void*)(update & (~1));
5142 update_conv.is_owned = (update & 1) || (update == 0);
5143 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5144 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5145 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5146 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5147 return (uintptr_t)ret_conv;
5150 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
5151 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5152 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5153 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5154 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5155 int64_tArray ret_arr = NULL;
5156 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5157 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5158 for (size_t o = 0; o < ret_var.datalen; o++) {
5159 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5160 *ret_conv_14_copy = ret_var.data[o];
5161 uintptr_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
5162 ret_arr_ptr[o] = ret_conv_14_ref;
5164 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5169 typedef struct LDKBroadcasterInterface_JCalls {
5170 atomic_size_t refcnt;
5173 jmethodID broadcast_transaction_meth;
5174 } LDKBroadcasterInterface_JCalls;
5175 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5176 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5177 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5179 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5180 if (get_jenv_res == JNI_EDETACHED) {
5181 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5183 DO_ASSERT(get_jenv_res == JNI_OK);
5185 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5186 if (get_jenv_res == JNI_EDETACHED) {
5187 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5192 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5193 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5195 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5196 if (get_jenv_res == JNI_EDETACHED) {
5197 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5199 DO_ASSERT(get_jenv_res == JNI_OK);
5201 LDKTransaction tx_var = tx;
5202 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
5203 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
5204 Transaction_free(tx_var);
5205 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5207 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
5208 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5209 (*env)->ExceptionDescribe(env);
5210 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
5212 if (get_jenv_res == JNI_EDETACHED) {
5213 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5216 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5217 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5218 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5220 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
5221 jclass c = (*env)->GetObjectClass(env, o);
5223 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5224 atomic_init(&calls->refcnt, 1);
5225 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5226 calls->o = (*env)->NewWeakGlobalRef(env, o);
5227 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
5228 CHECK(calls->broadcast_transaction_meth != NULL);
5230 LDKBroadcasterInterface ret = {
5231 .this_arg = (void*) calls,
5232 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5233 .free = LDKBroadcasterInterface_JCalls_free,
5237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
5238 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5239 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
5240 return (uint64_t)res_ptr;
5242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
5243 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5244 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5245 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5246 LDKTransaction tx_ref;
5247 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
5248 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5249 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
5250 tx_ref.data_is_owned = true;
5251 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5254 typedef struct LDKKeysInterface_JCalls {
5255 atomic_size_t refcnt;
5258 jmethodID get_node_secret_meth;
5259 jmethodID get_destination_script_meth;
5260 jmethodID get_shutdown_scriptpubkey_meth;
5261 jmethodID get_channel_signer_meth;
5262 jmethodID get_secure_random_bytes_meth;
5263 jmethodID read_chan_signer_meth;
5264 jmethodID sign_invoice_meth;
5265 jmethodID get_inbound_payment_key_material_meth;
5266 } LDKKeysInterface_JCalls;
5267 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5268 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5269 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5271 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5272 if (get_jenv_res == JNI_EDETACHED) {
5273 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5275 DO_ASSERT(get_jenv_res == JNI_OK);
5277 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5278 if (get_jenv_res == JNI_EDETACHED) {
5279 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5284 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
5285 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5287 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5288 if (get_jenv_res == JNI_EDETACHED) {
5289 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5291 DO_ASSERT(get_jenv_res == JNI_OK);
5293 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5295 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
5296 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5297 (*env)->ExceptionDescribe(env);
5298 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
5300 LDKSecretKey ret_ref;
5301 CHECK((*env)->GetArrayLength(env, ret) == 32);
5302 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
5303 if (get_jenv_res == JNI_EDETACHED) {
5304 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5308 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5309 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5311 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5312 if (get_jenv_res == JNI_EDETACHED) {
5313 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5315 DO_ASSERT(get_jenv_res == JNI_OK);
5317 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5319 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
5320 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5321 (*env)->ExceptionDescribe(env);
5322 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
5324 LDKCVec_u8Z ret_ref;
5325 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5326 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5327 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5328 if (get_jenv_res == JNI_EDETACHED) {
5329 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5333 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5334 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5336 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5337 if (get_jenv_res == JNI_EDETACHED) {
5338 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5340 DO_ASSERT(get_jenv_res == JNI_OK);
5342 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5344 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
5345 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5346 (*env)->ExceptionDescribe(env);
5347 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
5349 LDKShutdownScript ret_conv;
5350 ret_conv.inner = (void*)(ret & (~1));
5351 ret_conv.is_owned = (ret & 1) || (ret == 0);
5352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5353 if (get_jenv_res == JNI_EDETACHED) {
5354 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5358 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5359 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5361 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5362 if (get_jenv_res == JNI_EDETACHED) {
5363 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5365 DO_ASSERT(get_jenv_res == JNI_OK);
5367 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5369 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
5370 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5371 (*env)->ExceptionDescribe(env);
5372 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
5374 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5375 CHECK_ACCESS(ret_ptr);
5376 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5378 if (get_jenv_res == JNI_EDETACHED) {
5379 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5383 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5384 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5386 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5387 if (get_jenv_res == JNI_EDETACHED) {
5388 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5390 DO_ASSERT(get_jenv_res == JNI_OK);
5392 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5394 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
5395 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5396 (*env)->ExceptionDescribe(env);
5397 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
5399 LDKThirtyTwoBytes ret_ref;
5400 CHECK((*env)->GetArrayLength(env, ret) == 32);
5401 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5402 if (get_jenv_res == JNI_EDETACHED) {
5403 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5407 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5408 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5410 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5411 if (get_jenv_res == JNI_EDETACHED) {
5412 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5414 DO_ASSERT(get_jenv_res == JNI_OK);
5416 LDKu8slice reader_var = reader;
5417 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
5418 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
5419 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5421 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
5422 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5423 (*env)->ExceptionDescribe(env);
5424 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
5426 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5427 CHECK_ACCESS(ret_ptr);
5428 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5430 if (get_jenv_res == JNI_EDETACHED) {
5431 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5435 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
5436 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5438 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5439 if (get_jenv_res == JNI_EDETACHED) {
5440 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5442 DO_ASSERT(get_jenv_res == JNI_OK);
5444 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
5445 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
5446 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
5447 CVec_u8Z_free(invoice_preimage_var);
5448 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5450 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
5451 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5452 (*env)->ExceptionDescribe(env);
5453 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
5455 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5456 CHECK_ACCESS(ret_ptr);
5457 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5459 if (get_jenv_res == JNI_EDETACHED) {
5460 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5464 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5465 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5467 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5468 if (get_jenv_res == JNI_EDETACHED) {
5469 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5471 DO_ASSERT(get_jenv_res == JNI_OK);
5473 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5475 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
5476 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5477 (*env)->ExceptionDescribe(env);
5478 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
5480 LDKThirtyTwoBytes ret_ref;
5481 CHECK((*env)->GetArrayLength(env, ret) == 32);
5482 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5483 if (get_jenv_res == JNI_EDETACHED) {
5484 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5488 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5489 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5490 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5492 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
5493 jclass c = (*env)->GetObjectClass(env, o);
5495 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5496 atomic_init(&calls->refcnt, 1);
5497 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5498 calls->o = (*env)->NewWeakGlobalRef(env, o);
5499 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
5500 CHECK(calls->get_node_secret_meth != NULL);
5501 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
5502 CHECK(calls->get_destination_script_meth != NULL);
5503 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
5504 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
5505 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
5506 CHECK(calls->get_channel_signer_meth != NULL);
5507 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
5508 CHECK(calls->get_secure_random_bytes_meth != NULL);
5509 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
5510 CHECK(calls->read_chan_signer_meth != NULL);
5511 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
5512 CHECK(calls->sign_invoice_meth != NULL);
5513 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
5514 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
5516 LDKKeysInterface ret = {
5517 .this_arg = (void*) calls,
5518 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5519 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5520 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5521 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5522 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5523 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5524 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5525 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5526 .free = LDKKeysInterface_JCalls_free,
5530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
5531 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5532 *res_ptr = LDKKeysInterface_init(env, clz, o);
5533 return (uint64_t)res_ptr;
5535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
5536 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5537 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5538 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5539 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5540 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
5544 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
5545 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5546 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5547 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5548 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5549 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5550 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5551 CVec_u8Z_free(ret_var);
5555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
5556 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5557 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5558 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5559 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5560 uintptr_t ret_ref = 0;
5561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5564 ret_ref = (uintptr_t)ret_var.inner;
5565 if (ret_var.is_owned) {
5571 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) {
5572 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5573 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5574 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5575 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5576 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5577 return (uintptr_t)ret_ret;
5580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
5581 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5582 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5583 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5584 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5585 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
5589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
5590 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5591 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5592 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5593 LDKu8slice reader_ref;
5594 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
5595 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
5596 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5597 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5598 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
5599 return (uintptr_t)ret_conv;
5602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
5603 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5604 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5605 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5606 LDKCVec_u8Z invoice_preimage_ref;
5607 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
5608 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
5609 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
5610 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5611 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
5612 return (uintptr_t)ret_conv;
5615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
5616 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5617 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5618 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5619 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5620 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
5624 typedef struct LDKFeeEstimator_JCalls {
5625 atomic_size_t refcnt;
5628 jmethodID get_est_sat_per_1000_weight_meth;
5629 } LDKFeeEstimator_JCalls;
5630 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5631 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5632 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5634 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5635 if (get_jenv_res == JNI_EDETACHED) {
5636 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5638 DO_ASSERT(get_jenv_res == JNI_OK);
5640 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5641 if (get_jenv_res == JNI_EDETACHED) {
5642 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5647 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5648 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5650 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5651 if (get_jenv_res == JNI_EDETACHED) {
5652 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5654 DO_ASSERT(get_jenv_res == JNI_OK);
5656 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
5657 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5659 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
5660 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5661 (*env)->ExceptionDescribe(env);
5662 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
5664 if (get_jenv_res == JNI_EDETACHED) {
5665 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5669 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5670 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5671 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5673 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
5674 jclass c = (*env)->GetObjectClass(env, o);
5676 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5677 atomic_init(&calls->refcnt, 1);
5678 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5679 calls->o = (*env)->NewWeakGlobalRef(env, o);
5680 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
5681 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
5683 LDKFeeEstimator ret = {
5684 .this_arg = (void*) calls,
5685 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5686 .free = LDKFeeEstimator_JCalls_free,
5690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
5691 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5692 *res_ptr = LDKFeeEstimator_init(env, clz, o);
5693 return (uint64_t)res_ptr;
5695 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) {
5696 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5697 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5698 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5699 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
5700 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5704 typedef struct LDKLogger_JCalls {
5705 atomic_size_t refcnt;
5710 static void LDKLogger_JCalls_free(void* this_arg) {
5711 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5712 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5714 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5715 if (get_jenv_res == JNI_EDETACHED) {
5716 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5718 DO_ASSERT(get_jenv_res == JNI_OK);
5720 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5721 if (get_jenv_res == JNI_EDETACHED) {
5722 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5727 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
5728 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5730 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5731 if (get_jenv_res == JNI_EDETACHED) {
5732 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5734 DO_ASSERT(get_jenv_res == JNI_OK);
5736 LDKRecord record_var = *record;
5737 uintptr_t record_ref = 0;
5738 record_var = Record_clone(record);
5739 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5740 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5741 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
5742 record_ref = (uintptr_t)record_var.inner;
5743 if (record_var.is_owned) {
5746 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5748 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
5749 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5750 (*env)->ExceptionDescribe(env);
5751 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
5753 if (get_jenv_res == JNI_EDETACHED) {
5754 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5757 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
5758 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
5759 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5761 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
5762 jclass c = (*env)->GetObjectClass(env, o);
5764 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
5765 atomic_init(&calls->refcnt, 1);
5766 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5767 calls->o = (*env)->NewWeakGlobalRef(env, o);
5768 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
5769 CHECK(calls->log_meth != NULL);
5772 .this_arg = (void*) calls,
5773 .log = log_LDKLogger_jcall,
5774 .free = LDKLogger_JCalls_free,
5778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
5779 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
5780 *res_ptr = LDKLogger_init(env, clz, o);
5781 return (uint64_t)res_ptr;
5783 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5784 return ThirtyTwoBytes_clone(&owner->a);
5786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5787 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5788 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5789 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
5793 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5797 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
5798 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5799 uintptr_t ret_ref = 0;
5800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5803 ret_ref = (uintptr_t)ret_var.inner & ~1;
5807 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5808 CHECK(owner->result_ok);
5809 return &*owner->contents.result;
5811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5812 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5813 uintptr_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
5817 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5818 CHECK(!owner->result_ok);
5819 return DecodeError_clone(&*owner->contents.err);
5821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5822 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
5823 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5824 uintptr_t ret_ref = 0;
5825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5828 ret_ref = (uintptr_t)ret_var.inner;
5829 if (ret_var.is_owned) {
5835 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5836 CHECK(owner->result_ok);
5837 return ChannelConfig_clone(&*owner->contents.result);
5839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5840 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5841 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5842 uintptr_t ret_ref = 0;
5843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5846 ret_ref = (uintptr_t)ret_var.inner;
5847 if (ret_var.is_owned) {
5853 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5854 CHECK(!owner->result_ok);
5855 return DecodeError_clone(&*owner->contents.err);
5857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5858 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
5859 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5860 uintptr_t ret_ref = 0;
5861 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5862 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5864 ret_ref = (uintptr_t)ret_var.inner;
5865 if (ret_var.is_owned) {
5871 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5872 CHECK(owner->result_ok);
5873 return OutPoint_clone(&*owner->contents.result);
5875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5876 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5877 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5878 uintptr_t ret_ref = 0;
5879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5882 ret_ref = (uintptr_t)ret_var.inner;
5883 if (ret_var.is_owned) {
5889 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5890 CHECK(!owner->result_ok);
5891 return DecodeError_clone(&*owner->contents.err);
5893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5894 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
5895 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5896 uintptr_t ret_ref = 0;
5897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5900 ret_ref = (uintptr_t)ret_var.inner;
5901 if (ret_var.is_owned) {
5907 typedef struct LDKType_JCalls {
5908 atomic_size_t refcnt;
5911 jmethodID type_id_meth;
5912 jmethodID debug_str_meth;
5913 jmethodID write_meth;
5915 static void LDKType_JCalls_free(void* this_arg) {
5916 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5917 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5919 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5920 if (get_jenv_res == JNI_EDETACHED) {
5921 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5923 DO_ASSERT(get_jenv_res == JNI_OK);
5925 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5926 if (get_jenv_res == JNI_EDETACHED) {
5927 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5932 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5933 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5935 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5936 if (get_jenv_res == JNI_EDETACHED) {
5937 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5939 DO_ASSERT(get_jenv_res == JNI_OK);
5941 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5943 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
5944 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5945 (*env)->ExceptionDescribe(env);
5946 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
5948 if (get_jenv_res == JNI_EDETACHED) {
5949 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5953 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5954 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5956 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5957 if (get_jenv_res == JNI_EDETACHED) {
5958 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5960 DO_ASSERT(get_jenv_res == JNI_OK);
5962 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5964 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
5965 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5966 (*env)->ExceptionDescribe(env);
5967 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
5969 LDKStr ret_conv = java_to_owned_str(env, ret);
5970 if (get_jenv_res == JNI_EDETACHED) {
5971 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5975 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5976 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5978 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5979 if (get_jenv_res == JNI_EDETACHED) {
5980 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5982 DO_ASSERT(get_jenv_res == JNI_OK);
5984 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5986 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
5987 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5988 (*env)->ExceptionDescribe(env);
5989 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
5991 LDKCVec_u8Z ret_ref;
5992 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5993 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5994 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5995 if (get_jenv_res == JNI_EDETACHED) {
5996 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6000 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6001 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6002 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6004 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
6005 jclass c = (*env)->GetObjectClass(env, o);
6007 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6008 atomic_init(&calls->refcnt, 1);
6009 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6010 calls->o = (*env)->NewWeakGlobalRef(env, o);
6011 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
6012 CHECK(calls->type_id_meth != NULL);
6013 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
6014 CHECK(calls->debug_str_meth != NULL);
6015 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
6016 CHECK(calls->write_meth != NULL);
6019 .this_arg = (void*) calls,
6020 .type_id = type_id_LDKType_jcall,
6021 .debug_str = debug_str_LDKType_jcall,
6022 .write = write_LDKType_jcall,
6023 .cloned = LDKType_JCalls_cloned,
6024 .free = LDKType_JCalls_free,
6028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
6029 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6030 *res_ptr = LDKType_init(env, clz, o);
6031 return (uint64_t)res_ptr;
6033 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
6034 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6035 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6036 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6037 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6041 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
6042 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6043 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6044 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6045 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6046 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
6052 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6053 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6054 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6055 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6056 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6057 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6058 CVec_u8Z_free(ret_var);
6062 static jclass LDKCOption_TypeZ_Some_class = NULL;
6063 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
6064 static jclass LDKCOption_TypeZ_None_class = NULL;
6065 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
6066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
6067 LDKCOption_TypeZ_Some_class =
6068 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
6069 CHECK(LDKCOption_TypeZ_Some_class != NULL);
6070 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
6071 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
6072 LDKCOption_TypeZ_None_class =
6073 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
6074 CHECK(LDKCOption_TypeZ_None_class != NULL);
6075 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
6076 CHECK(LDKCOption_TypeZ_None_meth != NULL);
6078 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6079 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
6081 case LDKCOption_TypeZ_Some: {
6082 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6083 *some_ret = Type_clone(&obj->some);
6084 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uintptr_t)some_ret);
6086 case LDKCOption_TypeZ_None: {
6087 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
6092 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6093 CHECK(owner->result_ok);
6094 return COption_TypeZ_clone(&*owner->contents.result);
6096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6097 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6098 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6099 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6100 uintptr_t ret_ref = (uintptr_t)ret_copy;
6104 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6105 CHECK(!owner->result_ok);
6106 return DecodeError_clone(&*owner->contents.err);
6108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6109 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6110 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6111 uintptr_t ret_ref = 0;
6112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6115 ret_ref = (uintptr_t)ret_var.inner;
6116 if (ret_var.is_owned) {
6122 static jclass LDKPaymentError_Invoice_class = NULL;
6123 static jmethodID LDKPaymentError_Invoice_meth = NULL;
6124 static jclass LDKPaymentError_Routing_class = NULL;
6125 static jmethodID LDKPaymentError_Routing_meth = NULL;
6126 static jclass LDKPaymentError_Sending_class = NULL;
6127 static jmethodID LDKPaymentError_Sending_meth = NULL;
6128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
6129 LDKPaymentError_Invoice_class =
6130 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
6131 CHECK(LDKPaymentError_Invoice_class != NULL);
6132 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
6133 CHECK(LDKPaymentError_Invoice_meth != NULL);
6134 LDKPaymentError_Routing_class =
6135 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
6136 CHECK(LDKPaymentError_Routing_class != NULL);
6137 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
6138 CHECK(LDKPaymentError_Routing_meth != NULL);
6139 LDKPaymentError_Sending_class =
6140 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
6141 CHECK(LDKPaymentError_Sending_class != NULL);
6142 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
6143 CHECK(LDKPaymentError_Sending_meth != NULL);
6145 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6146 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6148 case LDKPaymentError_Invoice: {
6149 LDKStr invoice_str = obj->invoice;
6150 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
6151 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
6153 case LDKPaymentError_Routing: {
6154 LDKLightningError routing_var = obj->routing;
6155 uintptr_t routing_ref = 0;
6156 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6157 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6158 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
6159 routing_ref = (uintptr_t)routing_var.inner & ~1;
6160 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
6162 case LDKPaymentError_Sending: {
6163 uintptr_t sending_ref = ((uintptr_t)&obj->sending) | 1;
6164 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
6169 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6170 CHECK(owner->result_ok);
6171 return ThirtyTwoBytes_clone(&*owner->contents.result);
6173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6174 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6175 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6176 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
6180 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6181 CHECK(!owner->result_ok);
6182 return PaymentError_clone(&*owner->contents.err);
6184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6185 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6186 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6187 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6188 uintptr_t ret_ref = (uintptr_t)ret_copy;
6192 static inline enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
6193 CHECK(owner->result_ok);
6194 return SiPrefix_clone(&*owner->contents.result);
6196 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6197 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
6198 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixNoneZ_get_ok(owner_conv));
6202 static inline void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
6203 CHECK(!owner->result_ok);
6204 return *owner->contents.err;
6206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6207 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
6208 CResult_SiPrefixNoneZ_get_err(owner_conv);
6211 static inline struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
6212 CHECK(owner->result_ok);
6213 return Invoice_clone(&*owner->contents.result);
6215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6216 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
6217 LDKInvoice ret_var = CResult_InvoiceNoneZ_get_ok(owner_conv);
6218 uintptr_t ret_ref = 0;
6219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6222 ret_ref = (uintptr_t)ret_var.inner;
6223 if (ret_var.is_owned) {
6229 static inline void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
6230 CHECK(!owner->result_ok);
6231 return *owner->contents.err;
6233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6234 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
6235 CResult_InvoiceNoneZ_get_err(owner_conv);
6238 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
6239 CHECK(owner->result_ok);
6240 return SignedRawInvoice_clone(&*owner->contents.result);
6242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6243 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
6244 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceNoneZ_get_ok(owner_conv);
6245 uintptr_t ret_ref = 0;
6246 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6247 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6248 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6249 ret_ref = (uintptr_t)ret_var.inner;
6250 if (ret_var.is_owned) {
6256 static inline void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
6257 CHECK(!owner->result_ok);
6258 return *owner->contents.err;
6260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6261 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
6262 CResult_SignedRawInvoiceNoneZ_get_err(owner_conv);
6265 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6266 return RawInvoice_clone(&owner->a);
6268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6269 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6270 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
6271 uintptr_t ret_ref = 0;
6272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6275 ret_ref = (uintptr_t)ret_var.inner;
6276 if (ret_var.is_owned) {
6282 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6283 return ThirtyTwoBytes_clone(&owner->b);
6285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6286 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6287 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6288 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
6292 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6293 return InvoiceSignature_clone(&owner->c);
6295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
6296 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6297 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
6298 uintptr_t ret_ref = 0;
6299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6302 ret_ref = (uintptr_t)ret_var.inner;
6303 if (ret_var.is_owned) {
6309 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6310 CHECK(owner->result_ok);
6311 return PayeePubKey_clone(&*owner->contents.result);
6313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6314 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6315 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
6316 uintptr_t ret_ref = 0;
6317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6320 ret_ref = (uintptr_t)ret_var.inner;
6321 if (ret_var.is_owned) {
6327 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6328 CHECK(!owner->result_ok);
6329 return *owner->contents.err;
6331 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6332 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6333 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6337 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6338 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6339 for (size_t i = 0; i < ret.datalen; i++) {
6340 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6344 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6345 CHECK(owner->result_ok);
6346 return PositiveTimestamp_clone(&*owner->contents.result);
6348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6349 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6350 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6351 uintptr_t ret_ref = 0;
6352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6355 ret_ref = (uintptr_t)ret_var.inner;
6356 if (ret_var.is_owned) {
6362 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6363 CHECK(!owner->result_ok);
6364 return CreationError_clone(&*owner->contents.err);
6366 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6367 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6368 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6372 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6373 CHECK(owner->result_ok);
6374 return *owner->contents.result;
6376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6377 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6378 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6381 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6382 CHECK(!owner->result_ok);
6383 return SemanticError_clone(&*owner->contents.err);
6385 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6386 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6387 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
6391 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6392 CHECK(owner->result_ok);
6393 return Invoice_clone(&*owner->contents.result);
6395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6396 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6397 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6398 uintptr_t ret_ref = 0;
6399 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6400 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6402 ret_ref = (uintptr_t)ret_var.inner;
6403 if (ret_var.is_owned) {
6409 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6410 CHECK(!owner->result_ok);
6411 return SemanticError_clone(&*owner->contents.err);
6413 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6414 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6415 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6419 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6420 CHECK(owner->result_ok);
6421 return Description_clone(&*owner->contents.result);
6423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6424 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6425 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6426 uintptr_t ret_ref = 0;
6427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6430 ret_ref = (uintptr_t)ret_var.inner;
6431 if (ret_var.is_owned) {
6437 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6438 CHECK(!owner->result_ok);
6439 return CreationError_clone(&*owner->contents.err);
6441 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6442 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6443 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6447 static inline struct LDKExpiryTime CResult_ExpiryTimeCreationErrorZ_get_ok(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner){
6448 CHECK(owner->result_ok);
6449 return ExpiryTime_clone(&*owner->contents.result);
6451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6452 LDKCResult_ExpiryTimeCreationErrorZ* owner_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(owner & ~1);
6453 LDKExpiryTime ret_var = CResult_ExpiryTimeCreationErrorZ_get_ok(owner_conv);
6454 uintptr_t ret_ref = 0;
6455 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6456 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6457 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6458 ret_ref = (uintptr_t)ret_var.inner;
6459 if (ret_var.is_owned) {
6465 static inline enum LDKCreationError CResult_ExpiryTimeCreationErrorZ_get_err(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR owner){
6466 CHECK(!owner->result_ok);
6467 return CreationError_clone(&*owner->contents.err);
6469 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6470 LDKCResult_ExpiryTimeCreationErrorZ* owner_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(owner & ~1);
6471 jclass ret_conv = LDKCreationError_to_java(env, CResult_ExpiryTimeCreationErrorZ_get_err(owner_conv));
6475 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6476 CHECK(owner->result_ok);
6477 return PrivateRoute_clone(&*owner->contents.result);
6479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6480 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6481 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6482 uintptr_t ret_ref = 0;
6483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6486 ret_ref = (uintptr_t)ret_var.inner;
6487 if (ret_var.is_owned) {
6493 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6494 CHECK(!owner->result_ok);
6495 return CreationError_clone(&*owner->contents.err);
6497 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6498 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6499 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6503 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6504 CHECK(owner->result_ok);
6505 return *owner->contents.result;
6507 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6508 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6509 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6510 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6514 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6515 CHECK(!owner->result_ok);
6516 return *owner->contents.err;
6518 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6519 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
6520 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
6524 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6525 CHECK(owner->result_ok);
6526 return ChannelMonitorUpdate_clone(&*owner->contents.result);
6528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6529 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6530 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6531 uintptr_t ret_ref = 0;
6532 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6533 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6534 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6535 ret_ref = (uintptr_t)ret_var.inner;
6536 if (ret_var.is_owned) {
6542 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6543 CHECK(!owner->result_ok);
6544 return DecodeError_clone(&*owner->contents.err);
6546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6547 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
6548 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6549 uintptr_t ret_ref = 0;
6550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6553 ret_ref = (uintptr_t)ret_var.inner;
6554 if (ret_var.is_owned) {
6560 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
6561 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
6562 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
6563 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
6564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
6565 LDKCOption_MonitorEventZ_Some_class =
6566 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
6567 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
6568 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
6569 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
6570 LDKCOption_MonitorEventZ_None_class =
6571 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
6572 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
6573 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
6574 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
6576 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6577 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
6579 case LDKCOption_MonitorEventZ_Some: {
6580 uintptr_t some_ref = ((uintptr_t)&obj->some) | 1;
6581 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
6583 case LDKCOption_MonitorEventZ_None: {
6584 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
6589 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6590 CHECK(owner->result_ok);
6591 return COption_MonitorEventZ_clone(&*owner->contents.result);
6593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6594 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6595 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6596 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6597 uintptr_t ret_ref = (uintptr_t)ret_copy;
6601 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6602 CHECK(!owner->result_ok);
6603 return DecodeError_clone(&*owner->contents.err);
6605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6606 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
6607 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6608 uintptr_t ret_ref = 0;
6609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6612 ret_ref = (uintptr_t)ret_var.inner;
6613 if (ret_var.is_owned) {
6619 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6620 CHECK(owner->result_ok);
6621 return HTLCUpdate_clone(&*owner->contents.result);
6623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6624 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6625 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6626 uintptr_t ret_ref = 0;
6627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6630 ret_ref = (uintptr_t)ret_var.inner;
6631 if (ret_var.is_owned) {
6637 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6638 CHECK(!owner->result_ok);
6639 return DecodeError_clone(&*owner->contents.err);
6641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6642 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
6643 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6644 uintptr_t ret_ref = 0;
6645 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6646 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6647 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6648 ret_ref = (uintptr_t)ret_var.inner;
6649 if (ret_var.is_owned) {
6655 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6656 return OutPoint_clone(&owner->a);
6658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6659 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6660 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6661 uintptr_t ret_ref = 0;
6662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6665 ret_ref = (uintptr_t)ret_var.inner;
6666 if (ret_var.is_owned) {
6672 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6673 return CVec_u8Z_clone(&owner->b);
6675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6676 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
6677 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6678 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6679 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6680 CVec_u8Z_free(ret_var);
6684 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6687 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6688 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6689 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
6693 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6694 return CVec_u8Z_clone(&owner->b);
6696 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6697 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
6698 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6699 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6700 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6701 CVec_u8Z_free(ret_var);
6705 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6706 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6707 for (size_t i = 0; i < ret.datalen; i++) {
6708 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6712 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6713 return ThirtyTwoBytes_clone(&owner->a);
6715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6716 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6717 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6718 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
6722 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6723 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6725 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6726 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
6727 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6728 int64_tArray ret_arr = NULL;
6729 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6730 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6731 for (size_t v = 0; v < ret_var.datalen; v++) {
6732 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6733 *ret_conv_21_conv = ret_var.data[v];
6734 ret_arr_ptr[v] = ((uintptr_t)ret_conv_21_conv);
6736 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6741 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6742 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 };
6743 for (size_t i = 0; i < ret.datalen; i++) {
6744 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6748 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6749 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6750 for (size_t i = 0; i < ret.datalen; i++) {
6751 ret.data[i] = Event_clone(&orig->data[i]);
6755 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6758 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6759 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6760 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
6764 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6765 return TxOut_clone(&owner->b);
6767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6768 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
6769 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6770 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6771 return (uintptr_t)ret_ref;
6774 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6775 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6776 for (size_t i = 0; i < ret.datalen; i++) {
6777 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6781 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6782 return ThirtyTwoBytes_clone(&owner->a);
6784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6785 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6786 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6787 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
6791 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6792 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6794 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6795 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
6796 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6797 int64_tArray ret_arr = NULL;
6798 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6799 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6800 for (size_t u = 0; u < ret_var.datalen; u++) {
6801 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6802 *ret_conv_20_conv = ret_var.data[u];
6803 ret_arr_ptr[u] = ((uintptr_t)ret_conv_20_conv);
6805 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6810 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6811 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 };
6812 for (size_t i = 0; i < ret.datalen; i++) {
6813 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6817 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
6818 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
6819 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
6820 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
6821 static jclass LDKBalance_ContentiousClaimable_class = NULL;
6822 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
6823 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
6824 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
6825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
6826 LDKBalance_ClaimableOnChannelClose_class =
6827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
6828 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
6829 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
6830 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
6831 LDKBalance_ClaimableAwaitingConfirmations_class =
6832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
6833 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
6834 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
6835 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
6836 LDKBalance_ContentiousClaimable_class =
6837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
6838 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
6839 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
6840 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
6841 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
6842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
6843 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
6844 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
6845 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
6847 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6848 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
6850 case LDKBalance_ClaimableOnChannelClose: {
6851 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
6853 case LDKBalance_ClaimableAwaitingConfirmations: {
6854 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
6856 case LDKBalance_ContentiousClaimable: {
6857 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
6859 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
6860 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);
6865 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6866 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6867 for (size_t i = 0; i < ret.datalen; i++) {
6868 ret.data[i] = Balance_clone(&orig->data[i]);
6872 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6873 CHECK(owner->result_ok);
6874 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6877 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6878 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6879 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6880 return ((uintptr_t)ret_conv);
6883 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6884 CHECK(!owner->result_ok);
6885 return DecodeError_clone(&*owner->contents.err);
6887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6888 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
6889 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6890 uintptr_t ret_ref = 0;
6891 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6892 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6893 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6894 ret_ref = (uintptr_t)ret_var.inner;
6895 if (ret_var.is_owned) {
6901 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6902 CHECK(owner->result_ok);
6903 return *owner->contents.result;
6905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6906 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
6907 CResult_NoneLightningErrorZ_get_ok(owner_conv);
6910 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6911 CHECK(!owner->result_ok);
6912 return LightningError_clone(&*owner->contents.err);
6914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6915 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
6916 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
6917 uintptr_t ret_ref = 0;
6918 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6919 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6921 ret_ref = (uintptr_t)ret_var.inner;
6922 if (ret_var.is_owned) {
6928 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6932 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6933 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
6934 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
6938 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6939 return Type_clone(&owner->b);
6941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6942 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
6943 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6944 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6945 return (uintptr_t)ret_ret;
6948 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6949 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6950 for (size_t i = 0; i < ret.datalen; i++) {
6951 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6955 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6956 CHECK(owner->result_ok);
6957 return *owner->contents.result;
6959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6960 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
6961 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
6965 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6966 CHECK(!owner->result_ok);
6967 return LightningError_clone(&*owner->contents.err);
6969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6970 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
6971 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
6972 uintptr_t ret_ref = 0;
6973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6976 ret_ref = (uintptr_t)ret_var.inner;
6977 if (ret_var.is_owned) {
6983 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6984 return ChannelAnnouncement_clone(&owner->a);
6986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6987 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
6988 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
6989 uintptr_t ret_ref = 0;
6990 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6991 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6993 ret_ref = (uintptr_t)ret_var.inner;
6994 if (ret_var.is_owned) {
7000 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7001 return ChannelUpdate_clone(&owner->b);
7003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7004 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7005 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
7006 uintptr_t ret_ref = 0;
7007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7010 ret_ref = (uintptr_t)ret_var.inner;
7011 if (ret_var.is_owned) {
7017 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7018 return ChannelUpdate_clone(&owner->c);
7020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7021 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7022 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
7023 uintptr_t ret_ref = 0;
7024 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7025 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7026 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7027 ret_ref = (uintptr_t)ret_var.inner;
7028 if (ret_var.is_owned) {
7034 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
7035 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
7036 for (size_t i = 0; i < ret.datalen; i++) {
7037 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
7041 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
7042 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
7043 for (size_t i = 0; i < ret.datalen; i++) {
7044 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
7048 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7049 CHECK(owner->result_ok);
7050 return CVec_u8Z_clone(&*owner->contents.result);
7052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7053 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7054 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7055 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7056 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7057 CVec_u8Z_free(ret_var);
7061 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7062 CHECK(!owner->result_ok);
7063 return PeerHandleError_clone(&*owner->contents.err);
7065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7066 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7067 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7068 uintptr_t ret_ref = 0;
7069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7072 ret_ref = (uintptr_t)ret_var.inner;
7073 if (ret_var.is_owned) {
7079 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7080 CHECK(owner->result_ok);
7081 return *owner->contents.result;
7083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7084 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7085 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7088 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7089 CHECK(!owner->result_ok);
7090 return PeerHandleError_clone(&*owner->contents.err);
7092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7093 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7094 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7095 uintptr_t ret_ref = 0;
7096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7099 ret_ref = (uintptr_t)ret_var.inner;
7100 if (ret_var.is_owned) {
7106 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7107 CHECK(owner->result_ok);
7108 return *owner->contents.result;
7110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7111 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7112 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7116 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7117 CHECK(!owner->result_ok);
7118 return PeerHandleError_clone(&*owner->contents.err);
7120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7121 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7122 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7123 uintptr_t ret_ref = 0;
7124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7127 ret_ref = (uintptr_t)ret_var.inner;
7128 if (ret_var.is_owned) {
7134 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7135 CHECK(owner->result_ok);
7136 return NodeId_clone(&*owner->contents.result);
7138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7139 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7140 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
7141 uintptr_t ret_ref = 0;
7142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7145 ret_ref = (uintptr_t)ret_var.inner;
7146 if (ret_var.is_owned) {
7152 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7153 CHECK(!owner->result_ok);
7154 return DecodeError_clone(&*owner->contents.err);
7156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7157 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7158 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
7159 uintptr_t ret_ref = 0;
7160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7161 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7162 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7163 ret_ref = (uintptr_t)ret_var.inner;
7164 if (ret_var.is_owned) {
7170 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7171 CHECK(owner->result_ok);
7172 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
7174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7175 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7176 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
7177 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
7178 uintptr_t ret_ref = (uintptr_t)ret_copy;
7182 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7183 CHECK(!owner->result_ok);
7184 return DecodeError_clone(&*owner->contents.err);
7186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7187 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7188 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
7189 uintptr_t ret_ref = 0;
7190 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7191 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7192 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7193 ret_ref = (uintptr_t)ret_var.inner;
7194 if (ret_var.is_owned) {
7200 typedef struct LDKAccess_JCalls {
7201 atomic_size_t refcnt;
7204 jmethodID get_utxo_meth;
7206 static void LDKAccess_JCalls_free(void* this_arg) {
7207 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
7208 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7210 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7211 if (get_jenv_res == JNI_EDETACHED) {
7212 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7214 DO_ASSERT(get_jenv_res == JNI_OK);
7216 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7217 if (get_jenv_res == JNI_EDETACHED) {
7218 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7223 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
7224 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
7226 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7227 if (get_jenv_res == JNI_EDETACHED) {
7228 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7230 DO_ASSERT(get_jenv_res == JNI_OK);
7232 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
7233 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
7234 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7236 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
7237 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7238 (*env)->ExceptionDescribe(env);
7239 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
7241 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
7242 CHECK_ACCESS(ret_ptr);
7243 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
7245 if (get_jenv_res == JNI_EDETACHED) {
7246 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7250 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
7251 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
7252 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7254 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
7255 jclass c = (*env)->GetObjectClass(env, o);
7257 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
7258 atomic_init(&calls->refcnt, 1);
7259 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7260 calls->o = (*env)->NewWeakGlobalRef(env, o);
7261 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
7262 CHECK(calls->get_utxo_meth != NULL);
7265 .this_arg = (void*) calls,
7266 .get_utxo = get_utxo_LDKAccess_jcall,
7267 .free = LDKAccess_JCalls_free,
7271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
7272 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
7273 *res_ptr = LDKAccess_init(env, clz, o);
7274 return (uint64_t)res_ptr;
7276 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) {
7277 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7278 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7279 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
7280 unsigned char genesis_hash_arr[32];
7281 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
7282 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
7283 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
7284 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7285 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
7286 return (uintptr_t)ret_conv;
7289 static jclass LDKCOption_AccessZ_Some_class = NULL;
7290 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
7291 static jclass LDKCOption_AccessZ_None_class = NULL;
7292 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
7293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
7294 LDKCOption_AccessZ_Some_class =
7295 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
7296 CHECK(LDKCOption_AccessZ_Some_class != NULL);
7297 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
7298 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
7299 LDKCOption_AccessZ_None_class =
7300 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
7301 CHECK(LDKCOption_AccessZ_None_class != NULL);
7302 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
7303 CHECK(LDKCOption_AccessZ_None_meth != NULL);
7305 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7306 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
7308 case LDKCOption_AccessZ_Some: {
7309 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
7310 *some_ret = obj->some;
7311 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7312 if ((*some_ret).free == LDKAccess_JCalls_free) {
7313 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7314 LDKAccess_JCalls_cloned(&(*some_ret));
7316 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uintptr_t)some_ret);
7318 case LDKCOption_AccessZ_None: {
7319 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
7324 static inline struct LDKDirectionalChannelInfo CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7325 CHECK(owner->result_ok);
7326 return DirectionalChannelInfo_clone(&*owner->contents.result);
7328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7329 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
7330 LDKDirectionalChannelInfo ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_ok(owner_conv);
7331 uintptr_t ret_ref = 0;
7332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7335 ret_ref = (uintptr_t)ret_var.inner;
7336 if (ret_var.is_owned) {
7342 static inline struct LDKDecodeError CResult_DirectionalChannelInfoDecodeErrorZ_get_err(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7343 CHECK(!owner->result_ok);
7344 return DecodeError_clone(&*owner->contents.err);
7346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7347 LDKCResult_DirectionalChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(owner & ~1);
7348 LDKDecodeError ret_var = CResult_DirectionalChannelInfoDecodeErrorZ_get_err(owner_conv);
7349 uintptr_t ret_ref = 0;
7350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7353 ret_ref = (uintptr_t)ret_var.inner;
7354 if (ret_var.is_owned) {
7360 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7361 CHECK(owner->result_ok);
7362 return ChannelInfo_clone(&*owner->contents.result);
7364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7365 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
7366 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
7367 uintptr_t ret_ref = 0;
7368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7371 ret_ref = (uintptr_t)ret_var.inner;
7372 if (ret_var.is_owned) {
7378 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7379 CHECK(!owner->result_ok);
7380 return DecodeError_clone(&*owner->contents.err);
7382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7383 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
7384 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
7385 uintptr_t ret_ref = 0;
7386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7389 ret_ref = (uintptr_t)ret_var.inner;
7390 if (ret_var.is_owned) {
7396 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7397 CHECK(owner->result_ok);
7398 return RoutingFees_clone(&*owner->contents.result);
7400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7401 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
7402 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
7403 uintptr_t ret_ref = 0;
7404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7407 ret_ref = (uintptr_t)ret_var.inner;
7408 if (ret_var.is_owned) {
7414 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7415 CHECK(!owner->result_ok);
7416 return DecodeError_clone(&*owner->contents.err);
7418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7419 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
7420 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
7421 uintptr_t ret_ref = 0;
7422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7425 ret_ref = (uintptr_t)ret_var.inner;
7426 if (ret_var.is_owned) {
7432 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7433 CHECK(owner->result_ok);
7434 return NodeAnnouncementInfo_clone(&*owner->contents.result);
7436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7437 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
7438 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
7439 uintptr_t ret_ref = 0;
7440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7443 ret_ref = (uintptr_t)ret_var.inner;
7444 if (ret_var.is_owned) {
7450 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7451 CHECK(!owner->result_ok);
7452 return DecodeError_clone(&*owner->contents.err);
7454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7455 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
7456 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
7457 uintptr_t ret_ref = 0;
7458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7461 ret_ref = (uintptr_t)ret_var.inner;
7462 if (ret_var.is_owned) {
7468 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
7469 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
7470 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
7473 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7474 CHECK(owner->result_ok);
7475 return NodeInfo_clone(&*owner->contents.result);
7477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7478 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
7479 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
7480 uintptr_t ret_ref = 0;
7481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7484 ret_ref = (uintptr_t)ret_var.inner;
7485 if (ret_var.is_owned) {
7491 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7492 CHECK(!owner->result_ok);
7493 return DecodeError_clone(&*owner->contents.err);
7495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7496 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
7497 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
7498 uintptr_t ret_ref = 0;
7499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7502 ret_ref = (uintptr_t)ret_var.inner;
7503 if (ret_var.is_owned) {
7509 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7510 CHECK(owner->result_ok);
7511 return NetworkGraph_clone(&*owner->contents.result);
7513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7514 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
7515 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
7516 uintptr_t ret_ref = 0;
7517 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7518 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7520 ret_ref = (uintptr_t)ret_var.inner;
7521 if (ret_var.is_owned) {
7527 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7528 CHECK(!owner->result_ok);
7529 return DecodeError_clone(&*owner->contents.err);
7531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7532 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
7533 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
7534 uintptr_t ret_ref = 0;
7535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7538 ret_ref = (uintptr_t)ret_var.inner;
7539 if (ret_var.is_owned) {
7545 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
7546 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
7547 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
7548 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
7549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
7550 LDKCOption_CVec_NetAddressZZ_Some_class =
7551 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
7552 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
7553 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
7554 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
7555 LDKCOption_CVec_NetAddressZZ_None_class =
7556 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
7557 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
7558 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
7559 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
7561 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7562 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
7564 case LDKCOption_CVec_NetAddressZZ_Some: {
7565 LDKCVec_NetAddressZ some_var = obj->some;
7566 int64_tArray some_arr = NULL;
7567 some_arr = (*env)->NewLongArray(env, some_var.datalen);
7568 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
7569 for (size_t m = 0; m < some_var.datalen; m++) {
7570 uintptr_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
7571 some_arr_ptr[m] = some_conv_12_ref;
7573 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
7574 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
7576 case LDKCOption_CVec_NetAddressZZ_None: {
7577 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
7582 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7583 CHECK(owner->result_ok);
7584 return NetAddress_clone(&*owner->contents.result);
7586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7587 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
7588 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7589 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7590 uintptr_t ret_ref = (uintptr_t)ret_copy;
7594 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7595 CHECK(!owner->result_ok);
7596 return DecodeError_clone(&*owner->contents.err);
7598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7599 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
7600 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
7601 uintptr_t ret_ref = 0;
7602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7605 ret_ref = (uintptr_t)ret_var.inner;
7606 if (ret_var.is_owned) {
7612 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7613 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7614 for (size_t i = 0; i < ret.datalen; i++) {
7615 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7619 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7620 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7621 for (size_t i = 0; i < ret.datalen; i++) {
7622 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7626 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7627 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7628 for (size_t i = 0; i < ret.datalen; i++) {
7629 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7633 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7634 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7635 for (size_t i = 0; i < ret.datalen; i++) {
7636 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7640 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7641 CHECK(owner->result_ok);
7642 return AcceptChannel_clone(&*owner->contents.result);
7644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7645 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
7646 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7647 uintptr_t ret_ref = 0;
7648 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7649 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7650 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7651 ret_ref = (uintptr_t)ret_var.inner;
7652 if (ret_var.is_owned) {
7658 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7659 CHECK(!owner->result_ok);
7660 return DecodeError_clone(&*owner->contents.err);
7662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7663 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
7664 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7665 uintptr_t ret_ref = 0;
7666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7669 ret_ref = (uintptr_t)ret_var.inner;
7670 if (ret_var.is_owned) {
7676 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7677 CHECK(owner->result_ok);
7678 return AnnouncementSignatures_clone(&*owner->contents.result);
7680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7681 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
7682 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7683 uintptr_t ret_ref = 0;
7684 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7685 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7687 ret_ref = (uintptr_t)ret_var.inner;
7688 if (ret_var.is_owned) {
7694 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7695 CHECK(!owner->result_ok);
7696 return DecodeError_clone(&*owner->contents.err);
7698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7699 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
7700 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7701 uintptr_t ret_ref = 0;
7702 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7703 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7704 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7705 ret_ref = (uintptr_t)ret_var.inner;
7706 if (ret_var.is_owned) {
7712 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7713 CHECK(owner->result_ok);
7714 return ChannelReestablish_clone(&*owner->contents.result);
7716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7717 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
7718 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7719 uintptr_t ret_ref = 0;
7720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7723 ret_ref = (uintptr_t)ret_var.inner;
7724 if (ret_var.is_owned) {
7730 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7731 CHECK(!owner->result_ok);
7732 return DecodeError_clone(&*owner->contents.err);
7734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7735 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
7736 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7737 uintptr_t ret_ref = 0;
7738 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7739 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7741 ret_ref = (uintptr_t)ret_var.inner;
7742 if (ret_var.is_owned) {
7748 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7749 CHECK(owner->result_ok);
7750 return ClosingSigned_clone(&*owner->contents.result);
7752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7753 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
7754 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7755 uintptr_t ret_ref = 0;
7756 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7757 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7759 ret_ref = (uintptr_t)ret_var.inner;
7760 if (ret_var.is_owned) {
7766 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7767 CHECK(!owner->result_ok);
7768 return DecodeError_clone(&*owner->contents.err);
7770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7771 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
7772 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7773 uintptr_t ret_ref = 0;
7774 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7775 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7777 ret_ref = (uintptr_t)ret_var.inner;
7778 if (ret_var.is_owned) {
7784 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7785 CHECK(owner->result_ok);
7786 return ClosingSignedFeeRange_clone(&*owner->contents.result);
7788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7789 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
7790 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7791 uintptr_t ret_ref = 0;
7792 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7793 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7795 ret_ref = (uintptr_t)ret_var.inner;
7796 if (ret_var.is_owned) {
7802 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7803 CHECK(!owner->result_ok);
7804 return DecodeError_clone(&*owner->contents.err);
7806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7807 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
7808 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7809 uintptr_t ret_ref = 0;
7810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7813 ret_ref = (uintptr_t)ret_var.inner;
7814 if (ret_var.is_owned) {
7820 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7821 CHECK(owner->result_ok);
7822 return CommitmentSigned_clone(&*owner->contents.result);
7824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7825 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
7826 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7827 uintptr_t ret_ref = 0;
7828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7831 ret_ref = (uintptr_t)ret_var.inner;
7832 if (ret_var.is_owned) {
7838 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7839 CHECK(!owner->result_ok);
7840 return DecodeError_clone(&*owner->contents.err);
7842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7843 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
7844 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7845 uintptr_t ret_ref = 0;
7846 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7847 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7848 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7849 ret_ref = (uintptr_t)ret_var.inner;
7850 if (ret_var.is_owned) {
7856 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7857 CHECK(owner->result_ok);
7858 return FundingCreated_clone(&*owner->contents.result);
7860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7861 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
7862 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7863 uintptr_t ret_ref = 0;
7864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7867 ret_ref = (uintptr_t)ret_var.inner;
7868 if (ret_var.is_owned) {
7874 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7875 CHECK(!owner->result_ok);
7876 return DecodeError_clone(&*owner->contents.err);
7878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7879 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
7880 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7881 uintptr_t ret_ref = 0;
7882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7885 ret_ref = (uintptr_t)ret_var.inner;
7886 if (ret_var.is_owned) {
7892 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7893 CHECK(owner->result_ok);
7894 return FundingSigned_clone(&*owner->contents.result);
7896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7897 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7898 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7899 uintptr_t ret_ref = 0;
7900 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7901 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7902 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7903 ret_ref = (uintptr_t)ret_var.inner;
7904 if (ret_var.is_owned) {
7910 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7911 CHECK(!owner->result_ok);
7912 return DecodeError_clone(&*owner->contents.err);
7914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7915 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
7916 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7917 uintptr_t ret_ref = 0;
7918 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7919 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7921 ret_ref = (uintptr_t)ret_var.inner;
7922 if (ret_var.is_owned) {
7928 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
7929 CHECK(owner->result_ok);
7930 return FundingLocked_clone(&*owner->contents.result);
7932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7933 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
7934 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
7935 uintptr_t ret_ref = 0;
7936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7939 ret_ref = (uintptr_t)ret_var.inner;
7940 if (ret_var.is_owned) {
7946 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
7947 CHECK(!owner->result_ok);
7948 return DecodeError_clone(&*owner->contents.err);
7950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7951 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
7952 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
7953 uintptr_t ret_ref = 0;
7954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7957 ret_ref = (uintptr_t)ret_var.inner;
7958 if (ret_var.is_owned) {
7964 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7965 CHECK(owner->result_ok);
7966 return Init_clone(&*owner->contents.result);
7968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7969 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7970 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7971 uintptr_t ret_ref = 0;
7972 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7973 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7974 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7975 ret_ref = (uintptr_t)ret_var.inner;
7976 if (ret_var.is_owned) {
7982 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7983 CHECK(!owner->result_ok);
7984 return DecodeError_clone(&*owner->contents.err);
7986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7987 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
7988 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
7989 uintptr_t ret_ref = 0;
7990 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7991 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7993 ret_ref = (uintptr_t)ret_var.inner;
7994 if (ret_var.is_owned) {
8000 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8001 CHECK(owner->result_ok);
8002 return OpenChannel_clone(&*owner->contents.result);
8004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8005 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8006 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8007 uintptr_t ret_ref = 0;
8008 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8009 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8011 ret_ref = (uintptr_t)ret_var.inner;
8012 if (ret_var.is_owned) {
8018 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8019 CHECK(!owner->result_ok);
8020 return DecodeError_clone(&*owner->contents.err);
8022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8023 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8024 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8025 uintptr_t ret_ref = 0;
8026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8029 ret_ref = (uintptr_t)ret_var.inner;
8030 if (ret_var.is_owned) {
8036 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8037 CHECK(owner->result_ok);
8038 return RevokeAndACK_clone(&*owner->contents.result);
8040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8041 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8042 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8043 uintptr_t ret_ref = 0;
8044 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8045 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8046 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8047 ret_ref = (uintptr_t)ret_var.inner;
8048 if (ret_var.is_owned) {
8054 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8055 CHECK(!owner->result_ok);
8056 return DecodeError_clone(&*owner->contents.err);
8058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8059 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8060 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8061 uintptr_t ret_ref = 0;
8062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8065 ret_ref = (uintptr_t)ret_var.inner;
8066 if (ret_var.is_owned) {
8072 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8073 CHECK(owner->result_ok);
8074 return Shutdown_clone(&*owner->contents.result);
8076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8077 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8078 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8079 uintptr_t ret_ref = 0;
8080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8083 ret_ref = (uintptr_t)ret_var.inner;
8084 if (ret_var.is_owned) {
8090 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8091 CHECK(!owner->result_ok);
8092 return DecodeError_clone(&*owner->contents.err);
8094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8095 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8096 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8097 uintptr_t ret_ref = 0;
8098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8101 ret_ref = (uintptr_t)ret_var.inner;
8102 if (ret_var.is_owned) {
8108 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8109 CHECK(owner->result_ok);
8110 return UpdateFailHTLC_clone(&*owner->contents.result);
8112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8113 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8114 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8115 uintptr_t ret_ref = 0;
8116 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8117 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8118 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8119 ret_ref = (uintptr_t)ret_var.inner;
8120 if (ret_var.is_owned) {
8126 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8127 CHECK(!owner->result_ok);
8128 return DecodeError_clone(&*owner->contents.err);
8130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8131 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8132 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8133 uintptr_t ret_ref = 0;
8134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8137 ret_ref = (uintptr_t)ret_var.inner;
8138 if (ret_var.is_owned) {
8144 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8145 CHECK(owner->result_ok);
8146 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
8148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8149 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8150 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8151 uintptr_t ret_ref = 0;
8152 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8153 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8155 ret_ref = (uintptr_t)ret_var.inner;
8156 if (ret_var.is_owned) {
8162 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8163 CHECK(!owner->result_ok);
8164 return DecodeError_clone(&*owner->contents.err);
8166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8167 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8168 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8169 uintptr_t ret_ref = 0;
8170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8173 ret_ref = (uintptr_t)ret_var.inner;
8174 if (ret_var.is_owned) {
8180 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8181 CHECK(owner->result_ok);
8182 return UpdateFee_clone(&*owner->contents.result);
8184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8185 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8186 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8187 uintptr_t ret_ref = 0;
8188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8191 ret_ref = (uintptr_t)ret_var.inner;
8192 if (ret_var.is_owned) {
8198 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8199 CHECK(!owner->result_ok);
8200 return DecodeError_clone(&*owner->contents.err);
8202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8203 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8204 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8205 uintptr_t ret_ref = 0;
8206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8209 ret_ref = (uintptr_t)ret_var.inner;
8210 if (ret_var.is_owned) {
8216 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8217 CHECK(owner->result_ok);
8218 return UpdateFulfillHTLC_clone(&*owner->contents.result);
8220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8221 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
8222 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8223 uintptr_t ret_ref = 0;
8224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8227 ret_ref = (uintptr_t)ret_var.inner;
8228 if (ret_var.is_owned) {
8234 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8235 CHECK(!owner->result_ok);
8236 return DecodeError_clone(&*owner->contents.err);
8238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8239 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
8240 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8241 uintptr_t ret_ref = 0;
8242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8245 ret_ref = (uintptr_t)ret_var.inner;
8246 if (ret_var.is_owned) {
8252 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8253 CHECK(owner->result_ok);
8254 return UpdateAddHTLC_clone(&*owner->contents.result);
8256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8257 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
8258 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8259 uintptr_t ret_ref = 0;
8260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8263 ret_ref = (uintptr_t)ret_var.inner;
8264 if (ret_var.is_owned) {
8270 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8271 CHECK(!owner->result_ok);
8272 return DecodeError_clone(&*owner->contents.err);
8274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8275 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
8276 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8277 uintptr_t ret_ref = 0;
8278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8281 ret_ref = (uintptr_t)ret_var.inner;
8282 if (ret_var.is_owned) {
8288 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8289 CHECK(owner->result_ok);
8290 return Ping_clone(&*owner->contents.result);
8292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8293 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
8294 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8295 uintptr_t ret_ref = 0;
8296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8299 ret_ref = (uintptr_t)ret_var.inner;
8300 if (ret_var.is_owned) {
8306 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8307 CHECK(!owner->result_ok);
8308 return DecodeError_clone(&*owner->contents.err);
8310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8311 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
8312 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
8313 uintptr_t ret_ref = 0;
8314 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8315 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8316 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8317 ret_ref = (uintptr_t)ret_var.inner;
8318 if (ret_var.is_owned) {
8324 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8325 CHECK(owner->result_ok);
8326 return Pong_clone(&*owner->contents.result);
8328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8329 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
8330 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8331 uintptr_t ret_ref = 0;
8332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8335 ret_ref = (uintptr_t)ret_var.inner;
8336 if (ret_var.is_owned) {
8342 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8343 CHECK(!owner->result_ok);
8344 return DecodeError_clone(&*owner->contents.err);
8346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8347 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
8348 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
8349 uintptr_t ret_ref = 0;
8350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8353 ret_ref = (uintptr_t)ret_var.inner;
8354 if (ret_var.is_owned) {
8360 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8361 CHECK(owner->result_ok);
8362 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
8364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8365 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8366 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8367 uintptr_t ret_ref = 0;
8368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8371 ret_ref = (uintptr_t)ret_var.inner;
8372 if (ret_var.is_owned) {
8378 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8379 CHECK(!owner->result_ok);
8380 return DecodeError_clone(&*owner->contents.err);
8382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8383 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8384 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8385 uintptr_t ret_ref = 0;
8386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8389 ret_ref = (uintptr_t)ret_var.inner;
8390 if (ret_var.is_owned) {
8396 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8397 CHECK(owner->result_ok);
8398 return ChannelAnnouncement_clone(&*owner->contents.result);
8400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8401 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8402 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8403 uintptr_t ret_ref = 0;
8404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8407 ret_ref = (uintptr_t)ret_var.inner;
8408 if (ret_var.is_owned) {
8414 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8415 CHECK(!owner->result_ok);
8416 return DecodeError_clone(&*owner->contents.err);
8418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8419 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8420 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8421 uintptr_t ret_ref = 0;
8422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8425 ret_ref = (uintptr_t)ret_var.inner;
8426 if (ret_var.is_owned) {
8432 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8433 CHECK(owner->result_ok);
8434 return UnsignedChannelUpdate_clone(&*owner->contents.result);
8436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8437 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
8438 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8439 uintptr_t ret_ref = 0;
8440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8443 ret_ref = (uintptr_t)ret_var.inner;
8444 if (ret_var.is_owned) {
8450 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8451 CHECK(!owner->result_ok);
8452 return DecodeError_clone(&*owner->contents.err);
8454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8455 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
8456 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8457 uintptr_t ret_ref = 0;
8458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8461 ret_ref = (uintptr_t)ret_var.inner;
8462 if (ret_var.is_owned) {
8468 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8469 CHECK(owner->result_ok);
8470 return ChannelUpdate_clone(&*owner->contents.result);
8472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8473 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
8474 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8475 uintptr_t ret_ref = 0;
8476 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8477 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8478 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8479 ret_ref = (uintptr_t)ret_var.inner;
8480 if (ret_var.is_owned) {
8486 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8487 CHECK(!owner->result_ok);
8488 return DecodeError_clone(&*owner->contents.err);
8490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8491 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
8492 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8493 uintptr_t ret_ref = 0;
8494 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8495 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8497 ret_ref = (uintptr_t)ret_var.inner;
8498 if (ret_var.is_owned) {
8504 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8505 CHECK(owner->result_ok);
8506 return ErrorMessage_clone(&*owner->contents.result);
8508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8509 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
8510 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
8511 uintptr_t ret_ref = 0;
8512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8515 ret_ref = (uintptr_t)ret_var.inner;
8516 if (ret_var.is_owned) {
8522 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
8523 CHECK(!owner->result_ok);
8524 return DecodeError_clone(&*owner->contents.err);
8526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8527 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
8528 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
8529 uintptr_t ret_ref = 0;
8530 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8531 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8533 ret_ref = (uintptr_t)ret_var.inner;
8534 if (ret_var.is_owned) {
8540 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8541 CHECK(owner->result_ok);
8542 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
8544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8545 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
8546 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8547 uintptr_t ret_ref = 0;
8548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8551 ret_ref = (uintptr_t)ret_var.inner;
8552 if (ret_var.is_owned) {
8558 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8559 CHECK(!owner->result_ok);
8560 return DecodeError_clone(&*owner->contents.err);
8562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8563 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
8564 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8565 uintptr_t ret_ref = 0;
8566 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8567 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8568 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8569 ret_ref = (uintptr_t)ret_var.inner;
8570 if (ret_var.is_owned) {
8576 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8577 CHECK(owner->result_ok);
8578 return NodeAnnouncement_clone(&*owner->contents.result);
8580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8581 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
8582 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
8583 uintptr_t ret_ref = 0;
8584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8587 ret_ref = (uintptr_t)ret_var.inner;
8588 if (ret_var.is_owned) {
8594 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8595 CHECK(!owner->result_ok);
8596 return DecodeError_clone(&*owner->contents.err);
8598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8599 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
8600 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
8601 uintptr_t ret_ref = 0;
8602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8605 ret_ref = (uintptr_t)ret_var.inner;
8606 if (ret_var.is_owned) {
8612 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8613 CHECK(owner->result_ok);
8614 return QueryShortChannelIds_clone(&*owner->contents.result);
8616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8617 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
8618 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
8619 uintptr_t ret_ref = 0;
8620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8623 ret_ref = (uintptr_t)ret_var.inner;
8624 if (ret_var.is_owned) {
8630 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
8631 CHECK(!owner->result_ok);
8632 return DecodeError_clone(&*owner->contents.err);
8634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8635 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
8636 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
8637 uintptr_t ret_ref = 0;
8638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8641 ret_ref = (uintptr_t)ret_var.inner;
8642 if (ret_var.is_owned) {
8648 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8649 CHECK(owner->result_ok);
8650 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
8652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8653 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
8654 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
8655 uintptr_t ret_ref = 0;
8656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8659 ret_ref = (uintptr_t)ret_var.inner;
8660 if (ret_var.is_owned) {
8666 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
8667 CHECK(!owner->result_ok);
8668 return DecodeError_clone(&*owner->contents.err);
8670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8671 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
8672 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
8673 uintptr_t ret_ref = 0;
8674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8677 ret_ref = (uintptr_t)ret_var.inner;
8678 if (ret_var.is_owned) {
8684 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8685 CHECK(owner->result_ok);
8686 return QueryChannelRange_clone(&*owner->contents.result);
8688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8689 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
8690 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
8691 uintptr_t ret_ref = 0;
8692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8695 ret_ref = (uintptr_t)ret_var.inner;
8696 if (ret_var.is_owned) {
8702 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8703 CHECK(!owner->result_ok);
8704 return DecodeError_clone(&*owner->contents.err);
8706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8707 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
8708 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
8709 uintptr_t ret_ref = 0;
8710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8713 ret_ref = (uintptr_t)ret_var.inner;
8714 if (ret_var.is_owned) {
8720 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8721 CHECK(owner->result_ok);
8722 return ReplyChannelRange_clone(&*owner->contents.result);
8724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8725 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
8726 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
8727 uintptr_t ret_ref = 0;
8728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8731 ret_ref = (uintptr_t)ret_var.inner;
8732 if (ret_var.is_owned) {
8738 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
8739 CHECK(!owner->result_ok);
8740 return DecodeError_clone(&*owner->contents.err);
8742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8743 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
8744 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
8745 uintptr_t ret_ref = 0;
8746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8749 ret_ref = (uintptr_t)ret_var.inner;
8750 if (ret_var.is_owned) {
8756 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8757 CHECK(owner->result_ok);
8758 return GossipTimestampFilter_clone(&*owner->contents.result);
8760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8761 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
8762 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
8763 uintptr_t ret_ref = 0;
8764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8767 ret_ref = (uintptr_t)ret_var.inner;
8768 if (ret_var.is_owned) {
8774 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
8775 CHECK(!owner->result_ok);
8776 return DecodeError_clone(&*owner->contents.err);
8778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8779 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
8780 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
8781 uintptr_t ret_ref = 0;
8782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8785 ret_ref = (uintptr_t)ret_var.inner;
8786 if (ret_var.is_owned) {
8792 static jclass LDKSignOrCreationError_SignError_class = NULL;
8793 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
8794 static jclass LDKSignOrCreationError_CreationError_class = NULL;
8795 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
8796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
8797 LDKSignOrCreationError_SignError_class =
8798 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
8799 CHECK(LDKSignOrCreationError_SignError_class != NULL);
8800 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
8801 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
8802 LDKSignOrCreationError_CreationError_class =
8803 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
8804 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
8805 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
8806 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
8808 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8809 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
8811 case LDKSignOrCreationError_SignError: {
8812 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
8814 case LDKSignOrCreationError_CreationError: {
8815 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
8816 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
8821 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8822 CHECK(owner->result_ok);
8823 return Invoice_clone(&*owner->contents.result);
8825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8826 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
8827 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
8828 uintptr_t ret_ref = 0;
8829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8832 ret_ref = (uintptr_t)ret_var.inner;
8833 if (ret_var.is_owned) {
8839 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
8840 CHECK(!owner->result_ok);
8841 return SignOrCreationError_clone(&*owner->contents.err);
8843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8844 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
8845 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
8846 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
8847 uintptr_t ret_ref = (uintptr_t)ret_copy;
8851 typedef struct LDKFilter_JCalls {
8852 atomic_size_t refcnt;
8855 jmethodID register_tx_meth;
8856 jmethodID register_output_meth;
8858 static void LDKFilter_JCalls_free(void* this_arg) {
8859 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8860 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8862 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8863 if (get_jenv_res == JNI_EDETACHED) {
8864 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8866 DO_ASSERT(get_jenv_res == JNI_OK);
8868 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8869 if (get_jenv_res == JNI_EDETACHED) {
8870 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8875 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8876 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8878 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8879 if (get_jenv_res == JNI_EDETACHED) {
8880 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8882 DO_ASSERT(get_jenv_res == JNI_OK);
8884 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
8885 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
8886 LDKu8slice script_pubkey_var = script_pubkey;
8887 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
8888 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
8889 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8891 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
8892 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8893 (*env)->ExceptionDescribe(env);
8894 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
8896 if (get_jenv_res == JNI_EDETACHED) {
8897 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8900 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8901 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8903 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8904 if (get_jenv_res == JNI_EDETACHED) {
8905 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8907 DO_ASSERT(get_jenv_res == JNI_OK);
8909 LDKWatchedOutput output_var = output;
8910 uintptr_t output_ref = 0;
8911 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8912 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8913 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8914 output_ref = (uintptr_t)output_var.inner;
8915 if (output_var.is_owned) {
8918 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8920 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
8921 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8922 (*env)->ExceptionDescribe(env);
8923 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
8925 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8926 CHECK_ACCESS(ret_ptr);
8927 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
8929 if (get_jenv_res == JNI_EDETACHED) {
8930 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8934 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8935 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8936 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8938 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
8939 jclass c = (*env)->GetObjectClass(env, o);
8941 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8942 atomic_init(&calls->refcnt, 1);
8943 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8944 calls->o = (*env)->NewWeakGlobalRef(env, o);
8945 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
8946 CHECK(calls->register_tx_meth != NULL);
8947 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
8948 CHECK(calls->register_output_meth != NULL);
8951 .this_arg = (void*) calls,
8952 .register_tx = register_tx_LDKFilter_jcall,
8953 .register_output = register_output_LDKFilter_jcall,
8954 .free = LDKFilter_JCalls_free,
8958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
8959 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8960 *res_ptr = LDKFilter_init(env, clz, o);
8961 return (uint64_t)res_ptr;
8963 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) {
8964 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8965 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8966 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8967 unsigned char txid_arr[32];
8968 CHECK((*env)->GetArrayLength(env, txid) == 32);
8969 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
8970 unsigned char (*txid_ref)[32] = &txid_arr;
8971 LDKu8slice script_pubkey_ref;
8972 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
8973 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
8974 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8975 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
8978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
8979 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8980 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8981 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8982 LDKWatchedOutput output_conv;
8983 output_conv.inner = (void*)(output & (~1));
8984 output_conv.is_owned = (output & 1) || (output == 0);
8985 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8986 output_conv = WatchedOutput_clone(&output_conv);
8987 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
8988 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8989 uintptr_t ret_ref = (uintptr_t)ret_copy;
8993 static jclass LDKCOption_FilterZ_Some_class = NULL;
8994 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
8995 static jclass LDKCOption_FilterZ_None_class = NULL;
8996 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
8997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
8998 LDKCOption_FilterZ_Some_class =
8999 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9000 CHECK(LDKCOption_FilterZ_Some_class != NULL);
9001 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9002 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9003 LDKCOption_FilterZ_None_class =
9004 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9005 CHECK(LDKCOption_FilterZ_None_class != NULL);
9006 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9007 CHECK(LDKCOption_FilterZ_None_meth != NULL);
9009 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9010 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
9012 case LDKCOption_FilterZ_Some: {
9013 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9014 *some_ret = obj->some;
9015 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
9016 if ((*some_ret).free == LDKFilter_JCalls_free) {
9017 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9018 LDKFilter_JCalls_cloned(&(*some_ret));
9020 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uintptr_t)some_ret);
9022 case LDKCOption_FilterZ_None: {
9023 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9028 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9029 CHECK(owner->result_ok);
9030 return &*owner->contents.result;
9032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9033 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9034 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9035 uintptr_t ret_ref = 0;
9036 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9037 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9039 ret_ref = (uintptr_t)ret_var.inner & ~1;
9043 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9044 CHECK(!owner->result_ok);
9045 return *owner->contents.err;
9047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9048 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9049 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9052 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9053 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9054 for (size_t i = 0; i < ret.datalen; i++) {
9055 ret.data[i] = OutPoint_clone(&orig->data[i]);
9059 typedef struct LDKMessageSendEventsProvider_JCalls {
9060 atomic_size_t refcnt;
9063 jmethodID get_and_clear_pending_msg_events_meth;
9064 } LDKMessageSendEventsProvider_JCalls;
9065 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9066 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9067 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9069 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9070 if (get_jenv_res == JNI_EDETACHED) {
9071 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9073 DO_ASSERT(get_jenv_res == JNI_OK);
9075 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9076 if (get_jenv_res == JNI_EDETACHED) {
9077 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9082 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9083 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9085 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9086 if (get_jenv_res == JNI_EDETACHED) {
9087 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9089 DO_ASSERT(get_jenv_res == JNI_OK);
9091 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9093 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9094 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9095 (*env)->ExceptionDescribe(env);
9096 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9098 LDKCVec_MessageSendEventZ ret_constr;
9099 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9100 if (ret_constr.datalen > 0)
9101 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9103 ret_constr.data = NULL;
9104 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9105 for (size_t s = 0; s < ret_constr.datalen; s++) {
9106 int64_t ret_conv_18 = ret_vals[s];
9107 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
9108 CHECK_ACCESS(ret_conv_18_ptr);
9109 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9110 FREE((void*)ret_conv_18);
9111 ret_constr.data[s] = ret_conv_18_conv;
9113 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9114 if (get_jenv_res == JNI_EDETACHED) {
9115 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9119 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
9120 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
9121 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9123 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9124 jclass c = (*env)->GetObjectClass(env, o);
9126 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
9127 atomic_init(&calls->refcnt, 1);
9128 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9129 calls->o = (*env)->NewWeakGlobalRef(env, o);
9130 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
9131 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
9133 LDKMessageSendEventsProvider ret = {
9134 .this_arg = (void*) calls,
9135 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
9136 .free = LDKMessageSendEventsProvider_JCalls_free,
9140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9141 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9142 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
9143 return (uint64_t)res_ptr;
9145 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9146 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9147 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9148 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
9149 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
9150 int64_tArray ret_arr = NULL;
9151 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9152 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9153 for (size_t s = 0; s < ret_var.datalen; s++) {
9154 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9155 *ret_conv_18_copy = ret_var.data[s];
9156 uintptr_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
9157 ret_arr_ptr[s] = ret_conv_18_ref;
9159 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9164 typedef struct LDKEventHandler_JCalls {
9165 atomic_size_t refcnt;
9168 jmethodID handle_event_meth;
9169 } LDKEventHandler_JCalls;
9170 static void LDKEventHandler_JCalls_free(void* this_arg) {
9171 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9172 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9174 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9175 if (get_jenv_res == JNI_EDETACHED) {
9176 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9178 DO_ASSERT(get_jenv_res == JNI_OK);
9180 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9181 if (get_jenv_res == JNI_EDETACHED) {
9182 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9187 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
9188 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9190 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9191 if (get_jenv_res == JNI_EDETACHED) {
9192 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9194 DO_ASSERT(get_jenv_res == JNI_OK);
9196 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
9197 *ret_event = Event_clone(event);
9198 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9200 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uintptr_t)ret_event);
9201 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9202 (*env)->ExceptionDescribe(env);
9203 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
9205 if (get_jenv_res == JNI_EDETACHED) {
9206 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9209 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9210 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9211 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9213 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
9214 jclass c = (*env)->GetObjectClass(env, o);
9216 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9217 atomic_init(&calls->refcnt, 1);
9218 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9219 calls->o = (*env)->NewWeakGlobalRef(env, o);
9220 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
9221 CHECK(calls->handle_event_meth != NULL);
9223 LDKEventHandler ret = {
9224 .this_arg = (void*) calls,
9225 .handle_event = handle_event_LDKEventHandler_jcall,
9226 .free = LDKEventHandler_JCalls_free,
9230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
9231 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9232 *res_ptr = LDKEventHandler_init(env, clz, o);
9233 return (uint64_t)res_ptr;
9235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
9236 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9237 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9238 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9239 LDKEvent* event_conv = (LDKEvent*)event;
9240 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9243 typedef struct LDKEventsProvider_JCalls {
9244 atomic_size_t refcnt;
9247 jmethodID process_pending_events_meth;
9248 } LDKEventsProvider_JCalls;
9249 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9250 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9251 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9253 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9254 if (get_jenv_res == JNI_EDETACHED) {
9255 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9257 DO_ASSERT(get_jenv_res == JNI_OK);
9259 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9260 if (get_jenv_res == JNI_EDETACHED) {
9261 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9266 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9267 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9269 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9270 if (get_jenv_res == JNI_EDETACHED) {
9271 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9273 DO_ASSERT(get_jenv_res == JNI_OK);
9275 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9276 *handler_ret = handler;
9277 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9279 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uintptr_t)handler_ret);
9280 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9281 (*env)->ExceptionDescribe(env);
9282 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
9284 if (get_jenv_res == JNI_EDETACHED) {
9285 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9288 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9289 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9290 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9292 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9293 jclass c = (*env)->GetObjectClass(env, o);
9295 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9296 atomic_init(&calls->refcnt, 1);
9297 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9298 calls->o = (*env)->NewWeakGlobalRef(env, o);
9299 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
9300 CHECK(calls->process_pending_events_meth != NULL);
9302 LDKEventsProvider ret = {
9303 .this_arg = (void*) calls,
9304 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9305 .free = LDKEventsProvider_JCalls_free,
9309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9310 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9311 *res_ptr = LDKEventsProvider_init(env, clz, o);
9312 return (uint64_t)res_ptr;
9314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
9315 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9316 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9317 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9318 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
9319 CHECK_ACCESS(handler_ptr);
9320 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9321 if (handler_conv.free == LDKEventHandler_JCalls_free) {
9322 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9323 LDKEventHandler_JCalls_cloned(&handler_conv);
9325 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9328 typedef struct LDKListen_JCalls {
9329 atomic_size_t refcnt;
9332 jmethodID block_connected_meth;
9333 jmethodID block_disconnected_meth;
9335 static void LDKListen_JCalls_free(void* this_arg) {
9336 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9337 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9339 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9340 if (get_jenv_res == JNI_EDETACHED) {
9341 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9343 DO_ASSERT(get_jenv_res == JNI_OK);
9345 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9346 if (get_jenv_res == JNI_EDETACHED) {
9347 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9352 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9353 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9355 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9356 if (get_jenv_res == JNI_EDETACHED) {
9357 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9359 DO_ASSERT(get_jenv_res == JNI_OK);
9361 LDKu8slice block_var = block;
9362 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
9363 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
9364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9366 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
9367 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9368 (*env)->ExceptionDescribe(env);
9369 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
9371 if (get_jenv_res == JNI_EDETACHED) {
9372 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9375 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9376 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9378 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9379 if (get_jenv_res == JNI_EDETACHED) {
9380 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9382 DO_ASSERT(get_jenv_res == JNI_OK);
9384 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
9385 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
9386 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9388 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
9389 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9390 (*env)->ExceptionDescribe(env);
9391 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
9393 if (get_jenv_res == JNI_EDETACHED) {
9394 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9397 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9398 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9399 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9401 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
9402 jclass c = (*env)->GetObjectClass(env, o);
9404 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9405 atomic_init(&calls->refcnt, 1);
9406 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9407 calls->o = (*env)->NewWeakGlobalRef(env, o);
9408 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
9409 CHECK(calls->block_connected_meth != NULL);
9410 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
9411 CHECK(calls->block_disconnected_meth != NULL);
9414 .this_arg = (void*) calls,
9415 .block_connected = block_connected_LDKListen_jcall,
9416 .block_disconnected = block_disconnected_LDKListen_jcall,
9417 .free = LDKListen_JCalls_free,
9421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
9422 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9423 *res_ptr = LDKListen_init(env, clz, o);
9424 return (uint64_t)res_ptr;
9426 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) {
9427 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9428 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9429 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9430 LDKu8slice block_ref;
9431 block_ref.datalen = (*env)->GetArrayLength(env, block);
9432 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
9433 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9434 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
9437 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) {
9438 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9439 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9440 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9441 unsigned char header_arr[80];
9442 CHECK((*env)->GetArrayLength(env, header) == 80);
9443 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9444 unsigned char (*header_ref)[80] = &header_arr;
9445 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9448 typedef struct LDKConfirm_JCalls {
9449 atomic_size_t refcnt;
9452 jmethodID transactions_confirmed_meth;
9453 jmethodID transaction_unconfirmed_meth;
9454 jmethodID best_block_updated_meth;
9455 jmethodID get_relevant_txids_meth;
9456 } LDKConfirm_JCalls;
9457 static void LDKConfirm_JCalls_free(void* this_arg) {
9458 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9459 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9461 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9462 if (get_jenv_res == JNI_EDETACHED) {
9463 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9465 DO_ASSERT(get_jenv_res == JNI_OK);
9467 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9468 if (get_jenv_res == JNI_EDETACHED) {
9469 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9474 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9475 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9477 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9478 if (get_jenv_res == JNI_EDETACHED) {
9479 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9481 DO_ASSERT(get_jenv_res == JNI_OK);
9483 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
9484 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
9485 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9486 int64_tArray txdata_arr = NULL;
9487 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
9488 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
9489 for (size_t c = 0; c < txdata_var.datalen; c++) {
9490 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9491 *txdata_conv_28_conv = txdata_var.data[c];
9492 txdata_arr_ptr[c] = ((uintptr_t)txdata_conv_28_conv);
9494 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
9495 FREE(txdata_var.data);
9496 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9498 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
9499 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9500 (*env)->ExceptionDescribe(env);
9501 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
9503 if (get_jenv_res == JNI_EDETACHED) {
9504 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9507 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9508 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9510 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9511 if (get_jenv_res == JNI_EDETACHED) {
9512 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9514 DO_ASSERT(get_jenv_res == JNI_OK);
9516 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9517 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9518 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9520 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
9521 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9522 (*env)->ExceptionDescribe(env);
9523 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
9525 if (get_jenv_res == JNI_EDETACHED) {
9526 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9529 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9530 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9532 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9533 if (get_jenv_res == JNI_EDETACHED) {
9534 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9536 DO_ASSERT(get_jenv_res == JNI_OK);
9538 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
9539 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
9540 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9542 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
9543 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9544 (*env)->ExceptionDescribe(env);
9545 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
9547 if (get_jenv_res == JNI_EDETACHED) {
9548 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9551 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9552 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9554 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9555 if (get_jenv_res == JNI_EDETACHED) {
9556 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9558 DO_ASSERT(get_jenv_res == JNI_OK);
9560 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9562 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
9563 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9564 (*env)->ExceptionDescribe(env);
9565 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
9567 LDKCVec_TxidZ ret_constr;
9568 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9569 if (ret_constr.datalen > 0)
9570 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9572 ret_constr.data = NULL;
9573 for (size_t i = 0; i < ret_constr.datalen; i++) {
9574 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
9575 LDKThirtyTwoBytes ret_conv_8_ref;
9576 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
9577 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
9578 ret_constr.data[i] = ret_conv_8_ref;
9580 if (get_jenv_res == JNI_EDETACHED) {
9581 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9585 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9586 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9587 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9589 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
9590 jclass c = (*env)->GetObjectClass(env, o);
9592 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9593 atomic_init(&calls->refcnt, 1);
9594 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9595 calls->o = (*env)->NewWeakGlobalRef(env, o);
9596 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
9597 CHECK(calls->transactions_confirmed_meth != NULL);
9598 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
9599 CHECK(calls->transaction_unconfirmed_meth != NULL);
9600 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
9601 CHECK(calls->best_block_updated_meth != NULL);
9602 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
9603 CHECK(calls->get_relevant_txids_meth != NULL);
9606 .this_arg = (void*) calls,
9607 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9608 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9609 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9610 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9611 .free = LDKConfirm_JCalls_free,
9615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
9616 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9617 *res_ptr = LDKConfirm_init(env, clz, o);
9618 return (uint64_t)res_ptr;
9620 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) {
9621 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9622 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9623 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9624 unsigned char header_arr[80];
9625 CHECK((*env)->GetArrayLength(env, header) == 80);
9626 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9627 unsigned char (*header_ref)[80] = &header_arr;
9628 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9629 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
9630 if (txdata_constr.datalen > 0)
9631 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9633 txdata_constr.data = NULL;
9634 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
9635 for (size_t c = 0; c < txdata_constr.datalen; c++) {
9636 int64_t txdata_conv_28 = txdata_vals[c];
9637 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
9638 CHECK_ACCESS(txdata_conv_28_ptr);
9639 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9640 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
9641 txdata_constr.data[c] = txdata_conv_28_conv;
9643 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
9644 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
9648 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9649 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9650 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9651 unsigned char txid_arr[32];
9652 CHECK((*env)->GetArrayLength(env, txid) == 32);
9653 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9654 unsigned char (*txid_ref)[32] = &txid_arr;
9655 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9658 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) {
9659 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9660 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9661 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9662 unsigned char header_arr[80];
9663 CHECK((*env)->GetArrayLength(env, header) == 80);
9664 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9665 unsigned char (*header_ref)[80] = &header_arr;
9666 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9669 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
9670 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9671 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9672 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9673 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9674 jobjectArray ret_arr = NULL;
9675 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
9677 for (size_t i = 0; i < ret_var.datalen; i++) {
9678 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
9679 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
9680 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
9687 typedef struct LDKPersist_JCalls {
9688 atomic_size_t refcnt;
9691 jmethodID persist_new_channel_meth;
9692 jmethodID update_persisted_channel_meth;
9693 } LDKPersist_JCalls;
9694 static void LDKPersist_JCalls_free(void* this_arg) {
9695 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9696 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9698 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9699 if (get_jenv_res == JNI_EDETACHED) {
9700 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9702 DO_ASSERT(get_jenv_res == JNI_OK);
9704 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9705 if (get_jenv_res == JNI_EDETACHED) {
9706 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9711 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9712 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9714 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9715 if (get_jenv_res == JNI_EDETACHED) {
9716 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9718 DO_ASSERT(get_jenv_res == JNI_OK);
9720 LDKOutPoint channel_id_var = channel_id;
9721 uintptr_t channel_id_ref = 0;
9722 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9723 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9724 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9725 channel_id_ref = (uintptr_t)channel_id_var.inner;
9726 if (channel_id_var.is_owned) {
9727 channel_id_ref |= 1;
9729 LDKChannelMonitor data_var = *data;
9730 uintptr_t data_ref = 0;
9731 data_var = ChannelMonitor_clone(data);
9732 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9733 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9734 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9735 data_ref = (uintptr_t)data_var.inner;
9736 if (data_var.is_owned) {
9739 LDKMonitorUpdateId update_id_var = update_id;
9740 uintptr_t update_id_ref = 0;
9741 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9742 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9743 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9744 update_id_ref = (uintptr_t)update_id_var.inner;
9745 if (update_id_var.is_owned) {
9748 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9750 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
9751 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9752 (*env)->ExceptionDescribe(env);
9753 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
9755 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9756 CHECK_ACCESS(ret_ptr);
9757 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
9759 if (get_jenv_res == JNI_EDETACHED) {
9760 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9764 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9765 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9767 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9768 if (get_jenv_res == JNI_EDETACHED) {
9769 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9771 DO_ASSERT(get_jenv_res == JNI_OK);
9773 LDKOutPoint channel_id_var = channel_id;
9774 uintptr_t channel_id_ref = 0;
9775 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9776 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9777 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9778 channel_id_ref = (uintptr_t)channel_id_var.inner;
9779 if (channel_id_var.is_owned) {
9780 channel_id_ref |= 1;
9782 LDKChannelMonitorUpdate update_var = *update;
9783 uintptr_t update_ref = 0;
9784 if ((uintptr_t)update_var.inner > 4096) {
9785 update_var = ChannelMonitorUpdate_clone(update);
9786 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9787 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9788 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9789 update_ref = (uintptr_t)update_var.inner;
9790 if (update_var.is_owned) {
9794 LDKChannelMonitor data_var = *data;
9795 uintptr_t data_ref = 0;
9796 data_var = ChannelMonitor_clone(data);
9797 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9798 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9799 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9800 data_ref = (uintptr_t)data_var.inner;
9801 if (data_var.is_owned) {
9804 LDKMonitorUpdateId update_id_var = update_id;
9805 uintptr_t update_id_ref = 0;
9806 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9807 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9808 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9809 update_id_ref = (uintptr_t)update_id_var.inner;
9810 if (update_id_var.is_owned) {
9813 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9815 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
9816 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9817 (*env)->ExceptionDescribe(env);
9818 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
9820 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9821 CHECK_ACCESS(ret_ptr);
9822 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
9824 if (get_jenv_res == JNI_EDETACHED) {
9825 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9829 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9830 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9831 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9833 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
9834 jclass c = (*env)->GetObjectClass(env, o);
9836 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9837 atomic_init(&calls->refcnt, 1);
9838 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9839 calls->o = (*env)->NewWeakGlobalRef(env, o);
9840 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
9841 CHECK(calls->persist_new_channel_meth != NULL);
9842 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
9843 CHECK(calls->update_persisted_channel_meth != NULL);
9846 .this_arg = (void*) calls,
9847 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9848 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9849 .free = LDKPersist_JCalls_free,
9853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
9854 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9855 *res_ptr = LDKPersist_init(env, clz, o);
9856 return (uint64_t)res_ptr;
9858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t data, int64_t update_id) {
9859 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9860 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9861 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9862 LDKOutPoint channel_id_conv;
9863 channel_id_conv.inner = (void*)(channel_id & (~1));
9864 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9865 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9866 channel_id_conv = OutPoint_clone(&channel_id_conv);
9867 LDKChannelMonitor data_conv;
9868 data_conv.inner = (void*)(data & (~1));
9869 data_conv.is_owned = false;
9870 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9871 LDKMonitorUpdateId update_id_conv;
9872 update_id_conv.inner = (void*)(update_id & (~1));
9873 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9874 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9875 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9876 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9877 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
9878 return (uintptr_t)ret_conv;
9881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int64_t update, int64_t data, int64_t update_id) {
9882 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9883 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9884 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9885 LDKOutPoint channel_id_conv;
9886 channel_id_conv.inner = (void*)(channel_id & (~1));
9887 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
9888 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9889 channel_id_conv = OutPoint_clone(&channel_id_conv);
9890 LDKChannelMonitorUpdate update_conv;
9891 update_conv.inner = (void*)(update & (~1));
9892 update_conv.is_owned = false;
9893 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9894 LDKChannelMonitor data_conv;
9895 data_conv.inner = (void*)(data & (~1));
9896 data_conv.is_owned = false;
9897 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9898 LDKMonitorUpdateId update_id_conv;
9899 update_id_conv.inner = (void*)(update_id & (~1));
9900 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
9901 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9902 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9903 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9904 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
9905 return (uintptr_t)ret_conv;
9908 typedef struct LDKChannelMessageHandler_JCalls {
9909 atomic_size_t refcnt;
9912 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9913 jmethodID handle_open_channel_meth;
9914 jmethodID handle_accept_channel_meth;
9915 jmethodID handle_funding_created_meth;
9916 jmethodID handle_funding_signed_meth;
9917 jmethodID handle_funding_locked_meth;
9918 jmethodID handle_shutdown_meth;
9919 jmethodID handle_closing_signed_meth;
9920 jmethodID handle_update_add_htlc_meth;
9921 jmethodID handle_update_fulfill_htlc_meth;
9922 jmethodID handle_update_fail_htlc_meth;
9923 jmethodID handle_update_fail_malformed_htlc_meth;
9924 jmethodID handle_commitment_signed_meth;
9925 jmethodID handle_revoke_and_ack_meth;
9926 jmethodID handle_update_fee_meth;
9927 jmethodID handle_announcement_signatures_meth;
9928 jmethodID peer_disconnected_meth;
9929 jmethodID peer_connected_meth;
9930 jmethodID handle_channel_reestablish_meth;
9931 jmethodID handle_channel_update_meth;
9932 jmethodID handle_error_meth;
9933 } LDKChannelMessageHandler_JCalls;
9934 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9935 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9936 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9938 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9939 if (get_jenv_res == JNI_EDETACHED) {
9940 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9942 DO_ASSERT(get_jenv_res == JNI_OK);
9944 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9945 if (get_jenv_res == JNI_EDETACHED) {
9946 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9951 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9952 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9954 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9955 if (get_jenv_res == JNI_EDETACHED) {
9956 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9958 DO_ASSERT(get_jenv_res == JNI_OK);
9960 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9961 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9962 LDKInitFeatures their_features_var = their_features;
9963 uintptr_t their_features_ref = 0;
9964 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9965 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9966 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9967 their_features_ref = (uintptr_t)their_features_var.inner;
9968 if (their_features_var.is_owned) {
9969 their_features_ref |= 1;
9971 LDKOpenChannel msg_var = *msg;
9972 uintptr_t msg_ref = 0;
9973 msg_var = OpenChannel_clone(msg);
9974 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9975 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9976 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9977 msg_ref = (uintptr_t)msg_var.inner;
9978 if (msg_var.is_owned) {
9981 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9983 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
9984 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9985 (*env)->ExceptionDescribe(env);
9986 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
9988 if (get_jenv_res == JNI_EDETACHED) {
9989 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9992 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9993 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9995 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9996 if (get_jenv_res == JNI_EDETACHED) {
9997 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9999 DO_ASSERT(get_jenv_res == JNI_OK);
10001 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10002 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10003 LDKInitFeatures their_features_var = their_features;
10004 uintptr_t their_features_ref = 0;
10005 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10006 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10007 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10008 their_features_ref = (uintptr_t)their_features_var.inner;
10009 if (their_features_var.is_owned) {
10010 their_features_ref |= 1;
10012 LDKAcceptChannel msg_var = *msg;
10013 uintptr_t msg_ref = 0;
10014 msg_var = AcceptChannel_clone(msg);
10015 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10016 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10017 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10018 msg_ref = (uintptr_t)msg_var.inner;
10019 if (msg_var.is_owned) {
10022 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10023 CHECK(obj != NULL);
10024 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10025 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10026 (*env)->ExceptionDescribe(env);
10027 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
10029 if (get_jenv_res == JNI_EDETACHED) {
10030 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10033 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10034 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10036 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10037 if (get_jenv_res == JNI_EDETACHED) {
10038 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10040 DO_ASSERT(get_jenv_res == JNI_OK);
10042 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10043 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10044 LDKFundingCreated msg_var = *msg;
10045 uintptr_t msg_ref = 0;
10046 msg_var = FundingCreated_clone(msg);
10047 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10048 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10049 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10050 msg_ref = (uintptr_t)msg_var.inner;
10051 if (msg_var.is_owned) {
10054 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10055 CHECK(obj != NULL);
10056 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
10057 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10058 (*env)->ExceptionDescribe(env);
10059 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
10061 if (get_jenv_res == JNI_EDETACHED) {
10062 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10065 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
10066 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10068 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10069 if (get_jenv_res == JNI_EDETACHED) {
10070 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10072 DO_ASSERT(get_jenv_res == JNI_OK);
10074 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10075 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10076 LDKFundingSigned msg_var = *msg;
10077 uintptr_t msg_ref = 0;
10078 msg_var = FundingSigned_clone(msg);
10079 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10080 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10081 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10082 msg_ref = (uintptr_t)msg_var.inner;
10083 if (msg_var.is_owned) {
10086 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10087 CHECK(obj != NULL);
10088 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
10089 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10090 (*env)->ExceptionDescribe(env);
10091 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
10093 if (get_jenv_res == JNI_EDETACHED) {
10094 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10097 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
10098 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10100 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10101 if (get_jenv_res == JNI_EDETACHED) {
10102 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10104 DO_ASSERT(get_jenv_res == JNI_OK);
10106 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10107 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10108 LDKFundingLocked msg_var = *msg;
10109 uintptr_t msg_ref = 0;
10110 msg_var = FundingLocked_clone(msg);
10111 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10112 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10113 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10114 msg_ref = (uintptr_t)msg_var.inner;
10115 if (msg_var.is_owned) {
10118 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10119 CHECK(obj != NULL);
10120 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
10121 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10122 (*env)->ExceptionDescribe(env);
10123 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
10125 if (get_jenv_res == JNI_EDETACHED) {
10126 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10129 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
10130 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10132 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10133 if (get_jenv_res == JNI_EDETACHED) {
10134 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10136 DO_ASSERT(get_jenv_res == JNI_OK);
10138 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10139 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10140 LDKInitFeatures their_features_var = *their_features;
10141 uintptr_t their_features_ref = 0;
10142 their_features_var = InitFeatures_clone(their_features);
10143 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10144 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10145 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10146 their_features_ref = (uintptr_t)their_features_var.inner;
10147 if (their_features_var.is_owned) {
10148 their_features_ref |= 1;
10150 LDKShutdown msg_var = *msg;
10151 uintptr_t msg_ref = 0;
10152 msg_var = Shutdown_clone(msg);
10153 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10154 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10155 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10156 msg_ref = (uintptr_t)msg_var.inner;
10157 if (msg_var.is_owned) {
10160 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10161 CHECK(obj != NULL);
10162 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
10163 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10164 (*env)->ExceptionDescribe(env);
10165 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
10167 if (get_jenv_res == JNI_EDETACHED) {
10168 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10171 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
10172 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10174 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10175 if (get_jenv_res == JNI_EDETACHED) {
10176 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10178 DO_ASSERT(get_jenv_res == JNI_OK);
10180 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10181 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10182 LDKClosingSigned msg_var = *msg;
10183 uintptr_t msg_ref = 0;
10184 msg_var = ClosingSigned_clone(msg);
10185 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10186 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10187 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10188 msg_ref = (uintptr_t)msg_var.inner;
10189 if (msg_var.is_owned) {
10192 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10193 CHECK(obj != NULL);
10194 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
10195 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10196 (*env)->ExceptionDescribe(env);
10197 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
10199 if (get_jenv_res == JNI_EDETACHED) {
10200 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10203 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
10204 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10206 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10207 if (get_jenv_res == JNI_EDETACHED) {
10208 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10210 DO_ASSERT(get_jenv_res == JNI_OK);
10212 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10213 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10214 LDKUpdateAddHTLC msg_var = *msg;
10215 uintptr_t msg_ref = 0;
10216 msg_var = UpdateAddHTLC_clone(msg);
10217 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10218 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10219 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10220 msg_ref = (uintptr_t)msg_var.inner;
10221 if (msg_var.is_owned) {
10224 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10225 CHECK(obj != NULL);
10226 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
10227 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10228 (*env)->ExceptionDescribe(env);
10229 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
10231 if (get_jenv_res == JNI_EDETACHED) {
10232 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10235 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
10236 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10238 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10239 if (get_jenv_res == JNI_EDETACHED) {
10240 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10242 DO_ASSERT(get_jenv_res == JNI_OK);
10244 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10245 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10246 LDKUpdateFulfillHTLC msg_var = *msg;
10247 uintptr_t msg_ref = 0;
10248 msg_var = UpdateFulfillHTLC_clone(msg);
10249 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10250 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10251 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10252 msg_ref = (uintptr_t)msg_var.inner;
10253 if (msg_var.is_owned) {
10256 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10257 CHECK(obj != NULL);
10258 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
10259 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10260 (*env)->ExceptionDescribe(env);
10261 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
10263 if (get_jenv_res == JNI_EDETACHED) {
10264 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10267 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
10268 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10270 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10271 if (get_jenv_res == JNI_EDETACHED) {
10272 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10274 DO_ASSERT(get_jenv_res == JNI_OK);
10276 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10277 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10278 LDKUpdateFailHTLC msg_var = *msg;
10279 uintptr_t msg_ref = 0;
10280 msg_var = UpdateFailHTLC_clone(msg);
10281 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10282 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10283 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10284 msg_ref = (uintptr_t)msg_var.inner;
10285 if (msg_var.is_owned) {
10288 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10289 CHECK(obj != NULL);
10290 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
10291 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10292 (*env)->ExceptionDescribe(env);
10293 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
10295 if (get_jenv_res == JNI_EDETACHED) {
10296 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10299 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
10300 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10302 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10303 if (get_jenv_res == JNI_EDETACHED) {
10304 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10306 DO_ASSERT(get_jenv_res == JNI_OK);
10308 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10309 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10310 LDKUpdateFailMalformedHTLC msg_var = *msg;
10311 uintptr_t msg_ref = 0;
10312 msg_var = UpdateFailMalformedHTLC_clone(msg);
10313 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10314 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10315 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10316 msg_ref = (uintptr_t)msg_var.inner;
10317 if (msg_var.is_owned) {
10320 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10321 CHECK(obj != NULL);
10322 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
10323 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10324 (*env)->ExceptionDescribe(env);
10325 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
10327 if (get_jenv_res == JNI_EDETACHED) {
10328 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10331 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
10332 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10334 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10335 if (get_jenv_res == JNI_EDETACHED) {
10336 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10338 DO_ASSERT(get_jenv_res == JNI_OK);
10340 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10341 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10342 LDKCommitmentSigned msg_var = *msg;
10343 uintptr_t msg_ref = 0;
10344 msg_var = CommitmentSigned_clone(msg);
10345 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10346 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10347 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10348 msg_ref = (uintptr_t)msg_var.inner;
10349 if (msg_var.is_owned) {
10352 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10353 CHECK(obj != NULL);
10354 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
10355 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10356 (*env)->ExceptionDescribe(env);
10357 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
10359 if (get_jenv_res == JNI_EDETACHED) {
10360 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10363 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
10364 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10366 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10367 if (get_jenv_res == JNI_EDETACHED) {
10368 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10370 DO_ASSERT(get_jenv_res == JNI_OK);
10372 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10373 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10374 LDKRevokeAndACK msg_var = *msg;
10375 uintptr_t msg_ref = 0;
10376 msg_var = RevokeAndACK_clone(msg);
10377 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10378 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10379 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10380 msg_ref = (uintptr_t)msg_var.inner;
10381 if (msg_var.is_owned) {
10384 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10385 CHECK(obj != NULL);
10386 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
10387 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10388 (*env)->ExceptionDescribe(env);
10389 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
10391 if (get_jenv_res == JNI_EDETACHED) {
10392 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10395 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
10396 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10398 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10399 if (get_jenv_res == JNI_EDETACHED) {
10400 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10402 DO_ASSERT(get_jenv_res == JNI_OK);
10404 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10405 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10406 LDKUpdateFee msg_var = *msg;
10407 uintptr_t msg_ref = 0;
10408 msg_var = UpdateFee_clone(msg);
10409 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10410 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10411 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10412 msg_ref = (uintptr_t)msg_var.inner;
10413 if (msg_var.is_owned) {
10416 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10417 CHECK(obj != NULL);
10418 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
10419 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10420 (*env)->ExceptionDescribe(env);
10421 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
10423 if (get_jenv_res == JNI_EDETACHED) {
10424 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10427 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
10428 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10430 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10431 if (get_jenv_res == JNI_EDETACHED) {
10432 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10434 DO_ASSERT(get_jenv_res == JNI_OK);
10436 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10437 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10438 LDKAnnouncementSignatures msg_var = *msg;
10439 uintptr_t msg_ref = 0;
10440 msg_var = AnnouncementSignatures_clone(msg);
10441 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10442 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10443 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10444 msg_ref = (uintptr_t)msg_var.inner;
10445 if (msg_var.is_owned) {
10448 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10449 CHECK(obj != NULL);
10450 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
10451 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10452 (*env)->ExceptionDescribe(env);
10453 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
10455 if (get_jenv_res == JNI_EDETACHED) {
10456 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10459 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10460 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10462 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10463 if (get_jenv_res == JNI_EDETACHED) {
10464 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10466 DO_ASSERT(get_jenv_res == JNI_OK);
10468 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10469 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10470 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10471 CHECK(obj != NULL);
10472 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
10473 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10474 (*env)->ExceptionDescribe(env);
10475 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
10477 if (get_jenv_res == JNI_EDETACHED) {
10478 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10481 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
10482 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10484 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10485 if (get_jenv_res == JNI_EDETACHED) {
10486 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10488 DO_ASSERT(get_jenv_res == JNI_OK);
10490 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10491 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10492 LDKInit msg_var = *msg;
10493 uintptr_t msg_ref = 0;
10494 msg_var = Init_clone(msg);
10495 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10496 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10497 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10498 msg_ref = (uintptr_t)msg_var.inner;
10499 if (msg_var.is_owned) {
10502 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10503 CHECK(obj != NULL);
10504 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
10505 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10506 (*env)->ExceptionDescribe(env);
10507 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
10509 if (get_jenv_res == JNI_EDETACHED) {
10510 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10513 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
10514 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10516 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10517 if (get_jenv_res == JNI_EDETACHED) {
10518 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10520 DO_ASSERT(get_jenv_res == JNI_OK);
10522 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10523 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10524 LDKChannelReestablish msg_var = *msg;
10525 uintptr_t msg_ref = 0;
10526 msg_var = ChannelReestablish_clone(msg);
10527 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10528 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10529 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10530 msg_ref = (uintptr_t)msg_var.inner;
10531 if (msg_var.is_owned) {
10534 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10535 CHECK(obj != NULL);
10536 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
10537 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10538 (*env)->ExceptionDescribe(env);
10539 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
10541 if (get_jenv_res == JNI_EDETACHED) {
10542 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10545 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
10546 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10548 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10549 if (get_jenv_res == JNI_EDETACHED) {
10550 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10552 DO_ASSERT(get_jenv_res == JNI_OK);
10554 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10555 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10556 LDKChannelUpdate msg_var = *msg;
10557 uintptr_t msg_ref = 0;
10558 msg_var = ChannelUpdate_clone(msg);
10559 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10560 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10561 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10562 msg_ref = (uintptr_t)msg_var.inner;
10563 if (msg_var.is_owned) {
10566 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10567 CHECK(obj != NULL);
10568 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
10569 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10570 (*env)->ExceptionDescribe(env);
10571 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
10573 if (get_jenv_res == JNI_EDETACHED) {
10574 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10577 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
10578 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10580 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10581 if (get_jenv_res == JNI_EDETACHED) {
10582 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10584 DO_ASSERT(get_jenv_res == JNI_OK);
10586 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10587 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10588 LDKErrorMessage msg_var = *msg;
10589 uintptr_t msg_ref = 0;
10590 msg_var = ErrorMessage_clone(msg);
10591 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10592 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10593 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10594 msg_ref = (uintptr_t)msg_var.inner;
10595 if (msg_var.is_owned) {
10598 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10599 CHECK(obj != NULL);
10600 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
10601 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10602 (*env)->ExceptionDescribe(env);
10603 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
10605 if (get_jenv_res == JNI_EDETACHED) {
10606 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10609 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
10610 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
10611 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10612 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10614 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
10615 jclass c = (*env)->GetObjectClass(env, o);
10617 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
10618 atomic_init(&calls->refcnt, 1);
10619 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10620 calls->o = (*env)->NewWeakGlobalRef(env, o);
10621 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
10622 CHECK(calls->handle_open_channel_meth != NULL);
10623 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
10624 CHECK(calls->handle_accept_channel_meth != NULL);
10625 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
10626 CHECK(calls->handle_funding_created_meth != NULL);
10627 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
10628 CHECK(calls->handle_funding_signed_meth != NULL);
10629 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
10630 CHECK(calls->handle_funding_locked_meth != NULL);
10631 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
10632 CHECK(calls->handle_shutdown_meth != NULL);
10633 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
10634 CHECK(calls->handle_closing_signed_meth != NULL);
10635 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
10636 CHECK(calls->handle_update_add_htlc_meth != NULL);
10637 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
10638 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
10639 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
10640 CHECK(calls->handle_update_fail_htlc_meth != NULL);
10641 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
10642 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
10643 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
10644 CHECK(calls->handle_commitment_signed_meth != NULL);
10645 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
10646 CHECK(calls->handle_revoke_and_ack_meth != NULL);
10647 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
10648 CHECK(calls->handle_update_fee_meth != NULL);
10649 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
10650 CHECK(calls->handle_announcement_signatures_meth != NULL);
10651 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
10652 CHECK(calls->peer_disconnected_meth != NULL);
10653 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
10654 CHECK(calls->peer_connected_meth != NULL);
10655 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
10656 CHECK(calls->handle_channel_reestablish_meth != NULL);
10657 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
10658 CHECK(calls->handle_channel_update_meth != NULL);
10659 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
10660 CHECK(calls->handle_error_meth != NULL);
10662 LDKChannelMessageHandler ret = {
10663 .this_arg = (void*) calls,
10664 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
10665 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
10666 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
10667 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
10668 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
10669 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
10670 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
10671 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
10672 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
10673 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
10674 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
10675 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
10676 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
10677 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
10678 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
10679 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
10680 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
10681 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
10682 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
10683 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
10684 .free = LDKChannelMessageHandler_JCalls_free,
10685 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
10687 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
10691 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
10692 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
10693 return (uint64_t)res_ptr;
10695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
10696 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
10697 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
10698 DO_ASSERT((res_ptr & 1) == 0);
10699 return (int64_t)(res_ptr | 1);
10701 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) {
10702 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10703 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10704 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10705 LDKPublicKey their_node_id_ref;
10706 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10707 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10708 LDKInitFeatures their_features_conv;
10709 their_features_conv.inner = (void*)(their_features & (~1));
10710 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
10711 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
10712 their_features_conv = InitFeatures_clone(&their_features_conv);
10713 LDKOpenChannel msg_conv;
10714 msg_conv.inner = (void*)(msg & (~1));
10715 msg_conv.is_owned = false;
10716 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10717 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
10720 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) {
10721 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10722 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10723 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10724 LDKPublicKey their_node_id_ref;
10725 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10726 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10727 LDKInitFeatures their_features_conv;
10728 their_features_conv.inner = (void*)(their_features & (~1));
10729 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
10730 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
10731 their_features_conv = InitFeatures_clone(&their_features_conv);
10732 LDKAcceptChannel msg_conv;
10733 msg_conv.inner = (void*)(msg & (~1));
10734 msg_conv.is_owned = false;
10735 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10736 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
10739 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) {
10740 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10741 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10742 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10743 LDKPublicKey their_node_id_ref;
10744 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10745 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10746 LDKFundingCreated msg_conv;
10747 msg_conv.inner = (void*)(msg & (~1));
10748 msg_conv.is_owned = false;
10749 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10750 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10753 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) {
10754 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10755 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10756 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10757 LDKPublicKey their_node_id_ref;
10758 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10759 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10760 LDKFundingSigned msg_conv;
10761 msg_conv.inner = (void*)(msg & (~1));
10762 msg_conv.is_owned = false;
10763 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10764 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10767 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) {
10768 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10769 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10770 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10771 LDKPublicKey their_node_id_ref;
10772 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10773 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10774 LDKFundingLocked msg_conv;
10775 msg_conv.inner = (void*)(msg & (~1));
10776 msg_conv.is_owned = false;
10777 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10778 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10781 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) {
10782 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10783 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10784 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10785 LDKPublicKey their_node_id_ref;
10786 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10787 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10788 LDKInitFeatures their_features_conv;
10789 their_features_conv.inner = (void*)(their_features & (~1));
10790 their_features_conv.is_owned = false;
10791 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
10792 LDKShutdown msg_conv;
10793 msg_conv.inner = (void*)(msg & (~1));
10794 msg_conv.is_owned = false;
10795 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10796 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
10799 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) {
10800 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10801 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10802 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10803 LDKPublicKey their_node_id_ref;
10804 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10805 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10806 LDKClosingSigned msg_conv;
10807 msg_conv.inner = (void*)(msg & (~1));
10808 msg_conv.is_owned = false;
10809 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10810 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10813 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) {
10814 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10815 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10816 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10817 LDKPublicKey their_node_id_ref;
10818 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10819 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10820 LDKUpdateAddHTLC msg_conv;
10821 msg_conv.inner = (void*)(msg & (~1));
10822 msg_conv.is_owned = false;
10823 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10824 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10827 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) {
10828 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10829 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10830 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10831 LDKPublicKey their_node_id_ref;
10832 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10833 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10834 LDKUpdateFulfillHTLC msg_conv;
10835 msg_conv.inner = (void*)(msg & (~1));
10836 msg_conv.is_owned = false;
10837 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10838 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10841 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) {
10842 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10843 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10844 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10845 LDKPublicKey their_node_id_ref;
10846 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10847 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10848 LDKUpdateFailHTLC msg_conv;
10849 msg_conv.inner = (void*)(msg & (~1));
10850 msg_conv.is_owned = false;
10851 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10852 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10855 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) {
10856 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10857 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10858 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10859 LDKPublicKey their_node_id_ref;
10860 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10861 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10862 LDKUpdateFailMalformedHTLC msg_conv;
10863 msg_conv.inner = (void*)(msg & (~1));
10864 msg_conv.is_owned = false;
10865 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10866 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10869 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) {
10870 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10871 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10872 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10873 LDKPublicKey their_node_id_ref;
10874 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10875 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10876 LDKCommitmentSigned msg_conv;
10877 msg_conv.inner = (void*)(msg & (~1));
10878 msg_conv.is_owned = false;
10879 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10880 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10883 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) {
10884 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10885 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10886 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10887 LDKPublicKey their_node_id_ref;
10888 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10889 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10890 LDKRevokeAndACK msg_conv;
10891 msg_conv.inner = (void*)(msg & (~1));
10892 msg_conv.is_owned = false;
10893 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10894 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10897 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) {
10898 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10899 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10900 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10901 LDKPublicKey their_node_id_ref;
10902 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10903 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10904 LDKUpdateFee msg_conv;
10905 msg_conv.inner = (void*)(msg & (~1));
10906 msg_conv.is_owned = false;
10907 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10908 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10911 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) {
10912 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10913 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10914 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10915 LDKPublicKey their_node_id_ref;
10916 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10917 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10918 LDKAnnouncementSignatures msg_conv;
10919 msg_conv.inner = (void*)(msg & (~1));
10920 msg_conv.is_owned = false;
10921 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10922 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10925 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) {
10926 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10927 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10928 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10929 LDKPublicKey their_node_id_ref;
10930 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10931 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10932 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10935 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) {
10936 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10937 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10938 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10939 LDKPublicKey their_node_id_ref;
10940 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10941 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10943 msg_conv.inner = (void*)(msg & (~1));
10944 msg_conv.is_owned = false;
10945 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10946 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10949 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) {
10950 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10951 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10952 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10953 LDKPublicKey their_node_id_ref;
10954 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10955 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10956 LDKChannelReestablish msg_conv;
10957 msg_conv.inner = (void*)(msg & (~1));
10958 msg_conv.is_owned = false;
10959 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10960 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10963 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) {
10964 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10965 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10966 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10967 LDKPublicKey their_node_id_ref;
10968 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10969 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10970 LDKChannelUpdate msg_conv;
10971 msg_conv.inner = (void*)(msg & (~1));
10972 msg_conv.is_owned = false;
10973 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10974 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10977 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) {
10978 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10979 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10980 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
10981 LDKPublicKey their_node_id_ref;
10982 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
10983 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10984 LDKErrorMessage msg_conv;
10985 msg_conv.inner = (void*)(msg & (~1));
10986 msg_conv.is_owned = false;
10987 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10988 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
10991 typedef struct LDKRoutingMessageHandler_JCalls {
10992 atomic_size_t refcnt;
10995 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10996 jmethodID handle_node_announcement_meth;
10997 jmethodID handle_channel_announcement_meth;
10998 jmethodID handle_channel_update_meth;
10999 jmethodID get_next_channel_announcements_meth;
11000 jmethodID get_next_node_announcements_meth;
11001 jmethodID sync_routing_table_meth;
11002 jmethodID handle_reply_channel_range_meth;
11003 jmethodID handle_reply_short_channel_ids_end_meth;
11004 jmethodID handle_query_channel_range_meth;
11005 jmethodID handle_query_short_channel_ids_meth;
11006 } LDKRoutingMessageHandler_JCalls;
11007 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11008 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11009 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11011 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11012 if (get_jenv_res == JNI_EDETACHED) {
11013 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11015 DO_ASSERT(get_jenv_res == JNI_OK);
11017 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11018 if (get_jenv_res == JNI_EDETACHED) {
11019 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11024 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11025 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11027 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11028 if (get_jenv_res == JNI_EDETACHED) {
11029 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11031 DO_ASSERT(get_jenv_res == JNI_OK);
11033 LDKNodeAnnouncement msg_var = *msg;
11034 uintptr_t msg_ref = 0;
11035 msg_var = NodeAnnouncement_clone(msg);
11036 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11037 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11038 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11039 msg_ref = (uintptr_t)msg_var.inner;
11040 if (msg_var.is_owned) {
11043 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11044 CHECK(obj != NULL);
11045 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11046 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11047 (*env)->ExceptionDescribe(env);
11048 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11050 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11051 CHECK_ACCESS(ret_ptr);
11052 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11054 if (get_jenv_res == JNI_EDETACHED) {
11055 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11059 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
11060 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11062 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11063 if (get_jenv_res == JNI_EDETACHED) {
11064 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11066 DO_ASSERT(get_jenv_res == JNI_OK);
11068 LDKChannelAnnouncement msg_var = *msg;
11069 uintptr_t msg_ref = 0;
11070 msg_var = ChannelAnnouncement_clone(msg);
11071 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11072 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11073 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11074 msg_ref = (uintptr_t)msg_var.inner;
11075 if (msg_var.is_owned) {
11078 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11079 CHECK(obj != NULL);
11080 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
11081 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11082 (*env)->ExceptionDescribe(env);
11083 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11085 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11086 CHECK_ACCESS(ret_ptr);
11087 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11089 if (get_jenv_res == JNI_EDETACHED) {
11090 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11094 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
11095 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11097 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11098 if (get_jenv_res == JNI_EDETACHED) {
11099 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11101 DO_ASSERT(get_jenv_res == JNI_OK);
11103 LDKChannelUpdate msg_var = *msg;
11104 uintptr_t msg_ref = 0;
11105 msg_var = ChannelUpdate_clone(msg);
11106 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11107 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11108 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11109 msg_ref = (uintptr_t)msg_var.inner;
11110 if (msg_var.is_owned) {
11113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11114 CHECK(obj != NULL);
11115 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
11116 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11117 (*env)->ExceptionDescribe(env);
11118 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
11120 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11121 CHECK_ACCESS(ret_ptr);
11122 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11124 if (get_jenv_res == JNI_EDETACHED) {
11125 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11129 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
11130 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11132 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11133 if (get_jenv_res == JNI_EDETACHED) {
11134 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11136 DO_ASSERT(get_jenv_res == JNI_OK);
11138 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11139 CHECK(obj != NULL);
11140 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
11141 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11142 (*env)->ExceptionDescribe(env);
11143 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11145 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
11146 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11147 if (ret_constr.datalen > 0)
11148 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11150 ret_constr.data = NULL;
11151 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11152 for (size_t h = 0; h < ret_constr.datalen; h++) {
11153 int64_t ret_conv_59 = ret_vals[h];
11154 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
11155 CHECK_ACCESS(ret_conv_59_ptr);
11156 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
11157 FREE((void*)ret_conv_59);
11158 ret_constr.data[h] = ret_conv_59_conv;
11160 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11161 if (get_jenv_res == JNI_EDETACHED) {
11162 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11166 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
11167 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11169 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11170 if (get_jenv_res == JNI_EDETACHED) {
11171 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11173 DO_ASSERT(get_jenv_res == JNI_OK);
11175 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
11176 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
11177 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11178 CHECK(obj != NULL);
11179 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
11180 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11181 (*env)->ExceptionDescribe(env);
11182 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11184 LDKCVec_NodeAnnouncementZ ret_constr;
11185 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11186 if (ret_constr.datalen > 0)
11187 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11189 ret_constr.data = NULL;
11190 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11191 for (size_t s = 0; s < ret_constr.datalen; s++) {
11192 int64_t ret_conv_18 = ret_vals[s];
11193 LDKNodeAnnouncement ret_conv_18_conv;
11194 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
11195 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
11196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
11197 ret_constr.data[s] = ret_conv_18_conv;
11199 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11200 if (get_jenv_res == JNI_EDETACHED) {
11201 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11205 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
11206 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11208 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11209 if (get_jenv_res == JNI_EDETACHED) {
11210 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11212 DO_ASSERT(get_jenv_res == JNI_OK);
11214 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11215 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11216 LDKInit init_var = *init;
11217 uintptr_t init_ref = 0;
11218 init_var = Init_clone(init);
11219 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11220 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11221 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
11222 init_ref = (uintptr_t)init_var.inner;
11223 if (init_var.is_owned) {
11226 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11227 CHECK(obj != NULL);
11228 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
11229 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11230 (*env)->ExceptionDescribe(env);
11231 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
11233 if (get_jenv_res == JNI_EDETACHED) {
11234 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11237 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
11238 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11240 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11241 if (get_jenv_res == JNI_EDETACHED) {
11242 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11244 DO_ASSERT(get_jenv_res == JNI_OK);
11246 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11247 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11248 LDKReplyChannelRange msg_var = msg;
11249 uintptr_t msg_ref = 0;
11250 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11251 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11252 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11253 msg_ref = (uintptr_t)msg_var.inner;
11254 if (msg_var.is_owned) {
11257 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11258 CHECK(obj != NULL);
11259 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
11260 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11261 (*env)->ExceptionDescribe(env);
11262 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
11264 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11265 CHECK_ACCESS(ret_ptr);
11266 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11268 if (get_jenv_res == JNI_EDETACHED) {
11269 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11273 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
11274 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11276 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11277 if (get_jenv_res == JNI_EDETACHED) {
11278 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11280 DO_ASSERT(get_jenv_res == JNI_OK);
11282 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11283 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11284 LDKReplyShortChannelIdsEnd msg_var = msg;
11285 uintptr_t msg_ref = 0;
11286 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11287 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11288 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11289 msg_ref = (uintptr_t)msg_var.inner;
11290 if (msg_var.is_owned) {
11293 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11294 CHECK(obj != NULL);
11295 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
11296 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11297 (*env)->ExceptionDescribe(env);
11298 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
11300 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11301 CHECK_ACCESS(ret_ptr);
11302 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11304 if (get_jenv_res == JNI_EDETACHED) {
11305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11309 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
11310 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11312 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11313 if (get_jenv_res == JNI_EDETACHED) {
11314 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11316 DO_ASSERT(get_jenv_res == JNI_OK);
11318 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11319 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11320 LDKQueryChannelRange msg_var = msg;
11321 uintptr_t msg_ref = 0;
11322 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11323 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11324 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11325 msg_ref = (uintptr_t)msg_var.inner;
11326 if (msg_var.is_owned) {
11329 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11330 CHECK(obj != NULL);
11331 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
11332 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11333 (*env)->ExceptionDescribe(env);
11334 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
11336 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11337 CHECK_ACCESS(ret_ptr);
11338 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11340 if (get_jenv_res == JNI_EDETACHED) {
11341 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11345 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
11346 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11348 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11349 if (get_jenv_res == JNI_EDETACHED) {
11350 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11352 DO_ASSERT(get_jenv_res == JNI_OK);
11354 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11355 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11356 LDKQueryShortChannelIds msg_var = msg;
11357 uintptr_t msg_ref = 0;
11358 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11359 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11360 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11361 msg_ref = (uintptr_t)msg_var.inner;
11362 if (msg_var.is_owned) {
11365 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11366 CHECK(obj != NULL);
11367 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
11368 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11369 (*env)->ExceptionDescribe(env);
11370 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
11372 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11373 CHECK_ACCESS(ret_ptr);
11374 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11376 if (get_jenv_res == JNI_EDETACHED) {
11377 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11381 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
11382 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
11383 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11384 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11386 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11387 jclass c = (*env)->GetObjectClass(env, o);
11389 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
11390 atomic_init(&calls->refcnt, 1);
11391 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11392 calls->o = (*env)->NewWeakGlobalRef(env, o);
11393 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
11394 CHECK(calls->handle_node_announcement_meth != NULL);
11395 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
11396 CHECK(calls->handle_channel_announcement_meth != NULL);
11397 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
11398 CHECK(calls->handle_channel_update_meth != NULL);
11399 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
11400 CHECK(calls->get_next_channel_announcements_meth != NULL);
11401 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
11402 CHECK(calls->get_next_node_announcements_meth != NULL);
11403 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
11404 CHECK(calls->sync_routing_table_meth != NULL);
11405 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
11406 CHECK(calls->handle_reply_channel_range_meth != NULL);
11407 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
11408 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
11409 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
11410 CHECK(calls->handle_query_channel_range_meth != NULL);
11411 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
11412 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
11414 LDKRoutingMessageHandler ret = {
11415 .this_arg = (void*) calls,
11416 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
11417 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
11418 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
11419 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
11420 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
11421 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
11422 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
11423 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
11424 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
11425 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
11426 .free = LDKRoutingMessageHandler_JCalls_free,
11427 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11429 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11433 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
11434 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11435 return (uint64_t)res_ptr;
11437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11438 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
11439 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
11440 DO_ASSERT((res_ptr & 1) == 0);
11441 return (int64_t)(res_ptr | 1);
11443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11444 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11445 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11446 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11447 LDKNodeAnnouncement msg_conv;
11448 msg_conv.inner = (void*)(msg & (~1));
11449 msg_conv.is_owned = false;
11450 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11451 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11452 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
11453 return (uintptr_t)ret_conv;
11456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11457 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11458 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11459 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11460 LDKChannelAnnouncement msg_conv;
11461 msg_conv.inner = (void*)(msg & (~1));
11462 msg_conv.is_owned = false;
11463 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11464 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11465 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
11466 return (uintptr_t)ret_conv;
11469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11470 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11471 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11472 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11473 LDKChannelUpdate msg_conv;
11474 msg_conv.inner = (void*)(msg & (~1));
11475 msg_conv.is_owned = false;
11476 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11477 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11478 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
11479 return (uintptr_t)ret_conv;
11482 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) {
11483 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11484 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11485 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11486 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
11487 int64_tArray ret_arr = NULL;
11488 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11489 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11490 for (size_t h = 0; h < ret_var.datalen; h++) {
11491 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11492 *ret_conv_59_conv = ret_var.data[h];
11493 ret_arr_ptr[h] = ((uintptr_t)ret_conv_59_conv);
11495 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11496 FREE(ret_var.data);
11500 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) {
11501 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11502 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11503 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11504 LDKPublicKey starting_point_ref;
11505 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
11506 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
11507 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
11508 int64_tArray ret_arr = NULL;
11509 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11510 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11511 for (size_t s = 0; s < ret_var.datalen; s++) {
11512 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
11513 uintptr_t ret_conv_18_ref = 0;
11514 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11515 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11516 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
11517 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
11518 if (ret_conv_18_var.is_owned) {
11519 ret_conv_18_ref |= 1;
11521 ret_arr_ptr[s] = ret_conv_18_ref;
11523 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11524 FREE(ret_var.data);
11528 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) {
11529 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11530 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11531 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11532 LDKPublicKey their_node_id_ref;
11533 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11534 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11536 init_conv.inner = (void*)(init & (~1));
11537 init_conv.is_owned = false;
11538 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
11539 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
11542 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) {
11543 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11544 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11545 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11546 LDKPublicKey their_node_id_ref;
11547 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11548 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11549 LDKReplyChannelRange msg_conv;
11550 msg_conv.inner = (void*)(msg & (~1));
11551 msg_conv.is_owned = (msg & 1) || (msg == 0);
11552 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11553 msg_conv = ReplyChannelRange_clone(&msg_conv);
11554 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11555 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11556 return (uintptr_t)ret_conv;
11559 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) {
11560 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11561 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11562 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11563 LDKPublicKey their_node_id_ref;
11564 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11565 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11566 LDKReplyShortChannelIdsEnd msg_conv;
11567 msg_conv.inner = (void*)(msg & (~1));
11568 msg_conv.is_owned = (msg & 1) || (msg == 0);
11569 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11570 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
11571 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11572 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11573 return (uintptr_t)ret_conv;
11576 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) {
11577 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11578 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11579 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11580 LDKPublicKey their_node_id_ref;
11581 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11582 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11583 LDKQueryChannelRange msg_conv;
11584 msg_conv.inner = (void*)(msg & (~1));
11585 msg_conv.is_owned = (msg & 1) || (msg == 0);
11586 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11587 msg_conv = QueryChannelRange_clone(&msg_conv);
11588 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11589 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11590 return (uintptr_t)ret_conv;
11593 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) {
11594 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11595 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11596 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11597 LDKPublicKey their_node_id_ref;
11598 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11599 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11600 LDKQueryShortChannelIds msg_conv;
11601 msg_conv.inner = (void*)(msg & (~1));
11602 msg_conv.is_owned = (msg & 1) || (msg == 0);
11603 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11604 msg_conv = QueryShortChannelIds_clone(&msg_conv);
11605 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11606 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
11607 return (uintptr_t)ret_conv;
11610 typedef struct LDKCustomMessageReader_JCalls {
11611 atomic_size_t refcnt;
11614 jmethodID read_meth;
11615 } LDKCustomMessageReader_JCalls;
11616 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
11617 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11618 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11620 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11621 if (get_jenv_res == JNI_EDETACHED) {
11622 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11624 DO_ASSERT(get_jenv_res == JNI_OK);
11626 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11627 if (get_jenv_res == JNI_EDETACHED) {
11628 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11633 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
11634 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
11636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11637 if (get_jenv_res == JNI_EDETACHED) {
11638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11640 DO_ASSERT(get_jenv_res == JNI_OK);
11642 LDKu8slice buffer_var = buffer;
11643 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
11644 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
11645 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11646 CHECK(obj != NULL);
11647 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
11648 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11649 (*env)->ExceptionDescribe(env);
11650 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
11652 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11653 CHECK_ACCESS(ret_ptr);
11654 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
11656 if (get_jenv_res == JNI_EDETACHED) {
11657 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11661 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
11662 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
11663 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11665 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
11666 jclass c = (*env)->GetObjectClass(env, o);
11668 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
11669 atomic_init(&calls->refcnt, 1);
11670 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11671 calls->o = (*env)->NewWeakGlobalRef(env, o);
11672 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
11673 CHECK(calls->read_meth != NULL);
11675 LDKCustomMessageReader ret = {
11676 .this_arg = (void*) calls,
11677 .read = read_LDKCustomMessageReader_jcall,
11678 .free = LDKCustomMessageReader_JCalls_free,
11682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
11683 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
11684 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
11685 return (uint64_t)res_ptr;
11687 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) {
11688 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11689 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11690 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
11691 LDKu8slice buffer_ref;
11692 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
11693 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
11694 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
11695 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
11696 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
11697 return (uintptr_t)ret_conv;
11700 typedef struct LDKCustomMessageHandler_JCalls {
11701 atomic_size_t refcnt;
11704 LDKCustomMessageReader_JCalls* CustomMessageReader;
11705 jmethodID handle_custom_message_meth;
11706 jmethodID get_and_clear_pending_msg_meth;
11707 } LDKCustomMessageHandler_JCalls;
11708 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
11709 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11710 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11712 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11713 if (get_jenv_res == JNI_EDETACHED) {
11714 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11716 DO_ASSERT(get_jenv_res == JNI_OK);
11718 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11719 if (get_jenv_res == JNI_EDETACHED) {
11720 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11725 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
11726 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11728 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11729 if (get_jenv_res == JNI_EDETACHED) {
11730 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11732 DO_ASSERT(get_jenv_res == JNI_OK);
11734 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
11736 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
11737 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
11738 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11739 CHECK(obj != NULL);
11740 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uintptr_t)msg_ret, sender_node_id_arr);
11741 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11742 (*env)->ExceptionDescribe(env);
11743 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
11745 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11746 CHECK_ACCESS(ret_ptr);
11747 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11749 if (get_jenv_res == JNI_EDETACHED) {
11750 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11754 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
11755 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
11757 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11758 if (get_jenv_res == JNI_EDETACHED) {
11759 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11761 DO_ASSERT(get_jenv_res == JNI_OK);
11763 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11764 CHECK(obj != NULL);
11765 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
11766 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11767 (*env)->ExceptionDescribe(env);
11768 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
11770 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
11771 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11772 if (ret_constr.datalen > 0)
11773 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
11775 ret_constr.data = NULL;
11776 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11777 for (size_t z = 0; z < ret_constr.datalen; z++) {
11778 int64_t ret_conv_25 = ret_vals[z];
11779 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
11780 CHECK_ACCESS(ret_conv_25_ptr);
11781 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
11782 FREE((void*)ret_conv_25);
11783 ret_constr.data[z] = ret_conv_25_conv;
11785 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11786 if (get_jenv_res == JNI_EDETACHED) {
11787 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11791 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
11792 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
11793 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11794 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
11796 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
11797 jclass c = (*env)->GetObjectClass(env, o);
11799 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
11800 atomic_init(&calls->refcnt, 1);
11801 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11802 calls->o = (*env)->NewWeakGlobalRef(env, o);
11803 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
11804 CHECK(calls->handle_custom_message_meth != NULL);
11805 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
11806 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
11808 LDKCustomMessageHandler ret = {
11809 .this_arg = (void*) calls,
11810 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
11811 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
11812 .free = LDKCustomMessageHandler_JCalls_free,
11813 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
11815 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
11818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
11819 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
11820 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
11821 return (uint64_t)res_ptr;
11823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
11824 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
11825 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
11826 DO_ASSERT((res_ptr & 1) == 0);
11827 return (int64_t)(res_ptr | 1);
11829 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) {
11830 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11831 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11832 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11833 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
11834 CHECK_ACCESS(msg_ptr);
11835 LDKType msg_conv = *(LDKType*)(msg_ptr);
11836 if (msg_conv.free == LDKType_JCalls_free) {
11837 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11838 LDKType_JCalls_cloned(&msg_conv);
11840 LDKPublicKey sender_node_id_ref;
11841 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
11842 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
11843 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11844 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
11845 return (uintptr_t)ret_conv;
11848 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
11849 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11850 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11851 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
11852 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
11853 int64_tArray ret_arr = NULL;
11854 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11855 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11856 for (size_t z = 0; z < ret_var.datalen; z++) {
11857 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
11858 *ret_conv_25_conv = ret_var.data[z];
11859 ret_arr_ptr[z] = ((uintptr_t)ret_conv_25_conv);
11861 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11862 FREE(ret_var.data);
11866 typedef struct LDKSocketDescriptor_JCalls {
11867 atomic_size_t refcnt;
11870 jmethodID send_data_meth;
11871 jmethodID disconnect_socket_meth;
11873 jmethodID hash_meth;
11874 } LDKSocketDescriptor_JCalls;
11875 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
11876 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11877 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11879 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11880 if (get_jenv_res == JNI_EDETACHED) {
11881 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11883 DO_ASSERT(get_jenv_res == JNI_OK);
11885 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11886 if (get_jenv_res == JNI_EDETACHED) {
11887 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11892 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
11893 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11895 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11896 if (get_jenv_res == JNI_EDETACHED) {
11897 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11899 DO_ASSERT(get_jenv_res == JNI_OK);
11901 LDKu8slice data_var = data;
11902 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
11903 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
11904 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11905 CHECK(obj != NULL);
11906 intptr_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
11907 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11908 (*env)->ExceptionDescribe(env);
11909 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
11911 if (get_jenv_res == JNI_EDETACHED) {
11912 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11916 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
11917 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11919 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11920 if (get_jenv_res == JNI_EDETACHED) {
11921 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11923 DO_ASSERT(get_jenv_res == JNI_OK);
11925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11926 CHECK(obj != NULL);
11927 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
11928 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11929 (*env)->ExceptionDescribe(env);
11930 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
11932 if (get_jenv_res == JNI_EDETACHED) {
11933 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11936 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
11937 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11939 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11940 if (get_jenv_res == JNI_EDETACHED) {
11941 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11943 DO_ASSERT(get_jenv_res == JNI_OK);
11945 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
11946 *other_arg_clone = SocketDescriptor_clone(other_arg);
11947 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11948 CHECK(obj != NULL);
11949 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uintptr_t)other_arg_clone);
11950 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11951 (*env)->ExceptionDescribe(env);
11952 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
11954 if (get_jenv_res == JNI_EDETACHED) {
11955 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11959 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
11960 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
11962 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11963 if (get_jenv_res == JNI_EDETACHED) {
11964 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11966 DO_ASSERT(get_jenv_res == JNI_OK);
11968 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11969 CHECK(obj != NULL);
11970 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
11971 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11972 (*env)->ExceptionDescribe(env);
11973 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
11975 if (get_jenv_res == JNI_EDETACHED) {
11976 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11980 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
11981 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
11982 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11984 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
11985 jclass c = (*env)->GetObjectClass(env, o);
11987 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
11988 atomic_init(&calls->refcnt, 1);
11989 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11990 calls->o = (*env)->NewWeakGlobalRef(env, o);
11991 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
11992 CHECK(calls->send_data_meth != NULL);
11993 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
11994 CHECK(calls->disconnect_socket_meth != NULL);
11995 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
11996 CHECK(calls->eq_meth != NULL);
11997 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
11998 CHECK(calls->hash_meth != NULL);
12000 LDKSocketDescriptor ret = {
12001 .this_arg = (void*) calls,
12002 .send_data = send_data_LDKSocketDescriptor_jcall,
12003 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12004 .eq = eq_LDKSocketDescriptor_jcall,
12005 .hash = hash_LDKSocketDescriptor_jcall,
12006 .cloned = LDKSocketDescriptor_JCalls_cloned,
12007 .free = LDKSocketDescriptor_JCalls_free,
12011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12012 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12013 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12014 return (uint64_t)res_ptr;
12016 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
12017 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12018 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12019 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12020 LDKu8slice data_ref;
12021 data_ref.datalen = (*env)->GetArrayLength(env, data);
12022 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12023 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12024 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12029 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12030 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12031 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12032 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12036 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12037 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12038 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12039 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
12043 typedef struct LDKScore_JCalls {
12044 atomic_size_t refcnt;
12047 jmethodID channel_penalty_msat_meth;
12048 jmethodID payment_path_failed_meth;
12049 jmethodID payment_path_successful_meth;
12050 jmethodID write_meth;
12052 static void LDKScore_JCalls_free(void* this_arg) {
12053 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12054 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12056 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12057 if (get_jenv_res == JNI_EDETACHED) {
12058 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12060 DO_ASSERT(get_jenv_res == JNI_OK);
12062 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12063 if (get_jenv_res == JNI_EDETACHED) {
12064 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12069 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) {
12070 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12072 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12073 if (get_jenv_res == JNI_EDETACHED) {
12074 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12076 DO_ASSERT(get_jenv_res == JNI_OK);
12078 LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12079 *channel_capacity_msat_copy = channel_capacity_msat;
12080 uintptr_t channel_capacity_msat_ref = (uintptr_t)channel_capacity_msat_copy;
12081 LDKNodeId source_var = *source;
12082 uintptr_t source_ref = 0;
12083 source_var = NodeId_clone(source);
12084 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12085 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12086 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
12087 source_ref = (uintptr_t)source_var.inner;
12088 if (source_var.is_owned) {
12091 LDKNodeId target_var = *target;
12092 uintptr_t target_ref = 0;
12093 target_var = NodeId_clone(target);
12094 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12095 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12096 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
12097 target_ref = (uintptr_t)target_var.inner;
12098 if (target_var.is_owned) {
12101 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12102 CHECK(obj != NULL);
12103 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref);
12104 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12105 (*env)->ExceptionDescribe(env);
12106 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
12108 if (get_jenv_res == JNI_EDETACHED) {
12109 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12113 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
12114 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12116 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12117 if (get_jenv_res == JNI_EDETACHED) {
12118 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12120 DO_ASSERT(get_jenv_res == JNI_OK);
12122 LDKCVec_RouteHopZ path_var = path;
12123 int64_tArray path_arr = NULL;
12124 path_arr = (*env)->NewLongArray(env, path_var.datalen);
12125 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
12126 for (size_t k = 0; k < path_var.datalen; k++) {
12127 LDKRouteHop path_conv_10_var = path_var.data[k];
12128 uintptr_t path_conv_10_ref = 0;
12129 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12130 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12131 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
12132 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
12133 if (path_conv_10_var.is_owned) {
12134 path_conv_10_ref |= 1;
12136 path_arr_ptr[k] = path_conv_10_ref;
12138 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
12139 FREE(path_var.data);
12140 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12141 CHECK(obj != NULL);
12142 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id);
12143 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12144 (*env)->ExceptionDescribe(env);
12145 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
12147 if (get_jenv_res == JNI_EDETACHED) {
12148 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12151 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
12152 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12154 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12155 if (get_jenv_res == JNI_EDETACHED) {
12156 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12158 DO_ASSERT(get_jenv_res == JNI_OK);
12160 LDKCVec_RouteHopZ path_var = path;
12161 int64_tArray path_arr = NULL;
12162 path_arr = (*env)->NewLongArray(env, path_var.datalen);
12163 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
12164 for (size_t k = 0; k < path_var.datalen; k++) {
12165 LDKRouteHop path_conv_10_var = path_var.data[k];
12166 uintptr_t path_conv_10_ref = 0;
12167 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12168 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12169 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
12170 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
12171 if (path_conv_10_var.is_owned) {
12172 path_conv_10_ref |= 1;
12174 path_arr_ptr[k] = path_conv_10_ref;
12176 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
12177 FREE(path_var.data);
12178 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12179 CHECK(obj != NULL);
12180 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
12181 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12182 (*env)->ExceptionDescribe(env);
12183 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
12185 if (get_jenv_res == JNI_EDETACHED) {
12186 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12189 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
12190 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12192 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12193 if (get_jenv_res == JNI_EDETACHED) {
12194 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12196 DO_ASSERT(get_jenv_res == JNI_OK);
12198 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12199 CHECK(obj != NULL);
12200 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
12201 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12202 (*env)->ExceptionDescribe(env);
12203 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
12205 LDKCVec_u8Z ret_ref;
12206 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
12207 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
12208 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
12209 if (get_jenv_res == JNI_EDETACHED) {
12210 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12214 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
12215 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
12216 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12218 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
12219 jclass c = (*env)->GetObjectClass(env, o);
12221 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
12222 atomic_init(&calls->refcnt, 1);
12223 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12224 calls->o = (*env)->NewWeakGlobalRef(env, o);
12225 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
12226 CHECK(calls->channel_penalty_msat_meth != NULL);
12227 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
12228 CHECK(calls->payment_path_failed_meth != NULL);
12229 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
12230 CHECK(calls->payment_path_successful_meth != NULL);
12231 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
12232 CHECK(calls->write_meth != NULL);
12235 .this_arg = (void*) calls,
12236 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
12237 .payment_path_failed = payment_path_failed_LDKScore_jcall,
12238 .payment_path_successful = payment_path_successful_LDKScore_jcall,
12239 .write = write_LDKScore_jcall,
12240 .free = LDKScore_JCalls_free,
12244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
12245 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
12246 *res_ptr = LDKScore_init(env, clz, o);
12247 return (uint64_t)res_ptr;
12249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t channel_capacity_msat, int64_t source, int64_t target) {
12250 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12251 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12252 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12253 void* channel_capacity_msat_ptr = (void*)(((uintptr_t)channel_capacity_msat) & ~1);
12254 CHECK_ACCESS(channel_capacity_msat_ptr);
12255 LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr);
12256 channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)channel_capacity_msat) & ~1));
12257 LDKNodeId source_conv;
12258 source_conv.inner = (void*)(source & (~1));
12259 source_conv.is_owned = false;
12260 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
12261 LDKNodeId target_conv;
12262 target_conv.inner = (void*)(target & (~1));
12263 target_conv.is_owned = false;
12264 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
12265 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv);
12269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path, int64_t short_channel_id) {
12270 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12271 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12272 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12273 LDKCVec_RouteHopZ path_constr;
12274 path_constr.datalen = (*env)->GetArrayLength(env, path);
12275 if (path_constr.datalen > 0)
12276 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12278 path_constr.data = NULL;
12279 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
12280 for (size_t k = 0; k < path_constr.datalen; k++) {
12281 int64_t path_conv_10 = path_vals[k];
12282 LDKRouteHop path_conv_10_conv;
12283 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12284 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12285 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
12286 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12287 path_constr.data[k] = path_conv_10_conv;
12289 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
12290 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
12293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
12294 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12295 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12296 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12297 LDKCVec_RouteHopZ path_constr;
12298 path_constr.datalen = (*env)->GetArrayLength(env, path);
12299 if (path_constr.datalen > 0)
12300 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12302 path_constr.data = NULL;
12303 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
12304 for (size_t k = 0; k < path_constr.datalen; k++) {
12305 int64_t path_conv_10 = path_vals[k];
12306 LDKRouteHop path_conv_10_conv;
12307 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12308 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12309 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
12310 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12311 path_constr.data[k] = path_conv_10_conv;
12313 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
12314 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
12317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
12318 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12319 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12320 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12321 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
12322 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12323 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12324 CVec_u8Z_free(ret_var);
12328 typedef struct LDKLockableScore_JCalls {
12329 atomic_size_t refcnt;
12332 jmethodID lock_meth;
12333 } LDKLockableScore_JCalls;
12334 static void LDKLockableScore_JCalls_free(void* this_arg) {
12335 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12336 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12338 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12339 if (get_jenv_res == JNI_EDETACHED) {
12340 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12342 DO_ASSERT(get_jenv_res == JNI_OK);
12344 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12345 if (get_jenv_res == JNI_EDETACHED) {
12346 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12351 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
12352 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12354 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12355 if (get_jenv_res == JNI_EDETACHED) {
12356 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12358 DO_ASSERT(get_jenv_res == JNI_OK);
12360 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12361 CHECK(obj != NULL);
12362 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
12363 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12364 (*env)->ExceptionDescribe(env);
12365 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
12367 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12368 CHECK_ACCESS(ret_ptr);
12369 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
12370 if (ret_conv.free == LDKScore_JCalls_free) {
12371 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12372 LDKScore_JCalls_cloned(&ret_conv);
12373 }// Warning: we may need a move here but no clone is available for LDKScore
12375 if (get_jenv_res == JNI_EDETACHED) {
12376 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12380 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
12381 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
12382 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12384 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
12385 jclass c = (*env)->GetObjectClass(env, o);
12387 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
12388 atomic_init(&calls->refcnt, 1);
12389 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12390 calls->o = (*env)->NewWeakGlobalRef(env, o);
12391 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
12392 CHECK(calls->lock_meth != NULL);
12394 LDKLockableScore ret = {
12395 .this_arg = (void*) calls,
12396 .lock = lock_LDKLockableScore_jcall,
12397 .free = LDKLockableScore_JCalls_free,
12401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
12402 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
12403 *res_ptr = LDKLockableScore_init(env, clz, o);
12404 return (uint64_t)res_ptr;
12406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
12407 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12408 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12409 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
12410 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
12411 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
12412 return (uintptr_t)ret_ret;
12415 typedef struct LDKChannelManagerPersister_JCalls {
12416 atomic_size_t refcnt;
12419 jmethodID persist_manager_meth;
12420 } LDKChannelManagerPersister_JCalls;
12421 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
12422 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
12423 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12425 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12426 if (get_jenv_res == JNI_EDETACHED) {
12427 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12429 DO_ASSERT(get_jenv_res == JNI_OK);
12431 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12432 if (get_jenv_res == JNI_EDETACHED) {
12433 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12438 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
12439 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
12441 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12442 if (get_jenv_res == JNI_EDETACHED) {
12443 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12445 DO_ASSERT(get_jenv_res == JNI_OK);
12447 LDKChannelManager channel_manager_var = *channel_manager;
12448 uintptr_t channel_manager_ref = 0;
12449 // Warning: we may need a move here but no clone is available for LDKChannelManager
12450 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12451 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12452 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
12453 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
12454 if (channel_manager_var.is_owned) {
12455 channel_manager_ref |= 1;
12457 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12458 CHECK(obj != NULL);
12459 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
12460 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12461 (*env)->ExceptionDescribe(env);
12462 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
12464 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12465 CHECK_ACCESS(ret_ptr);
12466 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
12468 if (get_jenv_res == JNI_EDETACHED) {
12469 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12473 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
12474 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
12475 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12477 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
12478 jclass c = (*env)->GetObjectClass(env, o);
12480 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
12481 atomic_init(&calls->refcnt, 1);
12482 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12483 calls->o = (*env)->NewWeakGlobalRef(env, o);
12484 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
12485 CHECK(calls->persist_manager_meth != NULL);
12487 LDKChannelManagerPersister ret = {
12488 .this_arg = (void*) calls,
12489 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
12490 .free = LDKChannelManagerPersister_JCalls_free,
12494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
12495 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
12496 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
12497 return (uint64_t)res_ptr;
12499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
12500 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12501 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12502 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
12503 LDKChannelManager channel_manager_conv;
12504 channel_manager_conv.inner = (void*)(channel_manager & (~1));
12505 channel_manager_conv.is_owned = false;
12506 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
12507 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
12508 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
12509 return (uintptr_t)ret_conv;
12512 static jclass LDKFallback_SegWitProgram_class = NULL;
12513 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
12514 static jclass LDKFallback_PubKeyHash_class = NULL;
12515 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
12516 static jclass LDKFallback_ScriptHash_class = NULL;
12517 static jmethodID LDKFallback_ScriptHash_meth = NULL;
12518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
12519 LDKFallback_SegWitProgram_class =
12520 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
12521 CHECK(LDKFallback_SegWitProgram_class != NULL);
12522 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
12523 CHECK(LDKFallback_SegWitProgram_meth != NULL);
12524 LDKFallback_PubKeyHash_class =
12525 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
12526 CHECK(LDKFallback_PubKeyHash_class != NULL);
12527 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
12528 CHECK(LDKFallback_PubKeyHash_meth != NULL);
12529 LDKFallback_ScriptHash_class =
12530 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
12531 CHECK(LDKFallback_ScriptHash_class != NULL);
12532 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
12533 CHECK(LDKFallback_ScriptHash_meth != NULL);
12535 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12536 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
12538 case LDKFallback_SegWitProgram: {
12539 uint8_t version_val = obj->seg_wit_program.version._0;
12540 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
12541 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
12542 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
12543 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
12545 case LDKFallback_PubKeyHash: {
12546 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
12547 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
12548 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
12550 case LDKFallback_ScriptHash: {
12551 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
12552 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
12553 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
12558 typedef struct LDKPayer_JCalls {
12559 atomic_size_t refcnt;
12562 jmethodID node_id_meth;
12563 jmethodID first_hops_meth;
12564 jmethodID send_payment_meth;
12565 jmethodID send_spontaneous_payment_meth;
12566 jmethodID retry_payment_meth;
12567 jmethodID abandon_payment_meth;
12569 static void LDKPayer_JCalls_free(void* this_arg) {
12570 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
12571 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12574 if (get_jenv_res == JNI_EDETACHED) {
12575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12577 DO_ASSERT(get_jenv_res == JNI_OK);
12579 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12580 if (get_jenv_res == JNI_EDETACHED) {
12581 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12586 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
12587 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
12589 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12590 if (get_jenv_res == JNI_EDETACHED) {
12591 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12593 DO_ASSERT(get_jenv_res == JNI_OK);
12595 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12596 CHECK(obj != NULL);
12597 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
12598 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12599 (*env)->ExceptionDescribe(env);
12600 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
12602 LDKPublicKey ret_ref;
12603 CHECK((*env)->GetArrayLength(env, ret) == 33);
12604 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
12605 if (get_jenv_res == JNI_EDETACHED) {
12606 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12610 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
12611 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
12613 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12614 if (get_jenv_res == JNI_EDETACHED) {
12615 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12617 DO_ASSERT(get_jenv_res == JNI_OK);
12619 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12620 CHECK(obj != NULL);
12621 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
12622 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12623 (*env)->ExceptionDescribe(env);
12624 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
12626 LDKCVec_ChannelDetailsZ ret_constr;
12627 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12628 if (ret_constr.datalen > 0)
12629 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12631 ret_constr.data = NULL;
12632 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12633 for (size_t q = 0; q < ret_constr.datalen; q++) {
12634 int64_t ret_conv_16 = ret_vals[q];
12635 LDKChannelDetails ret_conv_16_conv;
12636 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
12637 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
12638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
12639 ret_constr.data[q] = ret_conv_16_conv;
12641 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12642 if (get_jenv_res == JNI_EDETACHED) {
12643 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12647 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
12648 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
12650 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12651 if (get_jenv_res == JNI_EDETACHED) {
12652 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12654 DO_ASSERT(get_jenv_res == JNI_OK);
12656 LDKRoute route_var = *route;
12657 uintptr_t route_ref = 0;
12658 route_var = Route_clone(route);
12659 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12660 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12661 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
12662 route_ref = (uintptr_t)route_var.inner;
12663 if (route_var.is_owned) {
12666 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12667 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
12668 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
12669 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
12670 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12671 CHECK(obj != NULL);
12672 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
12673 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12674 (*env)->ExceptionDescribe(env);
12675 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
12677 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12678 CHECK_ACCESS(ret_ptr);
12679 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
12681 if (get_jenv_res == JNI_EDETACHED) {
12682 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12686 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
12687 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
12689 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12690 if (get_jenv_res == JNI_EDETACHED) {
12691 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12693 DO_ASSERT(get_jenv_res == JNI_OK);
12695 LDKRoute route_var = *route;
12696 uintptr_t route_ref = 0;
12697 route_var = Route_clone(route);
12698 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12699 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12700 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
12701 route_ref = (uintptr_t)route_var.inner;
12702 if (route_var.is_owned) {
12705 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
12706 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
12707 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12708 CHECK(obj != NULL);
12709 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
12710 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12711 (*env)->ExceptionDescribe(env);
12712 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
12714 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12715 CHECK_ACCESS(ret_ptr);
12716 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
12718 if (get_jenv_res == JNI_EDETACHED) {
12719 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12723 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
12724 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
12726 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12727 if (get_jenv_res == JNI_EDETACHED) {
12728 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12730 DO_ASSERT(get_jenv_res == JNI_OK);
12732 LDKRoute route_var = *route;
12733 uintptr_t route_ref = 0;
12734 route_var = Route_clone(route);
12735 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12736 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12737 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
12738 route_ref = (uintptr_t)route_var.inner;
12739 if (route_var.is_owned) {
12742 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12743 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
12744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12745 CHECK(obj != NULL);
12746 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
12747 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12748 (*env)->ExceptionDescribe(env);
12749 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
12751 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12752 CHECK_ACCESS(ret_ptr);
12753 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
12755 if (get_jenv_res == JNI_EDETACHED) {
12756 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12760 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
12761 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
12763 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12764 if (get_jenv_res == JNI_EDETACHED) {
12765 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12767 DO_ASSERT(get_jenv_res == JNI_OK);
12769 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
12770 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
12771 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12772 CHECK(obj != NULL);
12773 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
12774 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12775 (*env)->ExceptionDescribe(env);
12776 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
12778 if (get_jenv_res == JNI_EDETACHED) {
12779 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12782 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
12783 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
12784 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12786 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
12787 jclass c = (*env)->GetObjectClass(env, o);
12789 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
12790 atomic_init(&calls->refcnt, 1);
12791 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12792 calls->o = (*env)->NewWeakGlobalRef(env, o);
12793 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
12794 CHECK(calls->node_id_meth != NULL);
12795 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
12796 CHECK(calls->first_hops_meth != NULL);
12797 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
12798 CHECK(calls->send_payment_meth != NULL);
12799 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
12800 CHECK(calls->send_spontaneous_payment_meth != NULL);
12801 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
12802 CHECK(calls->retry_payment_meth != NULL);
12803 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
12804 CHECK(calls->abandon_payment_meth != NULL);
12807 .this_arg = (void*) calls,
12808 .node_id = node_id_LDKPayer_jcall,
12809 .first_hops = first_hops_LDKPayer_jcall,
12810 .send_payment = send_payment_LDKPayer_jcall,
12811 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
12812 .retry_payment = retry_payment_LDKPayer_jcall,
12813 .abandon_payment = abandon_payment_LDKPayer_jcall,
12814 .free = LDKPayer_JCalls_free,
12818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
12819 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
12820 *res_ptr = LDKPayer_init(env, clz, o);
12821 return (uint64_t)res_ptr;
12823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
12824 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12825 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12826 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
12827 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
12828 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
12832 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
12833 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12834 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12835 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
12836 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
12837 int64_tArray ret_arr = NULL;
12838 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12839 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12840 for (size_t q = 0; q < ret_var.datalen; q++) {
12841 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
12842 uintptr_t ret_conv_16_ref = 0;
12843 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12844 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
12846 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
12847 if (ret_conv_16_var.is_owned) {
12848 ret_conv_16_ref |= 1;
12850 ret_arr_ptr[q] = ret_conv_16_ref;
12852 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12853 FREE(ret_var.data);
12857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
12858 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12859 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12860 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
12861 LDKRoute route_conv;
12862 route_conv.inner = (void*)(route & (~1));
12863 route_conv.is_owned = false;
12864 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
12865 LDKThirtyTwoBytes payment_hash_ref;
12866 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
12867 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
12868 LDKThirtyTwoBytes payment_secret_ref;
12869 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
12870 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
12871 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12872 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
12873 return (uintptr_t)ret_conv;
12876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
12877 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12878 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12879 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
12880 LDKRoute route_conv;
12881 route_conv.inner = (void*)(route & (~1));
12882 route_conv.is_owned = false;
12883 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
12884 LDKThirtyTwoBytes payment_preimage_ref;
12885 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
12886 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
12887 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
12888 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
12889 return (uintptr_t)ret_conv;
12892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
12893 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12894 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12895 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
12896 LDKRoute route_conv;
12897 route_conv.inner = (void*)(route & (~1));
12898 route_conv.is_owned = false;
12899 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
12900 LDKThirtyTwoBytes payment_id_ref;
12901 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
12902 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
12903 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
12904 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
12905 return (uintptr_t)ret_conv;
12908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
12909 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12910 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12911 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
12912 LDKThirtyTwoBytes payment_id_ref;
12913 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
12914 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
12915 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
12918 typedef struct LDKRouter_JCalls {
12919 atomic_size_t refcnt;
12922 jmethodID find_route_meth;
12923 } LDKRouter_JCalls;
12924 static void LDKRouter_JCalls_free(void* this_arg) {
12925 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
12926 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12928 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12929 if (get_jenv_res == JNI_EDETACHED) {
12930 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12932 DO_ASSERT(get_jenv_res == JNI_OK);
12934 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12935 if (get_jenv_res == JNI_EDETACHED) {
12936 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12941 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
12942 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
12944 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12945 if (get_jenv_res == JNI_EDETACHED) {
12946 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12948 DO_ASSERT(get_jenv_res == JNI_OK);
12950 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
12951 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
12952 LDKRouteParameters params_var = *params;
12953 uintptr_t params_ref = 0;
12954 params_var = RouteParameters_clone(params);
12955 CHECK((((uintptr_t)params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12956 CHECK((((uintptr_t)¶ms_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12957 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_var);
12958 params_ref = (uintptr_t)params_var.inner;
12959 if (params_var.is_owned) {
12962 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
12963 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
12964 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
12965 int64_tArray first_hops_arr = NULL;
12966 if (first_hops != NULL) {
12967 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
12968 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
12969 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
12970 for (size_t q = 0; q < first_hops_var.datalen; q++) {
12971 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
12972 uintptr_t first_hops_conv_16_ref = 0;
12973 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12974 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12975 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
12976 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
12977 if (first_hops_conv_16_var.is_owned) {
12978 first_hops_conv_16_ref |= 1;
12980 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
12982 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
12984 // WARNING: This object doesn't live past this scope, needs clone!
12985 uintptr_t ret_scorer = ((uintptr_t)scorer) | 1;
12986 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12987 CHECK(obj != NULL);
12988 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, payment_hash_arr, first_hops_arr, ret_scorer);
12989 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12990 (*env)->ExceptionDescribe(env);
12991 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
12993 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12994 CHECK_ACCESS(ret_ptr);
12995 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
12997 if (get_jenv_res == JNI_EDETACHED) {
12998 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13002 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
13003 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
13004 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13006 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
13007 jclass c = (*env)->GetObjectClass(env, o);
13009 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
13010 atomic_init(&calls->refcnt, 1);
13011 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13012 calls->o = (*env)->NewWeakGlobalRef(env, o);
13013 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
13014 CHECK(calls->find_route_meth != NULL);
13017 .this_arg = (void*) calls,
13018 .find_route = find_route_LDKRouter_jcall,
13019 .free = LDKRouter_JCalls_free,
13023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
13024 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
13025 *res_ptr = LDKRouter_init(env, clz, o);
13026 return (uint64_t)res_ptr;
13028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) {
13029 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13030 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13031 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
13032 LDKPublicKey payer_ref;
13033 CHECK((*env)->GetArrayLength(env, payer) == 33);
13034 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
13035 LDKRouteParameters params_conv;
13036 params_conv.inner = (void*)(params & (~1));
13037 params_conv.is_owned = false;
13038 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
13039 unsigned char payment_hash_arr[32];
13040 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13041 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
13042 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
13043 LDKCVec_ChannelDetailsZ first_hops_constr;
13044 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
13045 if (first_hops != NULL) {
13046 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
13047 if (first_hops_constr.datalen > 0)
13048 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13050 first_hops_constr.data = NULL;
13051 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
13052 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13053 int64_t first_hops_conv_16 = first_hops_vals[q];
13054 LDKChannelDetails first_hops_conv_16_conv;
13055 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
13056 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
13057 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
13058 first_hops_constr.data[q] = first_hops_conv_16_conv;
13060 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
13061 first_hops_ptr = &first_hops_constr;
13063 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
13064 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
13065 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
13066 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13067 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
13068 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
13069 return (uintptr_t)ret_conv;
13072 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13073 LDKStr ret_str = _ldk_get_compiled_version();
13074 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13079 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13080 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
13081 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
13087 LDKTransaction _res_ref;
13088 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
13089 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
13090 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
13091 _res_ref.data_is_owned = true;
13092 Transaction_free(_res_ref);
13095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
13096 LDKCVec_u8Z script_pubkey_ref;
13097 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13098 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
13099 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
13100 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13101 *ret_ref = TxOut_new(script_pubkey_ref, value);
13102 return (uintptr_t)ret_ref;
13105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
13106 if ((_res & 1) != 0) return;
13107 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13108 CHECK_ACCESS(_res_ptr);
13109 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
13111 TxOut_free(_res_conv);
13114 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
13115 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13116 *ret_ref = TxOut_clone(arg);
13117 return (uintptr_t)ret_ref;
13119 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13120 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
13121 intptr_t ret_val = TxOut_clone_ptr(arg_conv);
13125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13126 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
13127 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13128 *ret_ref = TxOut_clone(orig_conv);
13129 return (uintptr_t)ret_ref;
13132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
13133 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
13137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13138 LDKSecretKey o_ref;
13139 CHECK((*env)->GetArrayLength(env, o) == 32);
13140 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
13141 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13142 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
13143 return (uintptr_t)ret_conv;
13146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13147 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13148 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13149 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
13150 return (uintptr_t)ret_conv;
13153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13154 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
13155 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
13159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13160 if ((_res & 1) != 0) return;
13161 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13162 CHECK_ACCESS(_res_ptr);
13163 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
13165 CResult_SecretKeyErrorZ_free(_res_conv);
13168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13169 LDKPublicKey o_ref;
13170 CHECK((*env)->GetArrayLength(env, o) == 33);
13171 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
13172 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13173 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
13174 return (uintptr_t)ret_conv;
13177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13178 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13179 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13180 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
13181 return (uintptr_t)ret_conv;
13184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13185 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
13186 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
13190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13191 if ((_res & 1) != 0) return;
13192 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13193 CHECK_ACCESS(_res_ptr);
13194 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
13196 CResult_PublicKeyErrorZ_free(_res_conv);
13199 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
13200 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13201 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
13202 return (uintptr_t)ret_conv;
13204 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13205 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
13206 intptr_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
13210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13211 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
13212 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13213 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
13214 return (uintptr_t)ret_conv;
13217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13218 LDKTxCreationKeys o_conv;
13219 o_conv.inner = (void*)(o & (~1));
13220 o_conv.is_owned = (o & 1) || (o == 0);
13221 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13222 o_conv = TxCreationKeys_clone(&o_conv);
13223 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13224 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
13225 return (uintptr_t)ret_conv;
13228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13229 LDKDecodeError e_conv;
13230 e_conv.inner = (void*)(e & (~1));
13231 e_conv.is_owned = (e & 1) || (e == 0);
13232 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13233 e_conv = DecodeError_clone(&e_conv);
13234 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13235 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
13236 return (uintptr_t)ret_conv;
13239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13240 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
13241 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
13245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13246 if ((_res & 1) != 0) return;
13247 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13248 CHECK_ACCESS(_res_ptr);
13249 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
13251 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
13254 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
13255 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13256 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
13257 return (uintptr_t)ret_conv;
13259 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13260 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
13261 intptr_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
13265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13266 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
13267 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13268 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
13269 return (uintptr_t)ret_conv;
13272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13273 LDKChannelPublicKeys o_conv;
13274 o_conv.inner = (void*)(o & (~1));
13275 o_conv.is_owned = (o & 1) || (o == 0);
13276 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13277 o_conv = ChannelPublicKeys_clone(&o_conv);
13278 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13279 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
13280 return (uintptr_t)ret_conv;
13283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13284 LDKDecodeError e_conv;
13285 e_conv.inner = (void*)(e & (~1));
13286 e_conv.is_owned = (e & 1) || (e == 0);
13287 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13288 e_conv = DecodeError_clone(&e_conv);
13289 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13290 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
13291 return (uintptr_t)ret_conv;
13294 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13295 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
13296 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
13300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13301 if ((_res & 1) != 0) return;
13302 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13303 CHECK_ACCESS(_res_ptr);
13304 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
13306 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
13309 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
13310 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13311 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
13312 return (uintptr_t)ret_conv;
13314 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13315 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
13316 intptr_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
13320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13321 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
13322 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13323 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
13324 return (uintptr_t)ret_conv;
13327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13328 LDKTxCreationKeys o_conv;
13329 o_conv.inner = (void*)(o & (~1));
13330 o_conv.is_owned = (o & 1) || (o == 0);
13331 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13332 o_conv = TxCreationKeys_clone(&o_conv);
13333 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13334 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
13335 return (uintptr_t)ret_conv;
13338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13339 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13340 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13341 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
13342 return (uintptr_t)ret_conv;
13345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13346 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
13347 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
13351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13352 if ((_res & 1) != 0) return;
13353 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13354 CHECK_ACCESS(_res_ptr);
13355 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
13357 CResult_TxCreationKeysErrorZ_free(_res_conv);
13360 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
13361 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13362 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
13363 return (uintptr_t)ret_conv;
13365 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13366 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
13367 intptr_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
13371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13372 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
13373 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
13374 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
13375 return (uintptr_t)ret_conv;
13378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
13379 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13380 *ret_copy = COption_u32Z_some(o);
13381 uintptr_t ret_ref = (uintptr_t)ret_copy;
13385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
13386 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13387 *ret_copy = COption_u32Z_none();
13388 uintptr_t ret_ref = (uintptr_t)ret_copy;
13392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
13393 if ((_res & 1) != 0) return;
13394 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13395 CHECK_ACCESS(_res_ptr);
13396 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
13398 COption_u32Z_free(_res_conv);
13401 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
13402 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13403 *ret_copy = COption_u32Z_clone(arg);
13404 uintptr_t ret_ref = (uintptr_t)ret_copy;
13407 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13408 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
13409 intptr_t ret_val = COption_u32Z_clone_ptr(arg_conv);
13413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13414 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
13415 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
13416 *ret_copy = COption_u32Z_clone(orig_conv);
13417 uintptr_t ret_ref = (uintptr_t)ret_copy;
13421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13422 LDKHTLCOutputInCommitment o_conv;
13423 o_conv.inner = (void*)(o & (~1));
13424 o_conv.is_owned = (o & 1) || (o == 0);
13425 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13426 o_conv = HTLCOutputInCommitment_clone(&o_conv);
13427 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
13428 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
13429 return (uintptr_t)ret_conv;
13432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13433 LDKDecodeError e_conv;
13434 e_conv.inner = (void*)(e & (~1));
13435 e_conv.is_owned = (e & 1) || (e == 0);
13436 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13437 e_conv = DecodeError_clone(&e_conv);
13438 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
13439 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
13440 return (uintptr_t)ret_conv;
13443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13444 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
13445 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
13449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13450 if ((_res & 1) != 0) return;
13451 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13452 CHECK_ACCESS(_res_ptr);
13453 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
13455 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
13458 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
13459 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
13460 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
13461 return (uintptr_t)ret_conv;
13463 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13464 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
13465 intptr_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
13469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13470 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
13471 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
13472 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
13473 return (uintptr_t)ret_conv;
13476 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
13477 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
13481 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
13482 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
13486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
13487 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
13488 COption_NoneZ_free(_res_conv);
13491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13492 LDKCounterpartyChannelTransactionParameters o_conv;
13493 o_conv.inner = (void*)(o & (~1));
13494 o_conv.is_owned = (o & 1) || (o == 0);
13495 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13496 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
13497 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
13498 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
13499 return (uintptr_t)ret_conv;
13502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13503 LDKDecodeError e_conv;
13504 e_conv.inner = (void*)(e & (~1));
13505 e_conv.is_owned = (e & 1) || (e == 0);
13506 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13507 e_conv = DecodeError_clone(&e_conv);
13508 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
13509 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
13510 return (uintptr_t)ret_conv;
13513 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13514 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
13515 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
13519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13520 if ((_res & 1) != 0) return;
13521 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13522 CHECK_ACCESS(_res_ptr);
13523 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
13525 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
13528 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
13529 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
13530 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
13531 return (uintptr_t)ret_conv;
13533 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13534 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
13535 intptr_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
13539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13540 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
13541 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
13542 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
13543 return (uintptr_t)ret_conv;
13546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13547 LDKChannelTransactionParameters o_conv;
13548 o_conv.inner = (void*)(o & (~1));
13549 o_conv.is_owned = (o & 1) || (o == 0);
13550 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13551 o_conv = ChannelTransactionParameters_clone(&o_conv);
13552 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
13553 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
13554 return (uintptr_t)ret_conv;
13557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13558 LDKDecodeError e_conv;
13559 e_conv.inner = (void*)(e & (~1));
13560 e_conv.is_owned = (e & 1) || (e == 0);
13561 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13562 e_conv = DecodeError_clone(&e_conv);
13563 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
13564 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
13565 return (uintptr_t)ret_conv;
13568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13569 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
13570 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
13574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13575 if ((_res & 1) != 0) return;
13576 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13577 CHECK_ACCESS(_res_ptr);
13578 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
13580 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
13583 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
13584 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
13585 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
13586 return (uintptr_t)ret_conv;
13588 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13589 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
13590 intptr_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
13594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13595 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
13596 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
13597 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
13598 return (uintptr_t)ret_conv;
13601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13602 LDKCVec_SignatureZ _res_constr;
13603 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13604 if (_res_constr.datalen > 0)
13605 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13607 _res_constr.data = NULL;
13608 for (size_t i = 0; i < _res_constr.datalen; i++) {
13609 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13610 LDKSignature _res_conv_8_ref;
13611 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
13612 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
13613 _res_constr.data[i] = _res_conv_8_ref;
13615 CVec_SignatureZ_free(_res_constr);
13618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13619 LDKHolderCommitmentTransaction o_conv;
13620 o_conv.inner = (void*)(o & (~1));
13621 o_conv.is_owned = (o & 1) || (o == 0);
13622 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13623 o_conv = HolderCommitmentTransaction_clone(&o_conv);
13624 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
13625 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
13626 return (uintptr_t)ret_conv;
13629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_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 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13634 e_conv = DecodeError_clone(&e_conv);
13635 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
13636 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
13637 return (uintptr_t)ret_conv;
13640 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13641 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
13642 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
13646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13647 if ((_res & 1) != 0) return;
13648 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13649 CHECK_ACCESS(_res_ptr);
13650 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
13652 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
13655 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
13656 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
13657 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
13658 return (uintptr_t)ret_conv;
13660 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13661 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
13662 intptr_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
13666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13667 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
13668 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
13669 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
13670 return (uintptr_t)ret_conv;
13673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13674 LDKBuiltCommitmentTransaction o_conv;
13675 o_conv.inner = (void*)(o & (~1));
13676 o_conv.is_owned = (o & 1) || (o == 0);
13677 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13678 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
13679 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
13680 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
13681 return (uintptr_t)ret_conv;
13684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13685 LDKDecodeError e_conv;
13686 e_conv.inner = (void*)(e & (~1));
13687 e_conv.is_owned = (e & 1) || (e == 0);
13688 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13689 e_conv = DecodeError_clone(&e_conv);
13690 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
13691 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
13692 return (uintptr_t)ret_conv;
13695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13696 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
13697 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
13701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13702 if ((_res & 1) != 0) return;
13703 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13704 CHECK_ACCESS(_res_ptr);
13705 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
13707 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
13710 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
13711 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
13712 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
13713 return (uintptr_t)ret_conv;
13715 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13716 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
13717 intptr_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
13721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13722 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
13723 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
13724 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
13725 return (uintptr_t)ret_conv;
13728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13729 LDKTrustedClosingTransaction o_conv;
13730 o_conv.inner = (void*)(o & (~1));
13731 o_conv.is_owned = (o & 1) || (o == 0);
13732 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13733 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
13734 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
13735 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
13736 return (uintptr_t)ret_conv;
13739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
13740 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
13741 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
13742 return (uintptr_t)ret_conv;
13745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13746 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
13747 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
13751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13752 if ((_res & 1) != 0) return;
13753 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13754 CHECK_ACCESS(_res_ptr);
13755 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
13757 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
13760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13761 LDKCommitmentTransaction o_conv;
13762 o_conv.inner = (void*)(o & (~1));
13763 o_conv.is_owned = (o & 1) || (o == 0);
13764 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13765 o_conv = CommitmentTransaction_clone(&o_conv);
13766 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
13767 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
13768 return (uintptr_t)ret_conv;
13771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13772 LDKDecodeError e_conv;
13773 e_conv.inner = (void*)(e & (~1));
13774 e_conv.is_owned = (e & 1) || (e == 0);
13775 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13776 e_conv = DecodeError_clone(&e_conv);
13777 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
13778 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
13779 return (uintptr_t)ret_conv;
13782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13783 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
13784 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
13788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13789 if ((_res & 1) != 0) return;
13790 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13791 CHECK_ACCESS(_res_ptr);
13792 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
13794 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
13797 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
13798 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
13799 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
13800 return (uintptr_t)ret_conv;
13802 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13803 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
13804 intptr_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
13808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13809 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
13810 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
13811 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
13812 return (uintptr_t)ret_conv;
13815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13816 LDKTrustedCommitmentTransaction o_conv;
13817 o_conv.inner = (void*)(o & (~1));
13818 o_conv.is_owned = (o & 1) || (o == 0);
13819 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13820 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
13821 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
13822 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
13823 return (uintptr_t)ret_conv;
13826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
13827 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
13828 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
13829 return (uintptr_t)ret_conv;
13832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13833 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
13834 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
13838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13839 if ((_res & 1) != 0) return;
13840 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13841 CHECK_ACCESS(_res_ptr);
13842 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
13844 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
13847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
13848 LDKCVec_SignatureZ o_constr;
13849 o_constr.datalen = (*env)->GetArrayLength(env, o);
13850 if (o_constr.datalen > 0)
13851 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
13853 o_constr.data = NULL;
13854 for (size_t i = 0; i < o_constr.datalen; i++) {
13855 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
13856 LDKSignature o_conv_8_ref;
13857 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
13858 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
13859 o_constr.data[i] = o_conv_8_ref;
13861 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13862 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
13863 return (uintptr_t)ret_conv;
13866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
13867 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13868 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
13869 return (uintptr_t)ret_conv;
13872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13873 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
13874 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
13878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13879 if ((_res & 1) != 0) return;
13880 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13881 CHECK_ACCESS(_res_ptr);
13882 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
13884 CResult_CVec_SignatureZNoneZ_free(_res_conv);
13887 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
13888 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13889 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
13890 return (uintptr_t)ret_conv;
13892 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13893 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
13894 intptr_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
13898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13899 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
13900 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13901 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
13902 return (uintptr_t)ret_conv;
13905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13906 LDKShutdownScript o_conv;
13907 o_conv.inner = (void*)(o & (~1));
13908 o_conv.is_owned = (o & 1) || (o == 0);
13909 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13910 o_conv = ShutdownScript_clone(&o_conv);
13911 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13912 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
13913 return (uintptr_t)ret_conv;
13916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13917 LDKDecodeError e_conv;
13918 e_conv.inner = (void*)(e & (~1));
13919 e_conv.is_owned = (e & 1) || (e == 0);
13920 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13921 e_conv = DecodeError_clone(&e_conv);
13922 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13923 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
13924 return (uintptr_t)ret_conv;
13927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13928 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
13929 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
13933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13934 if ((_res & 1) != 0) return;
13935 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13936 CHECK_ACCESS(_res_ptr);
13937 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
13939 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
13942 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
13943 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13944 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
13945 return (uintptr_t)ret_conv;
13947 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13948 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
13949 intptr_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
13953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13954 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
13955 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
13956 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
13957 return (uintptr_t)ret_conv;
13960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13961 LDKShutdownScript o_conv;
13962 o_conv.inner = (void*)(o & (~1));
13963 o_conv.is_owned = (o & 1) || (o == 0);
13964 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13965 o_conv = ShutdownScript_clone(&o_conv);
13966 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13967 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
13968 return (uintptr_t)ret_conv;
13971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13972 LDKInvalidShutdownScript e_conv;
13973 e_conv.inner = (void*)(e & (~1));
13974 e_conv.is_owned = (e & 1) || (e == 0);
13975 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13976 e_conv = InvalidShutdownScript_clone(&e_conv);
13977 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13978 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
13979 return (uintptr_t)ret_conv;
13982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13983 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
13984 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
13988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13989 if ((_res & 1) != 0) return;
13990 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13991 CHECK_ACCESS(_res_ptr);
13992 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
13994 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
13997 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
13998 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
13999 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
14000 return (uintptr_t)ret_conv;
14002 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14003 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
14004 intptr_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
14008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14009 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
14010 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14011 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
14012 return (uintptr_t)ret_conv;
14015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
14016 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14017 *ret_conv = CResult_NoneErrorZ_ok();
14018 return (uintptr_t)ret_conv;
14021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14022 LDKIOError e_conv = LDKIOError_from_java(env, e);
14023 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14024 *ret_conv = CResult_NoneErrorZ_err(e_conv);
14025 return (uintptr_t)ret_conv;
14028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14029 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
14030 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
14034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14035 if ((_res & 1) != 0) return;
14036 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14037 CHECK_ACCESS(_res_ptr);
14038 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
14040 CResult_NoneErrorZ_free(_res_conv);
14043 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
14044 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14045 *ret_conv = CResult_NoneErrorZ_clone(arg);
14046 return (uintptr_t)ret_conv;
14048 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14049 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
14050 intptr_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
14054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14055 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
14056 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14057 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
14058 return (uintptr_t)ret_conv;
14061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14062 LDKRouteHop o_conv;
14063 o_conv.inner = (void*)(o & (~1));
14064 o_conv.is_owned = (o & 1) || (o == 0);
14065 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14066 o_conv = RouteHop_clone(&o_conv);
14067 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14068 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
14069 return (uintptr_t)ret_conv;
14072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14073 LDKDecodeError e_conv;
14074 e_conv.inner = (void*)(e & (~1));
14075 e_conv.is_owned = (e & 1) || (e == 0);
14076 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14077 e_conv = DecodeError_clone(&e_conv);
14078 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14079 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
14080 return (uintptr_t)ret_conv;
14083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14084 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
14085 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
14089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14090 if ((_res & 1) != 0) return;
14091 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14092 CHECK_ACCESS(_res_ptr);
14093 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
14095 CResult_RouteHopDecodeErrorZ_free(_res_conv);
14098 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
14099 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14100 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
14101 return (uintptr_t)ret_conv;
14103 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14104 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
14105 intptr_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
14109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14110 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
14111 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14112 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
14113 return (uintptr_t)ret_conv;
14116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14117 LDKCVec_RouteHopZ _res_constr;
14118 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14119 if (_res_constr.datalen > 0)
14120 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14122 _res_constr.data = NULL;
14123 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14124 for (size_t k = 0; k < _res_constr.datalen; k++) {
14125 int64_t _res_conv_10 = _res_vals[k];
14126 LDKRouteHop _res_conv_10_conv;
14127 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
14128 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
14129 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
14130 _res_constr.data[k] = _res_conv_10_conv;
14132 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14133 CVec_RouteHopZ_free(_res_constr);
14136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14137 LDKCVec_CVec_RouteHopZZ _res_constr;
14138 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14139 if (_res_constr.datalen > 0)
14140 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14142 _res_constr.data = NULL;
14143 for (size_t m = 0; m < _res_constr.datalen; m++) {
14144 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
14145 LDKCVec_RouteHopZ _res_conv_12_constr;
14146 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
14147 if (_res_conv_12_constr.datalen > 0)
14148 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14150 _res_conv_12_constr.data = NULL;
14151 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
14152 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
14153 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
14154 LDKRouteHop _res_conv_12_conv_10_conv;
14155 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
14156 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
14157 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
14158 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
14160 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
14161 _res_constr.data[m] = _res_conv_12_constr;
14163 CVec_CVec_RouteHopZZ_free(_res_constr);
14166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14168 o_conv.inner = (void*)(o & (~1));
14169 o_conv.is_owned = (o & 1) || (o == 0);
14170 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14171 o_conv = Route_clone(&o_conv);
14172 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14173 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
14174 return (uintptr_t)ret_conv;
14177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14178 LDKDecodeError e_conv;
14179 e_conv.inner = (void*)(e & (~1));
14180 e_conv.is_owned = (e & 1) || (e == 0);
14181 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14182 e_conv = DecodeError_clone(&e_conv);
14183 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14184 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
14185 return (uintptr_t)ret_conv;
14188 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14189 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
14190 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
14194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14195 if ((_res & 1) != 0) return;
14196 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14197 CHECK_ACCESS(_res_ptr);
14198 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
14200 CResult_RouteDecodeErrorZ_free(_res_conv);
14203 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
14204 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14205 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
14206 return (uintptr_t)ret_conv;
14208 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14209 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
14210 intptr_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
14214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14215 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
14216 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14217 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
14218 return (uintptr_t)ret_conv;
14221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14222 LDKRouteParameters o_conv;
14223 o_conv.inner = (void*)(o & (~1));
14224 o_conv.is_owned = (o & 1) || (o == 0);
14225 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14226 o_conv = RouteParameters_clone(&o_conv);
14227 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14228 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
14229 return (uintptr_t)ret_conv;
14232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14233 LDKDecodeError e_conv;
14234 e_conv.inner = (void*)(e & (~1));
14235 e_conv.is_owned = (e & 1) || (e == 0);
14236 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14237 e_conv = DecodeError_clone(&e_conv);
14238 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14239 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
14240 return (uintptr_t)ret_conv;
14243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14244 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
14245 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
14249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14250 if ((_res & 1) != 0) return;
14251 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14252 CHECK_ACCESS(_res_ptr);
14253 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
14255 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
14258 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
14259 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14260 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
14261 return (uintptr_t)ret_conv;
14263 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14264 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
14265 intptr_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
14269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14270 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
14271 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14272 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
14273 return (uintptr_t)ret_conv;
14276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14277 LDKCVec_RouteHintZ _res_constr;
14278 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14279 if (_res_constr.datalen > 0)
14280 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
14282 _res_constr.data = NULL;
14283 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14284 for (size_t l = 0; l < _res_constr.datalen; l++) {
14285 int64_t _res_conv_11 = _res_vals[l];
14286 LDKRouteHint _res_conv_11_conv;
14287 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
14288 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
14289 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
14290 _res_constr.data[l] = _res_conv_11_conv;
14292 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14293 CVec_RouteHintZ_free(_res_constr);
14296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
14297 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14298 *ret_copy = COption_u64Z_some(o);
14299 uintptr_t ret_ref = (uintptr_t)ret_copy;
14303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
14304 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14305 *ret_copy = COption_u64Z_none();
14306 uintptr_t ret_ref = (uintptr_t)ret_copy;
14310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14311 if ((_res & 1) != 0) return;
14312 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14313 CHECK_ACCESS(_res_ptr);
14314 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
14316 COption_u64Z_free(_res_conv);
14319 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
14320 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14321 *ret_copy = COption_u64Z_clone(arg);
14322 uintptr_t ret_ref = (uintptr_t)ret_copy;
14325 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14326 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
14327 intptr_t ret_val = COption_u64Z_clone_ptr(arg_conv);
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14332 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
14333 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14334 *ret_copy = COption_u64Z_clone(orig_conv);
14335 uintptr_t ret_ref = (uintptr_t)ret_copy;
14339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14341 o_conv.inner = (void*)(o & (~1));
14342 o_conv.is_owned = (o & 1) || (o == 0);
14343 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14344 o_conv = Payee_clone(&o_conv);
14345 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
14346 *ret_conv = CResult_PayeeDecodeErrorZ_ok(o_conv);
14347 return (uintptr_t)ret_conv;
14350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14351 LDKDecodeError e_conv;
14352 e_conv.inner = (void*)(e & (~1));
14353 e_conv.is_owned = (e & 1) || (e == 0);
14354 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14355 e_conv = DecodeError_clone(&e_conv);
14356 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
14357 *ret_conv = CResult_PayeeDecodeErrorZ_err(e_conv);
14358 return (uintptr_t)ret_conv;
14361 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14362 LDKCResult_PayeeDecodeErrorZ* o_conv = (LDKCResult_PayeeDecodeErrorZ*)(o & ~1);
14363 jboolean ret_val = CResult_PayeeDecodeErrorZ_is_ok(o_conv);
14367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14368 if ((_res & 1) != 0) return;
14369 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14370 CHECK_ACCESS(_res_ptr);
14371 LDKCResult_PayeeDecodeErrorZ _res_conv = *(LDKCResult_PayeeDecodeErrorZ*)(_res_ptr);
14373 CResult_PayeeDecodeErrorZ_free(_res_conv);
14376 static inline uintptr_t CResult_PayeeDecodeErrorZ_clone_ptr(LDKCResult_PayeeDecodeErrorZ *NONNULL_PTR arg) {
14377 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
14378 *ret_conv = CResult_PayeeDecodeErrorZ_clone(arg);
14379 return (uintptr_t)ret_conv;
14381 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14382 LDKCResult_PayeeDecodeErrorZ* arg_conv = (LDKCResult_PayeeDecodeErrorZ*)(arg & ~1);
14383 intptr_t ret_val = CResult_PayeeDecodeErrorZ_clone_ptr(arg_conv);
14387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14388 LDKCResult_PayeeDecodeErrorZ* orig_conv = (LDKCResult_PayeeDecodeErrorZ*)(orig & ~1);
14389 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
14390 *ret_conv = CResult_PayeeDecodeErrorZ_clone(orig_conv);
14391 return (uintptr_t)ret_conv;
14394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14395 LDKCVec_RouteHintHopZ _res_constr;
14396 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14397 if (_res_constr.datalen > 0)
14398 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
14400 _res_constr.data = NULL;
14401 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14402 for (size_t o = 0; o < _res_constr.datalen; o++) {
14403 int64_t _res_conv_14 = _res_vals[o];
14404 LDKRouteHintHop _res_conv_14_conv;
14405 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
14406 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
14407 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
14408 _res_constr.data[o] = _res_conv_14_conv;
14410 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14411 CVec_RouteHintHopZ_free(_res_constr);
14414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14415 LDKRouteHint o_conv;
14416 o_conv.inner = (void*)(o & (~1));
14417 o_conv.is_owned = (o & 1) || (o == 0);
14418 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14419 o_conv = RouteHint_clone(&o_conv);
14420 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
14421 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
14422 return (uintptr_t)ret_conv;
14425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14426 LDKDecodeError e_conv;
14427 e_conv.inner = (void*)(e & (~1));
14428 e_conv.is_owned = (e & 1) || (e == 0);
14429 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14430 e_conv = DecodeError_clone(&e_conv);
14431 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
14432 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
14433 return (uintptr_t)ret_conv;
14436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14437 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
14438 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
14442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14443 if ((_res & 1) != 0) return;
14444 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14445 CHECK_ACCESS(_res_ptr);
14446 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
14448 CResult_RouteHintDecodeErrorZ_free(_res_conv);
14451 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
14452 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
14453 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
14454 return (uintptr_t)ret_conv;
14456 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14457 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
14458 intptr_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
14462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14463 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
14464 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
14465 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
14466 return (uintptr_t)ret_conv;
14469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14470 LDKRouteHintHop o_conv;
14471 o_conv.inner = (void*)(o & (~1));
14472 o_conv.is_owned = (o & 1) || (o == 0);
14473 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14474 o_conv = RouteHintHop_clone(&o_conv);
14475 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
14476 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
14477 return (uintptr_t)ret_conv;
14480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14481 LDKDecodeError e_conv;
14482 e_conv.inner = (void*)(e & (~1));
14483 e_conv.is_owned = (e & 1) || (e == 0);
14484 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14485 e_conv = DecodeError_clone(&e_conv);
14486 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
14487 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
14488 return (uintptr_t)ret_conv;
14491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14492 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
14493 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
14497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14498 if ((_res & 1) != 0) return;
14499 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14500 CHECK_ACCESS(_res_ptr);
14501 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
14503 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
14506 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
14507 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
14508 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
14509 return (uintptr_t)ret_conv;
14511 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14512 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
14513 intptr_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
14517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14518 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
14519 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
14520 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
14521 return (uintptr_t)ret_conv;
14524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14525 LDKCVec_ChannelDetailsZ _res_constr;
14526 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14527 if (_res_constr.datalen > 0)
14528 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14530 _res_constr.data = NULL;
14531 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14532 for (size_t q = 0; q < _res_constr.datalen; q++) {
14533 int64_t _res_conv_16 = _res_vals[q];
14534 LDKChannelDetails _res_conv_16_conv;
14535 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
14536 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
14537 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
14538 _res_constr.data[q] = _res_conv_16_conv;
14540 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14541 CVec_ChannelDetailsZ_free(_res_constr);
14544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14546 o_conv.inner = (void*)(o & (~1));
14547 o_conv.is_owned = (o & 1) || (o == 0);
14548 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14549 o_conv = Route_clone(&o_conv);
14550 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14551 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
14552 return (uintptr_t)ret_conv;
14555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14556 LDKLightningError e_conv;
14557 e_conv.inner = (void*)(e & (~1));
14558 e_conv.is_owned = (e & 1) || (e == 0);
14559 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14560 e_conv = LightningError_clone(&e_conv);
14561 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14562 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
14563 return (uintptr_t)ret_conv;
14566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14567 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
14568 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
14572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14573 if ((_res & 1) != 0) return;
14574 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14575 CHECK_ACCESS(_res_ptr);
14576 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
14578 CResult_RouteLightningErrorZ_free(_res_conv);
14581 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
14582 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14583 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
14584 return (uintptr_t)ret_conv;
14586 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14587 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
14588 intptr_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
14592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14593 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
14594 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14595 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
14596 return (uintptr_t)ret_conv;
14599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14600 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14601 CHECK_ACCESS(o_ptr);
14602 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
14603 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
14604 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
14605 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
14606 return (uintptr_t)ret_conv;
14609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14610 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
14611 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
14612 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
14613 return (uintptr_t)ret_conv;
14616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14617 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
14618 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
14622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14623 if ((_res & 1) != 0) return;
14624 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14625 CHECK_ACCESS(_res_ptr);
14626 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
14628 CResult_TxOutAccessErrorZ_free(_res_conv);
14631 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
14632 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
14633 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
14634 return (uintptr_t)ret_conv;
14636 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14637 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
14638 intptr_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
14642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14643 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
14644 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
14645 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
14646 return (uintptr_t)ret_conv;
14649 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
14650 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14651 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
14652 return ((uintptr_t)ret_conv);
14654 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14655 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
14656 intptr_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
14660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14661 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
14662 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14663 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
14664 return ((uintptr_t)ret_conv);
14667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, intptr_t a, int8_tArray b) {
14668 LDKTransaction b_ref;
14669 b_ref.datalen = (*env)->GetArrayLength(env, b);
14670 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
14671 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
14672 b_ref.data_is_owned = true;
14673 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
14674 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
14675 return ((uintptr_t)ret_conv);
14678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14679 if ((_res & 1) != 0) return;
14680 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14681 CHECK_ACCESS(_res_ptr);
14682 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
14684 C2Tuple_usizeTransactionZ_free(_res_conv);
14687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14688 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
14689 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14690 if (_res_constr.datalen > 0)
14691 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14693 _res_constr.data = NULL;
14694 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14695 for (size_t c = 0; c < _res_constr.datalen; c++) {
14696 int64_t _res_conv_28 = _res_vals[c];
14697 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
14698 CHECK_ACCESS(_res_conv_28_ptr);
14699 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
14700 FREE((void*)_res_conv_28);
14701 _res_constr.data[c] = _res_conv_28_conv;
14703 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14704 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
14707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14708 LDKCVec_TxidZ _res_constr;
14709 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14710 if (_res_constr.datalen > 0)
14711 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
14713 _res_constr.data = NULL;
14714 for (size_t i = 0; i < _res_constr.datalen; i++) {
14715 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14716 LDKThirtyTwoBytes _res_conv_8_ref;
14717 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
14718 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
14719 _res_constr.data[i] = _res_conv_8_ref;
14721 CVec_TxidZ_free(_res_constr);
14724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
14725 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
14726 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
14727 return (uintptr_t)ret_conv;
14730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
14731 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
14732 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
14733 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
14734 return (uintptr_t)ret_conv;
14737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14738 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
14739 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
14743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14744 if ((_res & 1) != 0) return;
14745 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14746 CHECK_ACCESS(_res_ptr);
14747 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
14749 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
14752 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
14753 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
14754 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
14755 return (uintptr_t)ret_conv;
14757 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14758 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
14759 intptr_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
14763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14764 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
14765 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
14766 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
14767 return (uintptr_t)ret_conv;
14770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14771 LDKCVec_MonitorEventZ _res_constr;
14772 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14773 if (_res_constr.datalen > 0)
14774 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14776 _res_constr.data = NULL;
14777 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14778 for (size_t o = 0; o < _res_constr.datalen; o++) {
14779 int64_t _res_conv_14 = _res_vals[o];
14780 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
14781 CHECK_ACCESS(_res_conv_14_ptr);
14782 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
14783 FREE((void*)_res_conv_14);
14784 _res_constr.data[o] = _res_conv_14_conv;
14786 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14787 CVec_MonitorEventZ_free(_res_constr);
14790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14791 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14792 CHECK_ACCESS(o_ptr);
14793 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
14794 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
14795 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
14796 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
14797 uintptr_t ret_ref = (uintptr_t)ret_copy;
14801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
14802 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
14803 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
14804 uintptr_t ret_ref = (uintptr_t)ret_copy;
14808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14809 if ((_res & 1) != 0) return;
14810 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14811 CHECK_ACCESS(_res_ptr);
14812 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
14814 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
14817 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
14818 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
14819 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
14820 uintptr_t ret_ref = (uintptr_t)ret_copy;
14823 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14824 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
14825 intptr_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
14829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14830 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
14831 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
14832 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
14833 uintptr_t ret_ref = (uintptr_t)ret_copy;
14837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14838 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14839 CHECK_ACCESS(o_ptr);
14840 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
14841 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
14842 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14843 *ret_copy = COption_ClosureReasonZ_some(o_conv);
14844 uintptr_t ret_ref = (uintptr_t)ret_copy;
14848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
14849 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14850 *ret_copy = COption_ClosureReasonZ_none();
14851 uintptr_t ret_ref = (uintptr_t)ret_copy;
14855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14856 if ((_res & 1) != 0) return;
14857 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14858 CHECK_ACCESS(_res_ptr);
14859 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
14861 COption_ClosureReasonZ_free(_res_conv);
14864 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
14865 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14866 *ret_copy = COption_ClosureReasonZ_clone(arg);
14867 uintptr_t ret_ref = (uintptr_t)ret_copy;
14870 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14871 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
14872 intptr_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
14876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14877 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
14878 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14879 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
14880 uintptr_t ret_ref = (uintptr_t)ret_copy;
14884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14885 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14886 CHECK_ACCESS(o_ptr);
14887 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
14888 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
14889 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14890 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
14891 return (uintptr_t)ret_conv;
14894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14895 LDKDecodeError e_conv;
14896 e_conv.inner = (void*)(e & (~1));
14897 e_conv.is_owned = (e & 1) || (e == 0);
14898 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14899 e_conv = DecodeError_clone(&e_conv);
14900 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14901 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
14902 return (uintptr_t)ret_conv;
14905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14906 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
14907 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
14911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14912 if ((_res & 1) != 0) return;
14913 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14914 CHECK_ACCESS(_res_ptr);
14915 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
14917 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
14920 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
14921 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14922 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
14923 return (uintptr_t)ret_conv;
14925 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14926 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
14927 intptr_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
14931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14932 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
14933 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
14934 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
14935 return (uintptr_t)ret_conv;
14938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14939 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14940 CHECK_ACCESS(o_ptr);
14941 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
14942 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
14943 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14944 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
14945 uintptr_t ret_ref = (uintptr_t)ret_copy;
14949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
14950 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14951 *ret_copy = COption_NetworkUpdateZ_none();
14952 uintptr_t ret_ref = (uintptr_t)ret_copy;
14956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14957 if ((_res & 1) != 0) return;
14958 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14959 CHECK_ACCESS(_res_ptr);
14960 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
14962 COption_NetworkUpdateZ_free(_res_conv);
14965 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
14966 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14967 *ret_copy = COption_NetworkUpdateZ_clone(arg);
14968 uintptr_t ret_ref = (uintptr_t)ret_copy;
14971 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14972 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
14973 intptr_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
14977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14978 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
14979 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
14980 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
14981 uintptr_t ret_ref = (uintptr_t)ret_copy;
14985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14986 LDKCVec_SpendableOutputDescriptorZ _res_constr;
14987 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14988 if (_res_constr.datalen > 0)
14989 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14991 _res_constr.data = NULL;
14992 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14993 for (size_t b = 0; b < _res_constr.datalen; b++) {
14994 int64_t _res_conv_27 = _res_vals[b];
14995 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
14996 CHECK_ACCESS(_res_conv_27_ptr);
14997 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
14998 FREE((void*)_res_conv_27);
14999 _res_constr.data[b] = _res_conv_27_conv;
15001 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15002 CVec_SpendableOutputDescriptorZ_free(_res_constr);
15005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15006 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15007 CHECK_ACCESS(o_ptr);
15008 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15009 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
15010 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15011 *ret_copy = COption_EventZ_some(o_conv);
15012 uintptr_t ret_ref = (uintptr_t)ret_copy;
15016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
15017 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15018 *ret_copy = COption_EventZ_none();
15019 uintptr_t ret_ref = (uintptr_t)ret_copy;
15023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15024 if ((_res & 1) != 0) return;
15025 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15026 CHECK_ACCESS(_res_ptr);
15027 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15029 COption_EventZ_free(_res_conv);
15032 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15033 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15034 *ret_copy = COption_EventZ_clone(arg);
15035 uintptr_t ret_ref = (uintptr_t)ret_copy;
15038 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15039 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
15040 intptr_t ret_val = COption_EventZ_clone_ptr(arg_conv);
15044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15045 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
15046 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15047 *ret_copy = COption_EventZ_clone(orig_conv);
15048 uintptr_t ret_ref = (uintptr_t)ret_copy;
15052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15053 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15054 CHECK_ACCESS(o_ptr);
15055 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15056 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
15057 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15058 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15059 return (uintptr_t)ret_conv;
15062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15063 LDKDecodeError e_conv;
15064 e_conv.inner = (void*)(e & (~1));
15065 e_conv.is_owned = (e & 1) || (e == 0);
15066 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15067 e_conv = DecodeError_clone(&e_conv);
15068 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15069 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15070 return (uintptr_t)ret_conv;
15073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15074 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
15075 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15080 if ((_res & 1) != 0) return;
15081 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15082 CHECK_ACCESS(_res_ptr);
15083 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15085 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15088 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15089 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15090 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15091 return (uintptr_t)ret_conv;
15093 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15094 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
15095 intptr_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15100 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
15101 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15102 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15103 return (uintptr_t)ret_conv;
15106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15107 LDKCVec_MessageSendEventZ _res_constr;
15108 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15109 if (_res_constr.datalen > 0)
15110 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15112 _res_constr.data = NULL;
15113 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15114 for (size_t s = 0; s < _res_constr.datalen; s++) {
15115 int64_t _res_conv_18 = _res_vals[s];
15116 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
15117 CHECK_ACCESS(_res_conv_18_ptr);
15118 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15119 FREE((void*)_res_conv_18);
15120 _res_constr.data[s] = _res_conv_18_conv;
15122 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15123 CVec_MessageSendEventZ_free(_res_constr);
15126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15127 LDKScoringParameters o_conv;
15128 o_conv.inner = (void*)(o & (~1));
15129 o_conv.is_owned = (o & 1) || (o == 0);
15130 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15131 // Warning: we need a move here but no clone is available for LDKScoringParameters
15132 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15133 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
15134 return (uintptr_t)ret_conv;
15137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15138 LDKDecodeError e_conv;
15139 e_conv.inner = (void*)(e & (~1));
15140 e_conv.is_owned = (e & 1) || (e == 0);
15141 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15142 e_conv = DecodeError_clone(&e_conv);
15143 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15144 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
15145 return (uintptr_t)ret_conv;
15148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15149 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
15150 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
15154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15155 if ((_res & 1) != 0) return;
15156 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15157 CHECK_ACCESS(_res_ptr);
15158 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
15160 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
15163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15165 o_conv.inner = (void*)(o & (~1));
15166 o_conv.is_owned = (o & 1) || (o == 0);
15167 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15168 // Warning: we need a move here but no clone is available for LDKScorer
15169 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
15170 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
15171 return (uintptr_t)ret_conv;
15174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15175 LDKDecodeError e_conv;
15176 e_conv.inner = (void*)(e & (~1));
15177 e_conv.is_owned = (e & 1) || (e == 0);
15178 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15179 e_conv = DecodeError_clone(&e_conv);
15180 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
15181 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
15182 return (uintptr_t)ret_conv;
15185 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15186 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
15187 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
15191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15192 if ((_res & 1) != 0) return;
15193 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15194 CHECK_ACCESS(_res_ptr);
15195 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
15197 CResult_ScorerDecodeErrorZ_free(_res_conv);
15200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15201 LDKInitFeatures o_conv;
15202 o_conv.inner = (void*)(o & (~1));
15203 o_conv.is_owned = (o & 1) || (o == 0);
15204 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15205 o_conv = InitFeatures_clone(&o_conv);
15206 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
15207 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
15208 return (uintptr_t)ret_conv;
15211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15212 LDKDecodeError e_conv;
15213 e_conv.inner = (void*)(e & (~1));
15214 e_conv.is_owned = (e & 1) || (e == 0);
15215 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15216 e_conv = DecodeError_clone(&e_conv);
15217 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
15218 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
15219 return (uintptr_t)ret_conv;
15222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15223 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
15224 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
15228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15229 if ((_res & 1) != 0) return;
15230 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15231 CHECK_ACCESS(_res_ptr);
15232 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
15234 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
15237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15238 LDKChannelFeatures o_conv;
15239 o_conv.inner = (void*)(o & (~1));
15240 o_conv.is_owned = (o & 1) || (o == 0);
15241 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15242 o_conv = ChannelFeatures_clone(&o_conv);
15243 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
15244 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
15245 return (uintptr_t)ret_conv;
15248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15249 LDKDecodeError e_conv;
15250 e_conv.inner = (void*)(e & (~1));
15251 e_conv.is_owned = (e & 1) || (e == 0);
15252 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15253 e_conv = DecodeError_clone(&e_conv);
15254 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
15255 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
15256 return (uintptr_t)ret_conv;
15259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15260 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
15261 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
15265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15266 if ((_res & 1) != 0) return;
15267 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15268 CHECK_ACCESS(_res_ptr);
15269 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
15271 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
15274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15275 LDKNodeFeatures o_conv;
15276 o_conv.inner = (void*)(o & (~1));
15277 o_conv.is_owned = (o & 1) || (o == 0);
15278 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15279 o_conv = NodeFeatures_clone(&o_conv);
15280 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
15281 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
15282 return (uintptr_t)ret_conv;
15285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15286 LDKDecodeError e_conv;
15287 e_conv.inner = (void*)(e & (~1));
15288 e_conv.is_owned = (e & 1) || (e == 0);
15289 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15290 e_conv = DecodeError_clone(&e_conv);
15291 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
15292 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
15293 return (uintptr_t)ret_conv;
15296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15297 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
15298 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
15302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15303 if ((_res & 1) != 0) return;
15304 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15305 CHECK_ACCESS(_res_ptr);
15306 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
15308 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
15311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15312 LDKInvoiceFeatures o_conv;
15313 o_conv.inner = (void*)(o & (~1));
15314 o_conv.is_owned = (o & 1) || (o == 0);
15315 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15316 o_conv = InvoiceFeatures_clone(&o_conv);
15317 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
15318 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
15319 return (uintptr_t)ret_conv;
15322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15323 LDKDecodeError e_conv;
15324 e_conv.inner = (void*)(e & (~1));
15325 e_conv.is_owned = (e & 1) || (e == 0);
15326 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15327 e_conv = DecodeError_clone(&e_conv);
15328 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
15329 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
15330 return (uintptr_t)ret_conv;
15333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15334 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
15335 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
15339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15340 if ((_res & 1) != 0) return;
15341 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15342 CHECK_ACCESS(_res_ptr);
15343 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
15345 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
15348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15349 LDKChannelTypeFeatures o_conv;
15350 o_conv.inner = (void*)(o & (~1));
15351 o_conv.is_owned = (o & 1) || (o == 0);
15352 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15353 o_conv = ChannelTypeFeatures_clone(&o_conv);
15354 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
15355 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
15356 return (uintptr_t)ret_conv;
15359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15360 LDKDecodeError e_conv;
15361 e_conv.inner = (void*)(e & (~1));
15362 e_conv.is_owned = (e & 1) || (e == 0);
15363 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15364 e_conv = DecodeError_clone(&e_conv);
15365 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
15366 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
15367 return (uintptr_t)ret_conv;
15370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15371 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
15372 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
15376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15377 if ((_res & 1) != 0) return;
15378 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15379 CHECK_ACCESS(_res_ptr);
15380 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
15382 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
15385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15386 LDKDelayedPaymentOutputDescriptor o_conv;
15387 o_conv.inner = (void*)(o & (~1));
15388 o_conv.is_owned = (o & 1) || (o == 0);
15389 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15390 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15391 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15392 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15393 return (uintptr_t)ret_conv;
15396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15397 LDKDecodeError e_conv;
15398 e_conv.inner = (void*)(e & (~1));
15399 e_conv.is_owned = (e & 1) || (e == 0);
15400 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15401 e_conv = DecodeError_clone(&e_conv);
15402 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15403 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15404 return (uintptr_t)ret_conv;
15407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15408 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
15409 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15414 if ((_res & 1) != 0) return;
15415 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15416 CHECK_ACCESS(_res_ptr);
15417 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15419 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15422 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15423 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15424 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15425 return (uintptr_t)ret_conv;
15427 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15428 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
15429 intptr_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15434 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
15435 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15436 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15437 return (uintptr_t)ret_conv;
15440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15441 LDKStaticPaymentOutputDescriptor o_conv;
15442 o_conv.inner = (void*)(o & (~1));
15443 o_conv.is_owned = (o & 1) || (o == 0);
15444 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15445 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15446 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15447 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15448 return (uintptr_t)ret_conv;
15451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15452 LDKDecodeError e_conv;
15453 e_conv.inner = (void*)(e & (~1));
15454 e_conv.is_owned = (e & 1) || (e == 0);
15455 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15456 e_conv = DecodeError_clone(&e_conv);
15457 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15458 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15459 return (uintptr_t)ret_conv;
15462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15463 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
15464 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15469 if ((_res & 1) != 0) return;
15470 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15471 CHECK_ACCESS(_res_ptr);
15472 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15474 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15477 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15478 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15479 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15480 return (uintptr_t)ret_conv;
15482 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15483 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
15484 intptr_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15489 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
15490 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15491 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15492 return (uintptr_t)ret_conv;
15495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15496 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15497 CHECK_ACCESS(o_ptr);
15498 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15499 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
15500 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15501 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15502 return (uintptr_t)ret_conv;
15505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15506 LDKDecodeError e_conv;
15507 e_conv.inner = (void*)(e & (~1));
15508 e_conv.is_owned = (e & 1) || (e == 0);
15509 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15510 e_conv = DecodeError_clone(&e_conv);
15511 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15512 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15513 return (uintptr_t)ret_conv;
15516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15517 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
15518 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15523 if ((_res & 1) != 0) return;
15524 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15525 CHECK_ACCESS(_res_ptr);
15526 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15528 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15531 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15532 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15533 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15534 return (uintptr_t)ret_conv;
15536 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15537 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
15538 intptr_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15543 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
15544 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15545 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15546 return (uintptr_t)ret_conv;
15549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
15550 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15551 *ret_conv = CResult_NoneNoneZ_ok();
15552 return (uintptr_t)ret_conv;
15555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
15556 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15557 *ret_conv = CResult_NoneNoneZ_err();
15558 return (uintptr_t)ret_conv;
15561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15562 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
15563 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
15567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15568 if ((_res & 1) != 0) return;
15569 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15570 CHECK_ACCESS(_res_ptr);
15571 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
15573 CResult_NoneNoneZ_free(_res_conv);
15576 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
15577 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15578 *ret_conv = CResult_NoneNoneZ_clone(arg);
15579 return (uintptr_t)ret_conv;
15581 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15582 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
15583 intptr_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
15587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15588 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
15589 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
15590 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
15591 return (uintptr_t)ret_conv;
15594 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15595 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15596 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15597 return ((uintptr_t)ret_conv);
15599 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15600 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
15601 intptr_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15606 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
15607 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15608 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15609 return ((uintptr_t)ret_conv);
15612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
15613 LDKSignature a_ref;
15614 CHECK((*env)->GetArrayLength(env, a) == 64);
15615 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
15616 LDKCVec_SignatureZ b_constr;
15617 b_constr.datalen = (*env)->GetArrayLength(env, b);
15618 if (b_constr.datalen > 0)
15619 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15621 b_constr.data = NULL;
15622 for (size_t i = 0; i < b_constr.datalen; i++) {
15623 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
15624 LDKSignature b_conv_8_ref;
15625 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
15626 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
15627 b_constr.data[i] = b_conv_8_ref;
15629 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15630 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15631 return ((uintptr_t)ret_conv);
15634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15635 if ((_res & 1) != 0) return;
15636 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15637 CHECK_ACCESS(_res_ptr);
15638 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15640 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15644 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15645 CHECK_ACCESS(o_ptr);
15646 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15647 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
15648 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15649 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15650 return (uintptr_t)ret_conv;
15653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
15654 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15655 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15656 return (uintptr_t)ret_conv;
15659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15660 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
15661 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15666 if ((_res & 1) != 0) return;
15667 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15668 CHECK_ACCESS(_res_ptr);
15669 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15671 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15674 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15675 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15676 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15677 return (uintptr_t)ret_conv;
15679 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15680 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
15681 intptr_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15686 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
15687 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15688 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15689 return (uintptr_t)ret_conv;
15692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15693 LDKSignature o_ref;
15694 CHECK((*env)->GetArrayLength(env, o) == 64);
15695 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
15696 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15697 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15698 return (uintptr_t)ret_conv;
15701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
15702 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15703 *ret_conv = CResult_SignatureNoneZ_err();
15704 return (uintptr_t)ret_conv;
15707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15708 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
15709 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
15713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15714 if ((_res & 1) != 0) return;
15715 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15716 CHECK_ACCESS(_res_ptr);
15717 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15719 CResult_SignatureNoneZ_free(_res_conv);
15722 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15723 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15724 *ret_conv = CResult_SignatureNoneZ_clone(arg);
15725 return (uintptr_t)ret_conv;
15727 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15728 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
15729 intptr_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15734 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
15735 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15736 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15737 return (uintptr_t)ret_conv;
15740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15741 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15742 CHECK_ACCESS(o_ptr);
15743 LDKSign o_conv = *(LDKSign*)(o_ptr);
15744 if (o_conv.free == LDKSign_JCalls_free) {
15745 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15746 LDKSign_JCalls_cloned(&o_conv);
15748 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15749 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15750 return (uintptr_t)ret_conv;
15753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15754 LDKDecodeError e_conv;
15755 e_conv.inner = (void*)(e & (~1));
15756 e_conv.is_owned = (e & 1) || (e == 0);
15757 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15758 e_conv = DecodeError_clone(&e_conv);
15759 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15760 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15761 return (uintptr_t)ret_conv;
15764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15765 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
15766 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
15770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15771 if ((_res & 1) != 0) return;
15772 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15773 CHECK_ACCESS(_res_ptr);
15774 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15776 CResult_SignDecodeErrorZ_free(_res_conv);
15779 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15780 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15781 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15782 return (uintptr_t)ret_conv;
15784 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15785 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
15786 intptr_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15791 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
15792 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15793 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15794 return (uintptr_t)ret_conv;
15797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
15798 LDKCVec_u8Z _res_ref;
15799 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
15800 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15801 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
15802 CVec_u8Z_free(_res_ref);
15805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
15806 LDKRecoverableSignature o_ref;
15807 CHECK((*env)->GetArrayLength(env, o) == 68);
15808 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
15809 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15810 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15811 return (uintptr_t)ret_conv;
15814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
15815 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15816 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15817 return (uintptr_t)ret_conv;
15820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15821 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
15822 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15827 if ((_res & 1) != 0) return;
15828 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15829 CHECK_ACCESS(_res_ptr);
15830 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15832 CResult_RecoverableSignatureNoneZ_free(_res_conv);
15835 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15836 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15837 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15838 return (uintptr_t)ret_conv;
15840 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15841 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
15842 intptr_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15847 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
15848 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15849 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15850 return (uintptr_t)ret_conv;
15853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15854 LDKCVec_CVec_u8ZZ _res_constr;
15855 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15856 if (_res_constr.datalen > 0)
15857 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15859 _res_constr.data = NULL;
15860 for (size_t i = 0; i < _res_constr.datalen; i++) {
15861 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15862 LDKCVec_u8Z _res_conv_8_ref;
15863 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
15864 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
15865 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
15866 _res_constr.data[i] = _res_conv_8_ref;
15868 CVec_CVec_u8ZZ_free(_res_constr);
15871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
15872 LDKCVec_CVec_u8ZZ o_constr;
15873 o_constr.datalen = (*env)->GetArrayLength(env, o);
15874 if (o_constr.datalen > 0)
15875 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15877 o_constr.data = NULL;
15878 for (size_t i = 0; i < o_constr.datalen; i++) {
15879 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
15880 LDKCVec_u8Z o_conv_8_ref;
15881 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
15882 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
15883 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
15884 o_constr.data[i] = o_conv_8_ref;
15886 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15887 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15888 return (uintptr_t)ret_conv;
15891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
15892 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15893 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15894 return (uintptr_t)ret_conv;
15897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15898 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
15899 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15904 if ((_res & 1) != 0) return;
15905 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15906 CHECK_ACCESS(_res_ptr);
15907 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15909 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15912 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15913 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15914 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15915 return (uintptr_t)ret_conv;
15917 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15918 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
15919 intptr_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15924 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
15925 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15926 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15927 return (uintptr_t)ret_conv;
15930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15931 LDKInMemorySigner o_conv;
15932 o_conv.inner = (void*)(o & (~1));
15933 o_conv.is_owned = (o & 1) || (o == 0);
15934 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15935 o_conv = InMemorySigner_clone(&o_conv);
15936 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15937 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15938 return (uintptr_t)ret_conv;
15941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15942 LDKDecodeError e_conv;
15943 e_conv.inner = (void*)(e & (~1));
15944 e_conv.is_owned = (e & 1) || (e == 0);
15945 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15946 e_conv = DecodeError_clone(&e_conv);
15947 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15948 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15949 return (uintptr_t)ret_conv;
15952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15953 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
15954 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15959 if ((_res & 1) != 0) return;
15960 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15961 CHECK_ACCESS(_res_ptr);
15962 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15964 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15967 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15968 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15969 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15970 return (uintptr_t)ret_conv;
15972 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15973 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
15974 intptr_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15979 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
15980 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15981 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15982 return (uintptr_t)ret_conv;
15985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15986 LDKCVec_TxOutZ _res_constr;
15987 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15988 if (_res_constr.datalen > 0)
15989 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15991 _res_constr.data = NULL;
15992 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15993 for (size_t h = 0; h < _res_constr.datalen; h++) {
15994 int64_t _res_conv_7 = _res_vals[h];
15995 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
15996 CHECK_ACCESS(_res_conv_7_ptr);
15997 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15998 FREE((void*)_res_conv_7);
15999 _res_constr.data[h] = _res_conv_7_conv;
16001 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16002 CVec_TxOutZ_free(_res_constr);
16005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16006 LDKTransaction o_ref;
16007 o_ref.datalen = (*env)->GetArrayLength(env, o);
16008 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16009 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
16010 o_ref.data_is_owned = true;
16011 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16012 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16013 return (uintptr_t)ret_conv;
16016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
16017 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16018 *ret_conv = CResult_TransactionNoneZ_err();
16019 return (uintptr_t)ret_conv;
16022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16023 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
16024 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
16028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16029 if ((_res & 1) != 0) return;
16030 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16031 CHECK_ACCESS(_res_ptr);
16032 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16034 CResult_TransactionNoneZ_free(_res_conv);
16037 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16038 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16039 *ret_conv = CResult_TransactionNoneZ_clone(arg);
16040 return (uintptr_t)ret_conv;
16042 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16043 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
16044 intptr_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16049 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
16050 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16051 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16052 return (uintptr_t)ret_conv;
16055 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
16056 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16057 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
16058 return ((uintptr_t)ret_conv);
16060 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16061 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
16062 intptr_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
16066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16067 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
16068 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16069 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
16070 return ((uintptr_t)ret_conv);
16073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
16074 LDKThirtyTwoBytes a_ref;
16075 CHECK((*env)->GetArrayLength(env, a) == 32);
16076 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
16077 LDKChannelMonitor b_conv;
16078 b_conv.inner = (void*)(b & (~1));
16079 b_conv.is_owned = (b & 1) || (b == 0);
16080 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16081 b_conv = ChannelMonitor_clone(&b_conv);
16082 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
16083 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
16084 return ((uintptr_t)ret_conv);
16087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16088 if ((_res & 1) != 0) return;
16089 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16090 CHECK_ACCESS(_res_ptr);
16091 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
16093 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
16096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16097 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
16098 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16099 if (_res_constr.datalen > 0)
16100 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
16102 _res_constr.data = NULL;
16103 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16104 for (size_t j = 0; j < _res_constr.datalen; j++) {
16105 int64_t _res_conv_35 = _res_vals[j];
16106 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
16107 CHECK_ACCESS(_res_conv_35_ptr);
16108 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
16109 FREE((void*)_res_conv_35);
16110 _res_constr.data[j] = _res_conv_35_conv;
16112 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16113 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
16116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
16117 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
16118 o_constr.datalen = (*env)->GetArrayLength(env, o);
16119 if (o_constr.datalen > 0)
16120 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
16122 o_constr.data = NULL;
16123 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
16124 for (size_t j = 0; j < o_constr.datalen; j++) {
16125 int64_t o_conv_35 = o_vals[j];
16126 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
16127 CHECK_ACCESS(o_conv_35_ptr);
16128 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
16129 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
16130 o_constr.data[j] = o_conv_35_conv;
16132 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
16133 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
16134 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
16135 return (uintptr_t)ret_conv;
16138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
16139 LDKIOError e_conv = LDKIOError_from_java(env, e);
16140 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
16141 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
16142 return (uintptr_t)ret_conv;
16145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16146 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
16147 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
16151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16152 if ((_res & 1) != 0) return;
16153 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16154 CHECK_ACCESS(_res_ptr);
16155 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
16157 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
16160 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
16161 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
16162 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
16163 return (uintptr_t)ret_conv;
16165 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16166 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
16167 intptr_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
16171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16172 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
16173 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
16174 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
16175 return (uintptr_t)ret_conv;
16178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
16179 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16180 *ret_copy = COption_u16Z_some(o);
16181 uintptr_t ret_ref = (uintptr_t)ret_copy;
16185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
16186 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16187 *ret_copy = COption_u16Z_none();
16188 uintptr_t ret_ref = (uintptr_t)ret_copy;
16192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
16193 if ((_res & 1) != 0) return;
16194 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16195 CHECK_ACCESS(_res_ptr);
16196 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
16198 COption_u16Z_free(_res_conv);
16201 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
16202 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16203 *ret_copy = COption_u16Z_clone(arg);
16204 uintptr_t ret_ref = (uintptr_t)ret_copy;
16207 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16208 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
16209 intptr_t ret_val = COption_u16Z_clone_ptr(arg_conv);
16213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16214 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
16215 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16216 *ret_copy = COption_u16Z_clone(orig_conv);
16217 uintptr_t ret_ref = (uintptr_t)ret_copy;
16221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
16222 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16223 *ret_conv = CResult_NoneAPIErrorZ_ok();
16224 return (uintptr_t)ret_conv;
16227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16228 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16229 CHECK_ACCESS(e_ptr);
16230 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16231 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16232 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16233 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
16234 return (uintptr_t)ret_conv;
16237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16238 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
16239 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
16243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16244 if ((_res & 1) != 0) return;
16245 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16246 CHECK_ACCESS(_res_ptr);
16247 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
16249 CResult_NoneAPIErrorZ_free(_res_conv);
16252 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
16253 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16254 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
16255 return (uintptr_t)ret_conv;
16257 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16258 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
16259 intptr_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
16263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16264 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
16265 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16266 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
16267 return (uintptr_t)ret_conv;
16270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16271 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
16272 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16273 if (_res_constr.datalen > 0)
16274 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16276 _res_constr.data = NULL;
16277 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16278 for (size_t w = 0; w < _res_constr.datalen; w++) {
16279 int64_t _res_conv_22 = _res_vals[w];
16280 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
16281 CHECK_ACCESS(_res_conv_22_ptr);
16282 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
16283 FREE((void*)_res_conv_22);
16284 _res_constr.data[w] = _res_conv_22_conv;
16286 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16287 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
16290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16291 LDKCVec_APIErrorZ _res_constr;
16292 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16293 if (_res_constr.datalen > 0)
16294 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16296 _res_constr.data = NULL;
16297 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16298 for (size_t k = 0; k < _res_constr.datalen; k++) {
16299 int64_t _res_conv_10 = _res_vals[k];
16300 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
16301 CHECK_ACCESS(_res_conv_10_ptr);
16302 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
16303 FREE((void*)_res_conv_10);
16304 _res_constr.data[k] = _res_conv_10_conv;
16306 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16307 CVec_APIErrorZ_free(_res_constr);
16310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16311 LDKThirtyTwoBytes o_ref;
16312 CHECK((*env)->GetArrayLength(env, o) == 32);
16313 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
16314 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16315 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
16316 return (uintptr_t)ret_conv;
16319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16320 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16321 CHECK_ACCESS(e_ptr);
16322 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16323 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16324 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16325 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
16326 return (uintptr_t)ret_conv;
16329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16330 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
16331 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
16335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16336 if ((_res & 1) != 0) return;
16337 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16338 CHECK_ACCESS(_res_ptr);
16339 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
16341 CResult__u832APIErrorZ_free(_res_conv);
16344 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
16345 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16346 *ret_conv = CResult__u832APIErrorZ_clone(arg);
16347 return (uintptr_t)ret_conv;
16349 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16350 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
16351 intptr_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
16355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16356 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
16357 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16358 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
16359 return (uintptr_t)ret_conv;
16362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16363 LDKThirtyTwoBytes o_ref;
16364 CHECK((*env)->GetArrayLength(env, o) == 32);
16365 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
16366 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
16367 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
16368 return (uintptr_t)ret_conv;
16371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16372 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16373 CHECK_ACCESS(e_ptr);
16374 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16375 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
16376 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
16377 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
16378 return (uintptr_t)ret_conv;
16381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16382 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
16383 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
16387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16388 if ((_res & 1) != 0) return;
16389 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16390 CHECK_ACCESS(_res_ptr);
16391 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
16393 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
16396 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
16397 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
16398 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
16399 return (uintptr_t)ret_conv;
16401 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16402 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
16403 intptr_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
16407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16408 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
16409 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
16410 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
16411 return (uintptr_t)ret_conv;
16414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
16415 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16416 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
16417 return (uintptr_t)ret_conv;
16420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16421 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16422 CHECK_ACCESS(e_ptr);
16423 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16424 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
16425 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16426 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
16427 return (uintptr_t)ret_conv;
16430 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16431 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
16432 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
16436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16437 if ((_res & 1) != 0) return;
16438 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16439 CHECK_ACCESS(_res_ptr);
16440 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16442 CResult_NonePaymentSendFailureZ_free(_res_conv);
16445 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16446 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16447 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16448 return (uintptr_t)ret_conv;
16450 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16451 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
16452 intptr_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16457 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
16458 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16459 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16460 return (uintptr_t)ret_conv;
16463 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16464 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16465 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16466 return ((uintptr_t)ret_conv);
16468 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16469 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
16470 intptr_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16475 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
16476 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16477 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16478 return ((uintptr_t)ret_conv);
16481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
16482 LDKThirtyTwoBytes a_ref;
16483 CHECK((*env)->GetArrayLength(env, a) == 32);
16484 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
16485 LDKThirtyTwoBytes b_ref;
16486 CHECK((*env)->GetArrayLength(env, b) == 32);
16487 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
16488 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16489 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16490 return ((uintptr_t)ret_conv);
16493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16494 if ((_res & 1) != 0) return;
16495 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16496 CHECK_ACCESS(_res_ptr);
16497 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16499 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16503 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16504 CHECK_ACCESS(o_ptr);
16505 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16506 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
16507 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16508 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16509 return (uintptr_t)ret_conv;
16512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16513 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16514 CHECK_ACCESS(e_ptr);
16515 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16516 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
16517 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16518 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16519 return (uintptr_t)ret_conv;
16522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16523 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
16524 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16529 if ((_res & 1) != 0) return;
16530 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16531 CHECK_ACCESS(_res_ptr);
16532 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16534 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16537 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16538 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16539 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16540 return (uintptr_t)ret_conv;
16542 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16543 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
16544 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16549 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
16550 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16551 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16552 return (uintptr_t)ret_conv;
16555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16556 LDKCVec_NetAddressZ _res_constr;
16557 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16558 if (_res_constr.datalen > 0)
16559 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16561 _res_constr.data = NULL;
16562 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16563 for (size_t m = 0; m < _res_constr.datalen; m++) {
16564 int64_t _res_conv_12 = _res_vals[m];
16565 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
16566 CHECK_ACCESS(_res_conv_12_ptr);
16567 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
16568 FREE((void*)_res_conv_12);
16569 _res_constr.data[m] = _res_conv_12_conv;
16571 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16572 CVec_NetAddressZ_free(_res_constr);
16575 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16576 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16577 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16578 return ((uintptr_t)ret_conv);
16580 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16581 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
16582 intptr_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16587 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
16588 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16589 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16590 return ((uintptr_t)ret_conv);
16593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
16594 LDKThirtyTwoBytes a_ref;
16595 CHECK((*env)->GetArrayLength(env, a) == 32);
16596 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
16597 LDKThirtyTwoBytes b_ref;
16598 CHECK((*env)->GetArrayLength(env, b) == 32);
16599 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
16600 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16601 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16602 return ((uintptr_t)ret_conv);
16605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16606 if ((_res & 1) != 0) return;
16607 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16608 CHECK_ACCESS(_res_ptr);
16609 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16611 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16615 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16616 CHECK_ACCESS(o_ptr);
16617 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16618 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
16619 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16620 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16621 return (uintptr_t)ret_conv;
16624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
16625 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16626 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16627 return (uintptr_t)ret_conv;
16630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16631 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
16632 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16637 if ((_res & 1) != 0) return;
16638 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16639 CHECK_ACCESS(_res_ptr);
16640 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16642 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16645 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16646 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16647 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16648 return (uintptr_t)ret_conv;
16650 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16651 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
16652 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16657 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
16658 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16659 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16660 return (uintptr_t)ret_conv;
16663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16664 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16665 CHECK_ACCESS(o_ptr);
16666 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16667 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
16668 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16669 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16670 return (uintptr_t)ret_conv;
16673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16674 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16675 CHECK_ACCESS(e_ptr);
16676 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16677 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16678 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16679 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16680 return (uintptr_t)ret_conv;
16683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16684 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
16685 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16690 if ((_res & 1) != 0) return;
16691 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16692 CHECK_ACCESS(_res_ptr);
16693 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16695 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16698 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16699 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16700 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16701 return (uintptr_t)ret_conv;
16703 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16704 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
16705 intptr_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16710 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
16711 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16712 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16713 return (uintptr_t)ret_conv;
16716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16717 LDKThirtyTwoBytes o_ref;
16718 CHECK((*env)->GetArrayLength(env, o) == 32);
16719 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
16720 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16721 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16722 return (uintptr_t)ret_conv;
16725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
16726 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16727 *ret_conv = CResult_PaymentSecretNoneZ_err();
16728 return (uintptr_t)ret_conv;
16731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16732 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
16733 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16738 if ((_res & 1) != 0) return;
16739 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16740 CHECK_ACCESS(_res_ptr);
16741 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16743 CResult_PaymentSecretNoneZ_free(_res_conv);
16746 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16747 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16748 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16749 return (uintptr_t)ret_conv;
16751 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16752 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
16753 intptr_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16758 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
16759 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16760 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16761 return (uintptr_t)ret_conv;
16764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16765 LDKThirtyTwoBytes o_ref;
16766 CHECK((*env)->GetArrayLength(env, o) == 32);
16767 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
16768 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16769 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16770 return (uintptr_t)ret_conv;
16773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16774 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16775 CHECK_ACCESS(e_ptr);
16776 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16777 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16778 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16779 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16780 return (uintptr_t)ret_conv;
16783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16784 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
16785 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16790 if ((_res & 1) != 0) return;
16791 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16792 CHECK_ACCESS(_res_ptr);
16793 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16795 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16798 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16799 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16800 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16801 return (uintptr_t)ret_conv;
16803 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16804 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
16805 intptr_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16810 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
16811 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16812 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16813 return (uintptr_t)ret_conv;
16816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16817 LDKThirtyTwoBytes o_ref;
16818 CHECK((*env)->GetArrayLength(env, o) == 32);
16819 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
16820 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16821 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16822 return (uintptr_t)ret_conv;
16825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16826 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
16827 CHECK_ACCESS(e_ptr);
16828 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16829 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
16830 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16831 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16832 return (uintptr_t)ret_conv;
16835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16836 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
16837 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16842 if ((_res & 1) != 0) return;
16843 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16844 CHECK_ACCESS(_res_ptr);
16845 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16847 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16850 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16851 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16852 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16853 return (uintptr_t)ret_conv;
16855 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16856 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
16857 intptr_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16862 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
16863 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16864 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16865 return (uintptr_t)ret_conv;
16868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16869 LDKCVec_ChannelMonitorZ _res_constr;
16870 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16871 if (_res_constr.datalen > 0)
16872 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16874 _res_constr.data = NULL;
16875 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16876 for (size_t q = 0; q < _res_constr.datalen; q++) {
16877 int64_t _res_conv_16 = _res_vals[q];
16878 LDKChannelMonitor _res_conv_16_conv;
16879 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
16880 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
16881 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16882 _res_constr.data[q] = _res_conv_16_conv;
16884 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16885 CVec_ChannelMonitorZ_free(_res_constr);
16888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
16889 LDKThirtyTwoBytes a_ref;
16890 CHECK((*env)->GetArrayLength(env, a) == 32);
16891 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
16892 LDKChannelManager b_conv;
16893 b_conv.inner = (void*)(b & (~1));
16894 b_conv.is_owned = (b & 1) || (b == 0);
16895 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16896 // Warning: we need a move here but no clone is available for LDKChannelManager
16897 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16898 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16899 return ((uintptr_t)ret_conv);
16902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16903 if ((_res & 1) != 0) return;
16904 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16905 CHECK_ACCESS(_res_ptr);
16906 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16908 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16912 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16913 CHECK_ACCESS(o_ptr);
16914 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16915 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16916 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16917 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16918 return (uintptr_t)ret_conv;
16921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16922 LDKDecodeError e_conv;
16923 e_conv.inner = (void*)(e & (~1));
16924 e_conv.is_owned = (e & 1) || (e == 0);
16925 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16926 e_conv = DecodeError_clone(&e_conv);
16927 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16928 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16929 return (uintptr_t)ret_conv;
16932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16933 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
16934 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16939 if ((_res & 1) != 0) return;
16940 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16941 CHECK_ACCESS(_res_ptr);
16942 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16944 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16948 LDKChannelConfig o_conv;
16949 o_conv.inner = (void*)(o & (~1));
16950 o_conv.is_owned = (o & 1) || (o == 0);
16951 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16952 o_conv = ChannelConfig_clone(&o_conv);
16953 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16954 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16955 return (uintptr_t)ret_conv;
16958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16959 LDKDecodeError e_conv;
16960 e_conv.inner = (void*)(e & (~1));
16961 e_conv.is_owned = (e & 1) || (e == 0);
16962 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16963 e_conv = DecodeError_clone(&e_conv);
16964 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16965 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16966 return (uintptr_t)ret_conv;
16969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16970 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
16971 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16976 if ((_res & 1) != 0) return;
16977 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16978 CHECK_ACCESS(_res_ptr);
16979 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16981 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16984 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16985 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16986 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16987 return (uintptr_t)ret_conv;
16989 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16990 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
16991 intptr_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16996 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
16997 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16998 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16999 return (uintptr_t)ret_conv;
17002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17003 LDKOutPoint o_conv;
17004 o_conv.inner = (void*)(o & (~1));
17005 o_conv.is_owned = (o & 1) || (o == 0);
17006 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17007 o_conv = OutPoint_clone(&o_conv);
17008 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17009 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
17010 return (uintptr_t)ret_conv;
17013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17014 LDKDecodeError e_conv;
17015 e_conv.inner = (void*)(e & (~1));
17016 e_conv.is_owned = (e & 1) || (e == 0);
17017 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17018 e_conv = DecodeError_clone(&e_conv);
17019 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17020 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
17021 return (uintptr_t)ret_conv;
17024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17025 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
17026 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
17030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17031 if ((_res & 1) != 0) return;
17032 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17033 CHECK_ACCESS(_res_ptr);
17034 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
17036 CResult_OutPointDecodeErrorZ_free(_res_conv);
17039 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
17040 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17041 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
17042 return (uintptr_t)ret_conv;
17044 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17045 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
17046 intptr_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
17050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17051 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
17052 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17053 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
17054 return (uintptr_t)ret_conv;
17057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17058 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17059 CHECK_ACCESS(o_ptr);
17060 LDKType o_conv = *(LDKType*)(o_ptr);
17061 if (o_conv.free == LDKType_JCalls_free) {
17062 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17063 LDKType_JCalls_cloned(&o_conv);
17065 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17066 *ret_copy = COption_TypeZ_some(o_conv);
17067 uintptr_t ret_ref = (uintptr_t)ret_copy;
17071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
17072 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17073 *ret_copy = COption_TypeZ_none();
17074 uintptr_t ret_ref = (uintptr_t)ret_copy;
17078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17079 if ((_res & 1) != 0) return;
17080 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17081 CHECK_ACCESS(_res_ptr);
17082 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
17084 COption_TypeZ_free(_res_conv);
17087 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
17088 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17089 *ret_copy = COption_TypeZ_clone(arg);
17090 uintptr_t ret_ref = (uintptr_t)ret_copy;
17093 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17094 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
17095 intptr_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
17099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17100 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
17101 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17102 *ret_copy = COption_TypeZ_clone(orig_conv);
17103 uintptr_t ret_ref = (uintptr_t)ret_copy;
17107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17108 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17109 CHECK_ACCESS(o_ptr);
17110 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
17111 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
17112 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17113 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
17114 return (uintptr_t)ret_conv;
17117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17118 LDKDecodeError e_conv;
17119 e_conv.inner = (void*)(e & (~1));
17120 e_conv.is_owned = (e & 1) || (e == 0);
17121 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17122 e_conv = DecodeError_clone(&e_conv);
17123 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17124 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
17125 return (uintptr_t)ret_conv;
17128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17129 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
17130 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
17134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17135 if ((_res & 1) != 0) return;
17136 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17137 CHECK_ACCESS(_res_ptr);
17138 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
17140 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
17143 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
17144 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17145 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
17146 return (uintptr_t)ret_conv;
17148 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17149 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
17150 intptr_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
17154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17155 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
17156 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17157 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
17158 return (uintptr_t)ret_conv;
17161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17162 LDKThirtyTwoBytes o_ref;
17163 CHECK((*env)->GetArrayLength(env, o) == 32);
17164 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17165 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17166 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
17167 return (uintptr_t)ret_conv;
17170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17171 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17172 CHECK_ACCESS(e_ptr);
17173 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17174 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
17175 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17176 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
17177 return (uintptr_t)ret_conv;
17180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17181 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
17182 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
17186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17187 if ((_res & 1) != 0) return;
17188 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17189 CHECK_ACCESS(_res_ptr);
17190 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
17192 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
17195 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
17196 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17197 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
17198 return (uintptr_t)ret_conv;
17200 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17201 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
17202 intptr_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
17206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17207 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
17208 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17209 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
17210 return (uintptr_t)ret_conv;
17213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
17214 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
17215 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
17216 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
17217 return (uintptr_t)ret_conv;
17220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
17221 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
17222 *ret_conv = CResult_SiPrefixNoneZ_err();
17223 return (uintptr_t)ret_conv;
17226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17227 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
17228 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
17232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17233 if ((_res & 1) != 0) return;
17234 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17235 CHECK_ACCESS(_res_ptr);
17236 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
17238 CResult_SiPrefixNoneZ_free(_res_conv);
17241 static inline uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
17242 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
17243 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
17244 return (uintptr_t)ret_conv;
17246 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17247 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
17248 intptr_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
17252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17253 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
17254 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
17255 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
17256 return (uintptr_t)ret_conv;
17259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17261 o_conv.inner = (void*)(o & (~1));
17262 o_conv.is_owned = (o & 1) || (o == 0);
17263 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17264 o_conv = Invoice_clone(&o_conv);
17265 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
17266 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
17267 return (uintptr_t)ret_conv;
17270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
17271 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
17272 *ret_conv = CResult_InvoiceNoneZ_err();
17273 return (uintptr_t)ret_conv;
17276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17277 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
17278 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
17282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17283 if ((_res & 1) != 0) return;
17284 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17285 CHECK_ACCESS(_res_ptr);
17286 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
17288 CResult_InvoiceNoneZ_free(_res_conv);
17291 static inline uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
17292 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
17293 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
17294 return (uintptr_t)ret_conv;
17296 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17297 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
17298 intptr_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
17302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17303 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
17304 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
17305 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
17306 return (uintptr_t)ret_conv;
17309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17310 LDKSignedRawInvoice o_conv;
17311 o_conv.inner = (void*)(o & (~1));
17312 o_conv.is_owned = (o & 1) || (o == 0);
17313 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17314 o_conv = SignedRawInvoice_clone(&o_conv);
17315 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
17316 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
17317 return (uintptr_t)ret_conv;
17320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
17321 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
17322 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
17323 return (uintptr_t)ret_conv;
17326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17327 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
17328 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
17332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17333 if ((_res & 1) != 0) return;
17334 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17335 CHECK_ACCESS(_res_ptr);
17336 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
17338 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
17341 static inline uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
17342 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
17343 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
17344 return (uintptr_t)ret_conv;
17346 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17347 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
17348 intptr_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
17352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17353 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
17354 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
17355 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
17356 return (uintptr_t)ret_conv;
17359 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
17360 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17361 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
17362 return ((uintptr_t)ret_conv);
17364 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17365 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
17366 intptr_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
17370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17371 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
17372 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17373 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
17374 return ((uintptr_t)ret_conv);
17377 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) {
17378 LDKRawInvoice a_conv;
17379 a_conv.inner = (void*)(a & (~1));
17380 a_conv.is_owned = (a & 1) || (a == 0);
17381 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17382 a_conv = RawInvoice_clone(&a_conv);
17383 LDKThirtyTwoBytes b_ref;
17384 CHECK((*env)->GetArrayLength(env, b) == 32);
17385 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17386 LDKInvoiceSignature c_conv;
17387 c_conv.inner = (void*)(c & (~1));
17388 c_conv.is_owned = (c & 1) || (c == 0);
17389 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17390 c_conv = InvoiceSignature_clone(&c_conv);
17391 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17392 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
17393 return ((uintptr_t)ret_conv);
17396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17397 if ((_res & 1) != 0) return;
17398 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17399 CHECK_ACCESS(_res_ptr);
17400 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
17402 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
17405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17406 LDKPayeePubKey o_conv;
17407 o_conv.inner = (void*)(o & (~1));
17408 o_conv.is_owned = (o & 1) || (o == 0);
17409 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17410 o_conv = PayeePubKey_clone(&o_conv);
17411 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17412 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
17413 return (uintptr_t)ret_conv;
17416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17417 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
17418 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17419 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
17420 return (uintptr_t)ret_conv;
17423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17424 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
17425 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
17429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17430 if ((_res & 1) != 0) return;
17431 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17432 CHECK_ACCESS(_res_ptr);
17433 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
17435 CResult_PayeePubKeyErrorZ_free(_res_conv);
17438 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
17439 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17440 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
17441 return (uintptr_t)ret_conv;
17443 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17444 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
17445 intptr_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
17449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17450 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
17451 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17452 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
17453 return (uintptr_t)ret_conv;
17456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17457 LDKCVec_PrivateRouteZ _res_constr;
17458 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17459 if (_res_constr.datalen > 0)
17460 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
17462 _res_constr.data = NULL;
17463 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17464 for (size_t o = 0; o < _res_constr.datalen; o++) {
17465 int64_t _res_conv_14 = _res_vals[o];
17466 LDKPrivateRoute _res_conv_14_conv;
17467 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
17468 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
17469 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17470 _res_constr.data[o] = _res_conv_14_conv;
17472 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17473 CVec_PrivateRouteZ_free(_res_constr);
17476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17477 LDKPositiveTimestamp o_conv;
17478 o_conv.inner = (void*)(o & (~1));
17479 o_conv.is_owned = (o & 1) || (o == 0);
17480 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17481 o_conv = PositiveTimestamp_clone(&o_conv);
17482 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17483 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
17484 return (uintptr_t)ret_conv;
17487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17488 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
17489 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17490 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
17491 return (uintptr_t)ret_conv;
17494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17495 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
17496 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
17500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17501 if ((_res & 1) != 0) return;
17502 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17503 CHECK_ACCESS(_res_ptr);
17504 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
17506 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
17509 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
17510 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17511 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
17512 return (uintptr_t)ret_conv;
17514 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17515 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
17516 intptr_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
17520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17521 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
17522 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17523 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
17524 return (uintptr_t)ret_conv;
17527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
17528 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17529 *ret_conv = CResult_NoneSemanticErrorZ_ok();
17530 return (uintptr_t)ret_conv;
17533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17534 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
17535 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17536 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
17537 return (uintptr_t)ret_conv;
17540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17541 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
17542 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
17546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17547 if ((_res & 1) != 0) return;
17548 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17549 CHECK_ACCESS(_res_ptr);
17550 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
17552 CResult_NoneSemanticErrorZ_free(_res_conv);
17555 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
17556 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17557 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
17558 return (uintptr_t)ret_conv;
17560 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17561 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
17562 intptr_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
17566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17567 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
17568 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17569 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
17570 return (uintptr_t)ret_conv;
17573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17575 o_conv.inner = (void*)(o & (~1));
17576 o_conv.is_owned = (o & 1) || (o == 0);
17577 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17578 o_conv = Invoice_clone(&o_conv);
17579 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17580 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
17581 return (uintptr_t)ret_conv;
17584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17585 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
17586 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17587 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
17588 return (uintptr_t)ret_conv;
17591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17592 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
17593 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
17597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17598 if ((_res & 1) != 0) return;
17599 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17600 CHECK_ACCESS(_res_ptr);
17601 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
17603 CResult_InvoiceSemanticErrorZ_free(_res_conv);
17606 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
17607 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17608 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
17609 return (uintptr_t)ret_conv;
17611 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17612 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
17613 intptr_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
17617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17618 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
17619 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17620 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
17621 return (uintptr_t)ret_conv;
17624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17625 LDKDescription o_conv;
17626 o_conv.inner = (void*)(o & (~1));
17627 o_conv.is_owned = (o & 1) || (o == 0);
17628 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17629 o_conv = Description_clone(&o_conv);
17630 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17631 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
17632 return (uintptr_t)ret_conv;
17635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17636 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
17637 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17638 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
17639 return (uintptr_t)ret_conv;
17642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17643 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
17644 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
17648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17649 if ((_res & 1) != 0) return;
17650 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17651 CHECK_ACCESS(_res_ptr);
17652 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
17654 CResult_DescriptionCreationErrorZ_free(_res_conv);
17657 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
17658 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17659 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
17660 return (uintptr_t)ret_conv;
17662 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17663 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
17664 intptr_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
17668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17669 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
17670 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17671 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
17672 return (uintptr_t)ret_conv;
17675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17676 LDKExpiryTime o_conv;
17677 o_conv.inner = (void*)(o & (~1));
17678 o_conv.is_owned = (o & 1) || (o == 0);
17679 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17680 o_conv = ExpiryTime_clone(&o_conv);
17681 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
17682 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
17683 return (uintptr_t)ret_conv;
17686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17687 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
17688 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
17689 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
17690 return (uintptr_t)ret_conv;
17693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17694 LDKCResult_ExpiryTimeCreationErrorZ* o_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(o & ~1);
17695 jboolean ret_val = CResult_ExpiryTimeCreationErrorZ_is_ok(o_conv);
17699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17700 if ((_res & 1) != 0) return;
17701 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17702 CHECK_ACCESS(_res_ptr);
17703 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(_res_ptr);
17705 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
17708 static inline uintptr_t CResult_ExpiryTimeCreationErrorZ_clone_ptr(LDKCResult_ExpiryTimeCreationErrorZ *NONNULL_PTR arg) {
17709 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
17710 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(arg);
17711 return (uintptr_t)ret_conv;
17713 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17714 LDKCResult_ExpiryTimeCreationErrorZ* arg_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
17715 intptr_t ret_val = CResult_ExpiryTimeCreationErrorZ_clone_ptr(arg_conv);
17719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17720 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
17721 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
17722 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
17723 return (uintptr_t)ret_conv;
17726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17727 LDKPrivateRoute o_conv;
17728 o_conv.inner = (void*)(o & (~1));
17729 o_conv.is_owned = (o & 1) || (o == 0);
17730 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17731 o_conv = PrivateRoute_clone(&o_conv);
17732 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17733 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
17734 return (uintptr_t)ret_conv;
17737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17738 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
17739 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17740 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
17741 return (uintptr_t)ret_conv;
17744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17745 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
17746 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
17750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17751 if ((_res & 1) != 0) return;
17752 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17753 CHECK_ACCESS(_res_ptr);
17754 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
17756 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
17759 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
17760 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17761 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
17762 return (uintptr_t)ret_conv;
17764 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17765 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
17766 intptr_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
17770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17771 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
17772 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17773 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
17774 return (uintptr_t)ret_conv;
17777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
17778 LDKStr o_conv = java_to_owned_str(env, o);
17779 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17780 *ret_conv = CResult_StringErrorZ_ok(o_conv);
17781 return (uintptr_t)ret_conv;
17784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17785 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
17786 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17787 *ret_conv = CResult_StringErrorZ_err(e_conv);
17788 return (uintptr_t)ret_conv;
17791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17792 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
17793 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
17797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17798 if ((_res & 1) != 0) return;
17799 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17800 CHECK_ACCESS(_res_ptr);
17801 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17803 CResult_StringErrorZ_free(_res_conv);
17806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17807 LDKChannelMonitorUpdate o_conv;
17808 o_conv.inner = (void*)(o & (~1));
17809 o_conv.is_owned = (o & 1) || (o == 0);
17810 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17811 o_conv = ChannelMonitorUpdate_clone(&o_conv);
17812 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17813 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17814 return (uintptr_t)ret_conv;
17817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17818 LDKDecodeError e_conv;
17819 e_conv.inner = (void*)(e & (~1));
17820 e_conv.is_owned = (e & 1) || (e == 0);
17821 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17822 e_conv = DecodeError_clone(&e_conv);
17823 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17824 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17825 return (uintptr_t)ret_conv;
17828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17829 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
17830 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17835 if ((_res & 1) != 0) return;
17836 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17837 CHECK_ACCESS(_res_ptr);
17838 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17840 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17843 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17844 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17845 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17846 return (uintptr_t)ret_conv;
17848 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17849 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
17850 intptr_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17855 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
17856 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17857 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17858 return (uintptr_t)ret_conv;
17861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
17862 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17863 CHECK_ACCESS(o_ptr);
17864 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17865 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
17866 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17867 *ret_copy = COption_MonitorEventZ_some(o_conv);
17868 uintptr_t ret_ref = (uintptr_t)ret_copy;
17872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
17873 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17874 *ret_copy = COption_MonitorEventZ_none();
17875 uintptr_t ret_ref = (uintptr_t)ret_copy;
17879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17880 if ((_res & 1) != 0) return;
17881 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17882 CHECK_ACCESS(_res_ptr);
17883 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17885 COption_MonitorEventZ_free(_res_conv);
17888 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17889 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17890 *ret_copy = COption_MonitorEventZ_clone(arg);
17891 uintptr_t ret_ref = (uintptr_t)ret_copy;
17894 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17895 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
17896 intptr_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
17900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17901 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
17902 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17903 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17904 uintptr_t ret_ref = (uintptr_t)ret_copy;
17908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17909 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17910 CHECK_ACCESS(o_ptr);
17911 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17912 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
17913 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17914 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17915 return (uintptr_t)ret_conv;
17918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17919 LDKDecodeError e_conv;
17920 e_conv.inner = (void*)(e & (~1));
17921 e_conv.is_owned = (e & 1) || (e == 0);
17922 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17923 e_conv = DecodeError_clone(&e_conv);
17924 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17925 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17926 return (uintptr_t)ret_conv;
17929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17930 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
17931 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17936 if ((_res & 1) != 0) return;
17937 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17938 CHECK_ACCESS(_res_ptr);
17939 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17941 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17944 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17945 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17946 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17947 return (uintptr_t)ret_conv;
17949 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17950 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
17951 intptr_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17956 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
17957 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17958 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17959 return (uintptr_t)ret_conv;
17962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17963 LDKHTLCUpdate o_conv;
17964 o_conv.inner = (void*)(o & (~1));
17965 o_conv.is_owned = (o & 1) || (o == 0);
17966 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17967 o_conv = HTLCUpdate_clone(&o_conv);
17968 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17969 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17970 return (uintptr_t)ret_conv;
17973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17974 LDKDecodeError e_conv;
17975 e_conv.inner = (void*)(e & (~1));
17976 e_conv.is_owned = (e & 1) || (e == 0);
17977 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17978 e_conv = DecodeError_clone(&e_conv);
17979 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17980 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17981 return (uintptr_t)ret_conv;
17984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17985 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
17986 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17991 if ((_res & 1) != 0) return;
17992 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17993 CHECK_ACCESS(_res_ptr);
17994 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17996 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17999 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
18000 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18001 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
18002 return (uintptr_t)ret_conv;
18004 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18005 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
18006 intptr_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
18010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18011 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
18012 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
18013 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
18014 return (uintptr_t)ret_conv;
18017 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
18018 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18019 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
18020 return ((uintptr_t)ret_conv);
18022 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18023 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
18024 intptr_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
18028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18029 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
18030 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18031 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
18032 return ((uintptr_t)ret_conv);
18035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
18036 LDKOutPoint a_conv;
18037 a_conv.inner = (void*)(a & (~1));
18038 a_conv.is_owned = (a & 1) || (a == 0);
18039 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18040 a_conv = OutPoint_clone(&a_conv);
18042 b_ref.datalen = (*env)->GetArrayLength(env, b);
18043 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18044 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
18045 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
18046 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
18047 return ((uintptr_t)ret_conv);
18050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18051 if ((_res & 1) != 0) return;
18052 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18053 CHECK_ACCESS(_res_ptr);
18054 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
18056 C2Tuple_OutPointScriptZ_free(_res_conv);
18059 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
18060 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18061 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18062 return ((uintptr_t)ret_conv);
18064 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18065 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
18066 intptr_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18071 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
18072 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18073 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18074 return ((uintptr_t)ret_conv);
18077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
18079 b_ref.datalen = (*env)->GetArrayLength(env, b);
18080 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18081 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
18082 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18083 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18084 return ((uintptr_t)ret_conv);
18087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18088 if ((_res & 1) != 0) return;
18089 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18090 CHECK_ACCESS(_res_ptr);
18091 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18093 C2Tuple_u32ScriptZ_free(_res_conv);
18096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18097 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18098 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18099 if (_res_constr.datalen > 0)
18100 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18102 _res_constr.data = NULL;
18103 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18104 for (size_t v = 0; v < _res_constr.datalen; v++) {
18105 int64_t _res_conv_21 = _res_vals[v];
18106 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
18107 CHECK_ACCESS(_res_conv_21_ptr);
18108 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18109 FREE((void*)_res_conv_21);
18110 _res_constr.data[v] = _res_conv_21_conv;
18112 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18113 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18116 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18117 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18118 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18119 return ((uintptr_t)ret_conv);
18121 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18122 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
18123 intptr_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18128 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
18129 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18130 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18131 return ((uintptr_t)ret_conv);
18134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
18135 LDKThirtyTwoBytes a_ref;
18136 CHECK((*env)->GetArrayLength(env, a) == 32);
18137 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18138 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18139 b_constr.datalen = (*env)->GetArrayLength(env, b);
18140 if (b_constr.datalen > 0)
18141 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18143 b_constr.data = NULL;
18144 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
18145 for (size_t v = 0; v < b_constr.datalen; v++) {
18146 int64_t b_conv_21 = b_vals[v];
18147 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
18148 CHECK_ACCESS(b_conv_21_ptr);
18149 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18150 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
18151 b_constr.data[v] = b_conv_21_conv;
18153 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
18154 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18155 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18156 return ((uintptr_t)ret_conv);
18159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18160 if ((_res & 1) != 0) return;
18161 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18162 CHECK_ACCESS(_res_ptr);
18163 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18165 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18169 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18170 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18171 if (_res_constr.datalen > 0)
18172 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18174 _res_constr.data = NULL;
18175 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18176 for (size_t o = 0; o < _res_constr.datalen; o++) {
18177 int64_t _res_conv_40 = _res_vals[o];
18178 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
18179 CHECK_ACCESS(_res_conv_40_ptr);
18180 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18181 FREE((void*)_res_conv_40);
18182 _res_constr.data[o] = _res_conv_40_conv;
18184 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18185 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18189 LDKCVec_EventZ _res_constr;
18190 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18191 if (_res_constr.datalen > 0)
18192 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18194 _res_constr.data = NULL;
18195 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18196 for (size_t h = 0; h < _res_constr.datalen; h++) {
18197 int64_t _res_conv_7 = _res_vals[h];
18198 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
18199 CHECK_ACCESS(_res_conv_7_ptr);
18200 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18201 FREE((void*)_res_conv_7);
18202 _res_constr.data[h] = _res_conv_7_conv;
18204 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18205 CVec_EventZ_free(_res_constr);
18208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18209 LDKCVec_TransactionZ _res_constr;
18210 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18211 if (_res_constr.datalen > 0)
18212 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18214 _res_constr.data = NULL;
18215 for (size_t i = 0; i < _res_constr.datalen; i++) {
18216 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18217 LDKTransaction _res_conv_8_ref;
18218 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
18219 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
18220 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
18221 _res_conv_8_ref.data_is_owned = true;
18222 _res_constr.data[i] = _res_conv_8_ref;
18224 CVec_TransactionZ_free(_res_constr);
18227 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18228 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18229 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18230 return ((uintptr_t)ret_conv);
18232 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18233 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
18234 intptr_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18239 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
18240 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18241 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18242 return ((uintptr_t)ret_conv);
18245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
18246 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
18247 CHECK_ACCESS(b_ptr);
18248 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18249 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
18250 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18251 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18252 return ((uintptr_t)ret_conv);
18255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18256 if ((_res & 1) != 0) return;
18257 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18258 CHECK_ACCESS(_res_ptr);
18259 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18261 C2Tuple_u32TxOutZ_free(_res_conv);
18264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18265 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18266 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18267 if (_res_constr.datalen > 0)
18268 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18270 _res_constr.data = NULL;
18271 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18272 for (size_t u = 0; u < _res_constr.datalen; u++) {
18273 int64_t _res_conv_20 = _res_vals[u];
18274 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
18275 CHECK_ACCESS(_res_conv_20_ptr);
18276 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18277 FREE((void*)_res_conv_20);
18278 _res_constr.data[u] = _res_conv_20_conv;
18280 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18281 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18284 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18285 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18286 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18287 return ((uintptr_t)ret_conv);
18289 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18290 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
18291 intptr_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18296 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
18297 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18298 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18299 return ((uintptr_t)ret_conv);
18302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
18303 LDKThirtyTwoBytes a_ref;
18304 CHECK((*env)->GetArrayLength(env, a) == 32);
18305 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18306 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18307 b_constr.datalen = (*env)->GetArrayLength(env, b);
18308 if (b_constr.datalen > 0)
18309 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18311 b_constr.data = NULL;
18312 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
18313 for (size_t u = 0; u < b_constr.datalen; u++) {
18314 int64_t b_conv_20 = b_vals[u];
18315 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
18316 CHECK_ACCESS(b_conv_20_ptr);
18317 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18318 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
18319 b_constr.data[u] = b_conv_20_conv;
18321 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
18322 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18323 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18324 return ((uintptr_t)ret_conv);
18327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18328 if ((_res & 1) != 0) return;
18329 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18330 CHECK_ACCESS(_res_ptr);
18331 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18333 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18337 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18338 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18339 if (_res_constr.datalen > 0)
18340 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18342 _res_constr.data = NULL;
18343 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18344 for (size_t n = 0; n < _res_constr.datalen; n++) {
18345 int64_t _res_conv_39 = _res_vals[n];
18346 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
18347 CHECK_ACCESS(_res_conv_39_ptr);
18348 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18349 FREE((void*)_res_conv_39);
18350 _res_constr.data[n] = _res_conv_39_conv;
18352 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18353 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18357 LDKCVec_BalanceZ _res_constr;
18358 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18359 if (_res_constr.datalen > 0)
18360 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18362 _res_constr.data = NULL;
18363 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18364 for (size_t j = 0; j < _res_constr.datalen; j++) {
18365 int64_t _res_conv_9 = _res_vals[j];
18366 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
18367 CHECK_ACCESS(_res_conv_9_ptr);
18368 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18369 FREE((void*)_res_conv_9);
18370 _res_constr.data[j] = _res_conv_9_conv;
18372 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18373 CVec_BalanceZ_free(_res_constr);
18376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18377 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18378 CHECK_ACCESS(o_ptr);
18379 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18380 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
18381 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18382 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18383 return (uintptr_t)ret_conv;
18386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18387 LDKDecodeError e_conv;
18388 e_conv.inner = (void*)(e & (~1));
18389 e_conv.is_owned = (e & 1) || (e == 0);
18390 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18391 e_conv = DecodeError_clone(&e_conv);
18392 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18393 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18394 return (uintptr_t)ret_conv;
18397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18398 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
18399 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18404 if ((_res & 1) != 0) return;
18405 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18406 CHECK_ACCESS(_res_ptr);
18407 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18409 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18412 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18413 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18414 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18415 return (uintptr_t)ret_conv;
18417 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18418 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
18419 intptr_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18424 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
18425 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18426 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18427 return (uintptr_t)ret_conv;
18430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
18431 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18432 *ret_conv = CResult_NoneLightningErrorZ_ok();
18433 return (uintptr_t)ret_conv;
18436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18437 LDKLightningError e_conv;
18438 e_conv.inner = (void*)(e & (~1));
18439 e_conv.is_owned = (e & 1) || (e == 0);
18440 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18441 e_conv = LightningError_clone(&e_conv);
18442 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18443 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
18444 return (uintptr_t)ret_conv;
18447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18448 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
18449 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
18453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18454 if ((_res & 1) != 0) return;
18455 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18456 CHECK_ACCESS(_res_ptr);
18457 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
18459 CResult_NoneLightningErrorZ_free(_res_conv);
18462 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
18463 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18464 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
18465 return (uintptr_t)ret_conv;
18467 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18468 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
18469 intptr_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
18473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18474 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
18475 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
18476 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
18477 return (uintptr_t)ret_conv;
18480 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18481 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18482 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18483 return ((uintptr_t)ret_conv);
18485 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18486 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
18487 intptr_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18492 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
18493 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18494 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18495 return ((uintptr_t)ret_conv);
18498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18499 LDKPublicKey a_ref;
18500 CHECK((*env)->GetArrayLength(env, a) == 33);
18501 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
18502 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
18503 CHECK_ACCESS(b_ptr);
18504 LDKType b_conv = *(LDKType*)(b_ptr);
18505 if (b_conv.free == LDKType_JCalls_free) {
18506 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18507 LDKType_JCalls_cloned(&b_conv);
18509 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18510 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18511 return ((uintptr_t)ret_conv);
18514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18515 if ((_res & 1) != 0) return;
18516 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18517 CHECK_ACCESS(_res_ptr);
18518 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18520 C2Tuple_PublicKeyTypeZ_free(_res_conv);
18523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18524 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18525 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18526 if (_res_constr.datalen > 0)
18527 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18529 _res_constr.data = NULL;
18530 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18531 for (size_t z = 0; z < _res_constr.datalen; z++) {
18532 int64_t _res_conv_25 = _res_vals[z];
18533 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
18534 CHECK_ACCESS(_res_conv_25_ptr);
18535 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18536 FREE((void*)_res_conv_25);
18537 _res_constr.data[z] = _res_conv_25_conv;
18539 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18540 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
18544 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18545 *ret_conv = CResult_boolLightningErrorZ_ok(o);
18546 return (uintptr_t)ret_conv;
18549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18550 LDKLightningError e_conv;
18551 e_conv.inner = (void*)(e & (~1));
18552 e_conv.is_owned = (e & 1) || (e == 0);
18553 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18554 e_conv = LightningError_clone(&e_conv);
18555 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18556 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
18557 return (uintptr_t)ret_conv;
18560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18561 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
18562 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
18566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18567 if ((_res & 1) != 0) return;
18568 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18569 CHECK_ACCESS(_res_ptr);
18570 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
18572 CResult_boolLightningErrorZ_free(_res_conv);
18575 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
18576 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18577 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
18578 return (uintptr_t)ret_conv;
18580 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18581 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
18582 intptr_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
18586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18587 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
18588 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
18589 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
18590 return (uintptr_t)ret_conv;
18593 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
18594 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
18595 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
18596 return ((uintptr_t)ret_conv);
18598 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18599 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
18600 intptr_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
18604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18605 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
18606 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
18607 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
18608 return ((uintptr_t)ret_conv);
18611 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) {
18612 LDKChannelAnnouncement a_conv;
18613 a_conv.inner = (void*)(a & (~1));
18614 a_conv.is_owned = (a & 1) || (a == 0);
18615 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18616 a_conv = ChannelAnnouncement_clone(&a_conv);
18617 LDKChannelUpdate b_conv;
18618 b_conv.inner = (void*)(b & (~1));
18619 b_conv.is_owned = (b & 1) || (b == 0);
18620 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18621 b_conv = ChannelUpdate_clone(&b_conv);
18622 LDKChannelUpdate c_conv;
18623 c_conv.inner = (void*)(c & (~1));
18624 c_conv.is_owned = (c & 1) || (c == 0);
18625 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
18626 c_conv = ChannelUpdate_clone(&c_conv);
18627 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
18628 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
18629 return ((uintptr_t)ret_conv);
18632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18633 if ((_res & 1) != 0) return;
18634 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18635 CHECK_ACCESS(_res_ptr);
18636 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
18638 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
18641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18642 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
18643 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18644 if (_res_constr.datalen > 0)
18645 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
18647 _res_constr.data = NULL;
18648 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18649 for (size_t h = 0; h < _res_constr.datalen; h++) {
18650 int64_t _res_conv_59 = _res_vals[h];
18651 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
18652 CHECK_ACCESS(_res_conv_59_ptr);
18653 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
18654 FREE((void*)_res_conv_59);
18655 _res_constr.data[h] = _res_conv_59_conv;
18657 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18658 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
18661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18662 LDKCVec_NodeAnnouncementZ _res_constr;
18663 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18664 if (_res_constr.datalen > 0)
18665 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
18667 _res_constr.data = NULL;
18668 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18669 for (size_t s = 0; s < _res_constr.datalen; s++) {
18670 int64_t _res_conv_18 = _res_vals[s];
18671 LDKNodeAnnouncement _res_conv_18_conv;
18672 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
18673 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
18674 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
18675 _res_constr.data[s] = _res_conv_18_conv;
18677 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18678 CVec_NodeAnnouncementZ_free(_res_constr);
18681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
18682 LDKCVec_PublicKeyZ _res_constr;
18683 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18684 if (_res_constr.datalen > 0)
18685 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
18687 _res_constr.data = NULL;
18688 for (size_t i = 0; i < _res_constr.datalen; i++) {
18689 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
18690 LDKPublicKey _res_conv_8_ref;
18691 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
18692 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
18693 _res_constr.data[i] = _res_conv_8_ref;
18695 CVec_PublicKeyZ_free(_res_constr);
18698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18700 o_ref.datalen = (*env)->GetArrayLength(env, o);
18701 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18702 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
18703 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18704 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18705 return (uintptr_t)ret_conv;
18708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18709 LDKPeerHandleError e_conv;
18710 e_conv.inner = (void*)(e & (~1));
18711 e_conv.is_owned = (e & 1) || (e == 0);
18712 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18713 e_conv = PeerHandleError_clone(&e_conv);
18714 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18715 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18716 return (uintptr_t)ret_conv;
18719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18720 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
18721 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18726 if ((_res & 1) != 0) return;
18727 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18728 CHECK_ACCESS(_res_ptr);
18729 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18731 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18734 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18735 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18736 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18737 return (uintptr_t)ret_conv;
18739 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18740 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
18741 intptr_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18746 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
18747 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18748 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18749 return (uintptr_t)ret_conv;
18752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
18753 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18754 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18755 return (uintptr_t)ret_conv;
18758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18759 LDKPeerHandleError e_conv;
18760 e_conv.inner = (void*)(e & (~1));
18761 e_conv.is_owned = (e & 1) || (e == 0);
18762 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18763 e_conv = PeerHandleError_clone(&e_conv);
18764 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18765 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18766 return (uintptr_t)ret_conv;
18769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18770 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
18771 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18776 if ((_res & 1) != 0) return;
18777 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18778 CHECK_ACCESS(_res_ptr);
18779 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18781 CResult_NonePeerHandleErrorZ_free(_res_conv);
18784 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18785 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18786 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18787 return (uintptr_t)ret_conv;
18789 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18790 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
18791 intptr_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18796 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
18797 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18798 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18799 return (uintptr_t)ret_conv;
18802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
18803 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18804 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18805 return (uintptr_t)ret_conv;
18808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18809 LDKPeerHandleError e_conv;
18810 e_conv.inner = (void*)(e & (~1));
18811 e_conv.is_owned = (e & 1) || (e == 0);
18812 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18813 e_conv = PeerHandleError_clone(&e_conv);
18814 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18815 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18816 return (uintptr_t)ret_conv;
18819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18820 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
18821 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18826 if ((_res & 1) != 0) return;
18827 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18828 CHECK_ACCESS(_res_ptr);
18829 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18831 CResult_boolPeerHandleErrorZ_free(_res_conv);
18834 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18835 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18836 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18837 return (uintptr_t)ret_conv;
18839 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18840 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
18841 intptr_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18846 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
18847 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18848 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18849 return (uintptr_t)ret_conv;
18852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18854 o_conv.inner = (void*)(o & (~1));
18855 o_conv.is_owned = (o & 1) || (o == 0);
18856 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18857 o_conv = NodeId_clone(&o_conv);
18858 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18859 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
18860 return (uintptr_t)ret_conv;
18863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18864 LDKDecodeError e_conv;
18865 e_conv.inner = (void*)(e & (~1));
18866 e_conv.is_owned = (e & 1) || (e == 0);
18867 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18868 e_conv = DecodeError_clone(&e_conv);
18869 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18870 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
18871 return (uintptr_t)ret_conv;
18874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18875 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
18876 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
18880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18881 if ((_res & 1) != 0) return;
18882 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18883 CHECK_ACCESS(_res_ptr);
18884 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
18886 CResult_NodeIdDecodeErrorZ_free(_res_conv);
18889 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
18890 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18891 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
18892 return (uintptr_t)ret_conv;
18894 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18895 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
18896 intptr_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
18900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18901 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
18902 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
18903 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
18904 return (uintptr_t)ret_conv;
18907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18908 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18909 CHECK_ACCESS(o_ptr);
18910 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
18911 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
18912 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18913 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
18914 return (uintptr_t)ret_conv;
18917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18918 LDKDecodeError e_conv;
18919 e_conv.inner = (void*)(e & (~1));
18920 e_conv.is_owned = (e & 1) || (e == 0);
18921 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18922 e_conv = DecodeError_clone(&e_conv);
18923 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18924 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
18925 return (uintptr_t)ret_conv;
18928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18929 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
18930 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
18934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18935 if ((_res & 1) != 0) return;
18936 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18937 CHECK_ACCESS(_res_ptr);
18938 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
18940 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
18943 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
18944 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18945 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
18946 return (uintptr_t)ret_conv;
18948 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18949 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
18950 intptr_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
18954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18955 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
18956 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
18957 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
18958 return (uintptr_t)ret_conv;
18961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18962 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18963 CHECK_ACCESS(o_ptr);
18964 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
18965 if (o_conv.free == LDKAccess_JCalls_free) {
18966 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18967 LDKAccess_JCalls_cloned(&o_conv);
18969 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
18970 *ret_copy = COption_AccessZ_some(o_conv);
18971 uintptr_t ret_ref = (uintptr_t)ret_copy;
18975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
18976 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
18977 *ret_copy = COption_AccessZ_none();
18978 uintptr_t ret_ref = (uintptr_t)ret_copy;
18982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18983 if ((_res & 1) != 0) return;
18984 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18985 CHECK_ACCESS(_res_ptr);
18986 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
18988 COption_AccessZ_free(_res_conv);
18991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18992 LDKDirectionalChannelInfo o_conv;
18993 o_conv.inner = (void*)(o & (~1));
18994 o_conv.is_owned = (o & 1) || (o == 0);
18995 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18996 o_conv = DirectionalChannelInfo_clone(&o_conv);
18997 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
18998 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
18999 return (uintptr_t)ret_conv;
19002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19003 LDKDecodeError e_conv;
19004 e_conv.inner = (void*)(e & (~1));
19005 e_conv.is_owned = (e & 1) || (e == 0);
19006 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19007 e_conv = DecodeError_clone(&e_conv);
19008 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19009 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
19010 return (uintptr_t)ret_conv;
19013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19014 LDKCResult_DirectionalChannelInfoDecodeErrorZ* o_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(o & ~1);
19015 jboolean ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(o_conv);
19019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19020 if ((_res & 1) != 0) return;
19021 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19022 CHECK_ACCESS(_res_ptr);
19023 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(_res_ptr);
19025 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
19028 static inline uintptr_t CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_DirectionalChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19029 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19030 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(arg);
19031 return (uintptr_t)ret_conv;
19033 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19034 LDKCResult_DirectionalChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
19035 intptr_t ret_val = CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19040 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
19041 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
19042 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
19043 return (uintptr_t)ret_conv;
19046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19047 LDKChannelInfo o_conv;
19048 o_conv.inner = (void*)(o & (~1));
19049 o_conv.is_owned = (o & 1) || (o == 0);
19050 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19051 o_conv = ChannelInfo_clone(&o_conv);
19052 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19053 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19054 return (uintptr_t)ret_conv;
19057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19058 LDKDecodeError e_conv;
19059 e_conv.inner = (void*)(e & (~1));
19060 e_conv.is_owned = (e & 1) || (e == 0);
19061 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19062 e_conv = DecodeError_clone(&e_conv);
19063 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19064 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19065 return (uintptr_t)ret_conv;
19068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19069 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
19070 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19075 if ((_res & 1) != 0) return;
19076 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19077 CHECK_ACCESS(_res_ptr);
19078 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19080 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19083 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19084 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19085 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19086 return (uintptr_t)ret_conv;
19088 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19089 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
19090 intptr_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19095 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
19096 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19097 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19098 return (uintptr_t)ret_conv;
19101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19102 LDKRoutingFees o_conv;
19103 o_conv.inner = (void*)(o & (~1));
19104 o_conv.is_owned = (o & 1) || (o == 0);
19105 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19106 o_conv = RoutingFees_clone(&o_conv);
19107 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19108 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19109 return (uintptr_t)ret_conv;
19112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19113 LDKDecodeError e_conv;
19114 e_conv.inner = (void*)(e & (~1));
19115 e_conv.is_owned = (e & 1) || (e == 0);
19116 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19117 e_conv = DecodeError_clone(&e_conv);
19118 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19119 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19120 return (uintptr_t)ret_conv;
19123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19124 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
19125 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19130 if ((_res & 1) != 0) return;
19131 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19132 CHECK_ACCESS(_res_ptr);
19133 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19135 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19138 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19139 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19140 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19141 return (uintptr_t)ret_conv;
19143 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19144 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
19145 intptr_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19150 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
19151 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19152 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19153 return (uintptr_t)ret_conv;
19156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19157 LDKNodeAnnouncementInfo o_conv;
19158 o_conv.inner = (void*)(o & (~1));
19159 o_conv.is_owned = (o & 1) || (o == 0);
19160 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19161 o_conv = NodeAnnouncementInfo_clone(&o_conv);
19162 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19163 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19164 return (uintptr_t)ret_conv;
19167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19168 LDKDecodeError e_conv;
19169 e_conv.inner = (void*)(e & (~1));
19170 e_conv.is_owned = (e & 1) || (e == 0);
19171 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19172 e_conv = DecodeError_clone(&e_conv);
19173 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19174 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19175 return (uintptr_t)ret_conv;
19178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19179 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
19180 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19185 if ((_res & 1) != 0) return;
19186 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19187 CHECK_ACCESS(_res_ptr);
19188 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19190 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19193 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19194 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19195 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19196 return (uintptr_t)ret_conv;
19198 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19199 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
19200 intptr_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19205 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
19206 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19207 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19208 return (uintptr_t)ret_conv;
19211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19212 LDKCVec_u64Z _res_constr;
19213 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19214 if (_res_constr.datalen > 0)
19215 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19217 _res_constr.data = NULL;
19218 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19219 for (size_t g = 0; g < _res_constr.datalen; g++) {
19220 int64_t _res_conv_6 = _res_vals[g];
19221 _res_constr.data[g] = _res_conv_6;
19223 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19224 CVec_u64Z_free(_res_constr);
19227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19228 LDKNodeInfo o_conv;
19229 o_conv.inner = (void*)(o & (~1));
19230 o_conv.is_owned = (o & 1) || (o == 0);
19231 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19232 o_conv = NodeInfo_clone(&o_conv);
19233 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19234 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
19235 return (uintptr_t)ret_conv;
19238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19239 LDKDecodeError e_conv;
19240 e_conv.inner = (void*)(e & (~1));
19241 e_conv.is_owned = (e & 1) || (e == 0);
19242 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19243 e_conv = DecodeError_clone(&e_conv);
19244 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19245 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
19246 return (uintptr_t)ret_conv;
19249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19250 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
19251 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
19255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19256 if ((_res & 1) != 0) return;
19257 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19258 CHECK_ACCESS(_res_ptr);
19259 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
19261 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
19264 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
19265 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19266 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
19267 return (uintptr_t)ret_conv;
19269 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19270 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
19271 intptr_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
19275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19276 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
19277 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
19278 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
19279 return (uintptr_t)ret_conv;
19282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19283 LDKNetworkGraph o_conv;
19284 o_conv.inner = (void*)(o & (~1));
19285 o_conv.is_owned = (o & 1) || (o == 0);
19286 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19287 o_conv = NetworkGraph_clone(&o_conv);
19288 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19289 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
19290 return (uintptr_t)ret_conv;
19293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19294 LDKDecodeError e_conv;
19295 e_conv.inner = (void*)(e & (~1));
19296 e_conv.is_owned = (e & 1) || (e == 0);
19297 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19298 e_conv = DecodeError_clone(&e_conv);
19299 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19300 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
19301 return (uintptr_t)ret_conv;
19304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19305 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
19306 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
19310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19311 if ((_res & 1) != 0) return;
19312 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19313 CHECK_ACCESS(_res_ptr);
19314 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
19316 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
19319 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
19320 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19321 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
19322 return (uintptr_t)ret_conv;
19324 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19325 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
19326 intptr_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
19330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19331 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
19332 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
19333 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
19334 return (uintptr_t)ret_conv;
19337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
19338 LDKCVec_NetAddressZ o_constr;
19339 o_constr.datalen = (*env)->GetArrayLength(env, o);
19340 if (o_constr.datalen > 0)
19341 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19343 o_constr.data = NULL;
19344 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
19345 for (size_t m = 0; m < o_constr.datalen; m++) {
19346 int64_t o_conv_12 = o_vals[m];
19347 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
19348 CHECK_ACCESS(o_conv_12_ptr);
19349 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
19350 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
19351 o_constr.data[m] = o_conv_12_conv;
19353 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
19354 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19355 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
19356 uintptr_t ret_ref = (uintptr_t)ret_copy;
19360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
19361 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19362 *ret_copy = COption_CVec_NetAddressZZ_none();
19363 uintptr_t ret_ref = (uintptr_t)ret_copy;
19367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19368 if ((_res & 1) != 0) return;
19369 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19370 CHECK_ACCESS(_res_ptr);
19371 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
19373 COption_CVec_NetAddressZZ_free(_res_conv);
19376 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
19377 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19378 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
19379 uintptr_t ret_ref = (uintptr_t)ret_copy;
19382 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19383 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
19384 intptr_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
19388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19389 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
19390 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
19391 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
19392 uintptr_t ret_ref = (uintptr_t)ret_copy;
19396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19397 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19398 CHECK_ACCESS(o_ptr);
19399 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19400 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
19401 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19402 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19403 return (uintptr_t)ret_conv;
19406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19407 LDKDecodeError e_conv;
19408 e_conv.inner = (void*)(e & (~1));
19409 e_conv.is_owned = (e & 1) || (e == 0);
19410 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19411 e_conv = DecodeError_clone(&e_conv);
19412 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19413 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19414 return (uintptr_t)ret_conv;
19417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19418 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
19419 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19424 if ((_res & 1) != 0) return;
19425 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19426 CHECK_ACCESS(_res_ptr);
19427 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19429 CResult_NetAddressDecodeErrorZ_free(_res_conv);
19432 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19433 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19434 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19435 return (uintptr_t)ret_conv;
19437 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19438 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
19439 intptr_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19444 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
19445 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19446 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19447 return (uintptr_t)ret_conv;
19450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19451 LDKCVec_UpdateAddHTLCZ _res_constr;
19452 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19453 if (_res_constr.datalen > 0)
19454 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19456 _res_constr.data = NULL;
19457 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19458 for (size_t p = 0; p < _res_constr.datalen; p++) {
19459 int64_t _res_conv_15 = _res_vals[p];
19460 LDKUpdateAddHTLC _res_conv_15_conv;
19461 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
19462 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
19463 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
19464 _res_constr.data[p] = _res_conv_15_conv;
19466 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19467 CVec_UpdateAddHTLCZ_free(_res_constr);
19470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19471 LDKCVec_UpdateFulfillHTLCZ _res_constr;
19472 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19473 if (_res_constr.datalen > 0)
19474 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19476 _res_constr.data = NULL;
19477 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19478 for (size_t t = 0; t < _res_constr.datalen; t++) {
19479 int64_t _res_conv_19 = _res_vals[t];
19480 LDKUpdateFulfillHTLC _res_conv_19_conv;
19481 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
19482 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
19483 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
19484 _res_constr.data[t] = _res_conv_19_conv;
19486 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19487 CVec_UpdateFulfillHTLCZ_free(_res_constr);
19490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19491 LDKCVec_UpdateFailHTLCZ _res_constr;
19492 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19493 if (_res_constr.datalen > 0)
19494 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19496 _res_constr.data = NULL;
19497 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19498 for (size_t q = 0; q < _res_constr.datalen; q++) {
19499 int64_t _res_conv_16 = _res_vals[q];
19500 LDKUpdateFailHTLC _res_conv_16_conv;
19501 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
19502 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
19503 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19504 _res_constr.data[q] = _res_conv_16_conv;
19506 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19507 CVec_UpdateFailHTLCZ_free(_res_constr);
19510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19511 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
19512 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19513 if (_res_constr.datalen > 0)
19514 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19516 _res_constr.data = NULL;
19517 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19518 for (size_t z = 0; z < _res_constr.datalen; z++) {
19519 int64_t _res_conv_25 = _res_vals[z];
19520 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
19521 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
19522 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
19523 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
19524 _res_constr.data[z] = _res_conv_25_conv;
19526 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19527 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
19530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19531 LDKAcceptChannel o_conv;
19532 o_conv.inner = (void*)(o & (~1));
19533 o_conv.is_owned = (o & 1) || (o == 0);
19534 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19535 o_conv = AcceptChannel_clone(&o_conv);
19536 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19537 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
19538 return (uintptr_t)ret_conv;
19541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19542 LDKDecodeError e_conv;
19543 e_conv.inner = (void*)(e & (~1));
19544 e_conv.is_owned = (e & 1) || (e == 0);
19545 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19546 e_conv = DecodeError_clone(&e_conv);
19547 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19548 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
19549 return (uintptr_t)ret_conv;
19552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19553 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
19554 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
19558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19559 if ((_res & 1) != 0) return;
19560 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19561 CHECK_ACCESS(_res_ptr);
19562 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
19564 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
19567 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
19568 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19569 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
19570 return (uintptr_t)ret_conv;
19572 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19573 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
19574 intptr_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
19578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19579 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
19580 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19581 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
19582 return (uintptr_t)ret_conv;
19585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19586 LDKAnnouncementSignatures o_conv;
19587 o_conv.inner = (void*)(o & (~1));
19588 o_conv.is_owned = (o & 1) || (o == 0);
19589 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19590 o_conv = AnnouncementSignatures_clone(&o_conv);
19591 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19592 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
19593 return (uintptr_t)ret_conv;
19596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19597 LDKDecodeError e_conv;
19598 e_conv.inner = (void*)(e & (~1));
19599 e_conv.is_owned = (e & 1) || (e == 0);
19600 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19601 e_conv = DecodeError_clone(&e_conv);
19602 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19603 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
19604 return (uintptr_t)ret_conv;
19607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19608 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
19609 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
19613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19614 if ((_res & 1) != 0) return;
19615 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19616 CHECK_ACCESS(_res_ptr);
19617 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
19619 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
19622 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
19623 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19624 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
19625 return (uintptr_t)ret_conv;
19627 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19628 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
19629 intptr_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
19633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19634 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
19635 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19636 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
19637 return (uintptr_t)ret_conv;
19640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19641 LDKChannelReestablish o_conv;
19642 o_conv.inner = (void*)(o & (~1));
19643 o_conv.is_owned = (o & 1) || (o == 0);
19644 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19645 o_conv = ChannelReestablish_clone(&o_conv);
19646 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19647 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
19648 return (uintptr_t)ret_conv;
19651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19652 LDKDecodeError e_conv;
19653 e_conv.inner = (void*)(e & (~1));
19654 e_conv.is_owned = (e & 1) || (e == 0);
19655 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19656 e_conv = DecodeError_clone(&e_conv);
19657 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19658 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
19659 return (uintptr_t)ret_conv;
19662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19663 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
19664 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
19668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19669 if ((_res & 1) != 0) return;
19670 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19671 CHECK_ACCESS(_res_ptr);
19672 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
19674 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
19677 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
19678 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19679 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
19680 return (uintptr_t)ret_conv;
19682 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19683 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
19684 intptr_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
19688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19689 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
19690 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19691 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
19692 return (uintptr_t)ret_conv;
19695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19696 LDKClosingSigned o_conv;
19697 o_conv.inner = (void*)(o & (~1));
19698 o_conv.is_owned = (o & 1) || (o == 0);
19699 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19700 o_conv = ClosingSigned_clone(&o_conv);
19701 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19702 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
19703 return (uintptr_t)ret_conv;
19706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19707 LDKDecodeError e_conv;
19708 e_conv.inner = (void*)(e & (~1));
19709 e_conv.is_owned = (e & 1) || (e == 0);
19710 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19711 e_conv = DecodeError_clone(&e_conv);
19712 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19713 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
19714 return (uintptr_t)ret_conv;
19717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19718 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
19719 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
19723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19724 if ((_res & 1) != 0) return;
19725 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19726 CHECK_ACCESS(_res_ptr);
19727 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
19729 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
19732 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
19733 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19734 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
19735 return (uintptr_t)ret_conv;
19737 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19738 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
19739 intptr_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
19743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19744 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
19745 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19746 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
19747 return (uintptr_t)ret_conv;
19750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19751 LDKClosingSignedFeeRange o_conv;
19752 o_conv.inner = (void*)(o & (~1));
19753 o_conv.is_owned = (o & 1) || (o == 0);
19754 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19755 o_conv = ClosingSignedFeeRange_clone(&o_conv);
19756 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19757 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
19758 return (uintptr_t)ret_conv;
19761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19762 LDKDecodeError e_conv;
19763 e_conv.inner = (void*)(e & (~1));
19764 e_conv.is_owned = (e & 1) || (e == 0);
19765 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19766 e_conv = DecodeError_clone(&e_conv);
19767 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19768 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
19769 return (uintptr_t)ret_conv;
19772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19773 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
19774 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
19778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19779 if ((_res & 1) != 0) return;
19780 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19781 CHECK_ACCESS(_res_ptr);
19782 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
19784 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
19787 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
19788 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19789 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
19790 return (uintptr_t)ret_conv;
19792 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19793 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
19794 intptr_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
19798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19799 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
19800 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19801 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
19802 return (uintptr_t)ret_conv;
19805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19806 LDKCommitmentSigned o_conv;
19807 o_conv.inner = (void*)(o & (~1));
19808 o_conv.is_owned = (o & 1) || (o == 0);
19809 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19810 o_conv = CommitmentSigned_clone(&o_conv);
19811 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19812 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
19813 return (uintptr_t)ret_conv;
19816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19817 LDKDecodeError e_conv;
19818 e_conv.inner = (void*)(e & (~1));
19819 e_conv.is_owned = (e & 1) || (e == 0);
19820 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19821 e_conv = DecodeError_clone(&e_conv);
19822 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19823 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
19824 return (uintptr_t)ret_conv;
19827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19828 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
19829 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
19833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19834 if ((_res & 1) != 0) return;
19835 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19836 CHECK_ACCESS(_res_ptr);
19837 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19839 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19842 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19843 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19844 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19845 return (uintptr_t)ret_conv;
19847 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19848 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
19849 intptr_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19854 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
19855 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19856 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19857 return (uintptr_t)ret_conv;
19860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19861 LDKFundingCreated o_conv;
19862 o_conv.inner = (void*)(o & (~1));
19863 o_conv.is_owned = (o & 1) || (o == 0);
19864 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19865 o_conv = FundingCreated_clone(&o_conv);
19866 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19867 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19868 return (uintptr_t)ret_conv;
19871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19872 LDKDecodeError e_conv;
19873 e_conv.inner = (void*)(e & (~1));
19874 e_conv.is_owned = (e & 1) || (e == 0);
19875 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19876 e_conv = DecodeError_clone(&e_conv);
19877 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19878 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19879 return (uintptr_t)ret_conv;
19882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19883 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
19884 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19889 if ((_res & 1) != 0) return;
19890 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19891 CHECK_ACCESS(_res_ptr);
19892 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19894 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19897 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19898 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19899 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19900 return (uintptr_t)ret_conv;
19902 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19903 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
19904 intptr_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19909 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
19910 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19911 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19912 return (uintptr_t)ret_conv;
19915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19916 LDKFundingSigned o_conv;
19917 o_conv.inner = (void*)(o & (~1));
19918 o_conv.is_owned = (o & 1) || (o == 0);
19919 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19920 o_conv = FundingSigned_clone(&o_conv);
19921 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19922 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19923 return (uintptr_t)ret_conv;
19926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19927 LDKDecodeError e_conv;
19928 e_conv.inner = (void*)(e & (~1));
19929 e_conv.is_owned = (e & 1) || (e == 0);
19930 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19931 e_conv = DecodeError_clone(&e_conv);
19932 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19933 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19934 return (uintptr_t)ret_conv;
19937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19938 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
19939 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19944 if ((_res & 1) != 0) return;
19945 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19946 CHECK_ACCESS(_res_ptr);
19947 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19949 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19952 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19953 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19954 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19955 return (uintptr_t)ret_conv;
19957 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19958 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
19959 intptr_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19964 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
19965 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19966 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19967 return (uintptr_t)ret_conv;
19970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19971 LDKFundingLocked o_conv;
19972 o_conv.inner = (void*)(o & (~1));
19973 o_conv.is_owned = (o & 1) || (o == 0);
19974 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19975 o_conv = FundingLocked_clone(&o_conv);
19976 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
19977 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
19978 return (uintptr_t)ret_conv;
19981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19982 LDKDecodeError e_conv;
19983 e_conv.inner = (void*)(e & (~1));
19984 e_conv.is_owned = (e & 1) || (e == 0);
19985 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19986 e_conv = DecodeError_clone(&e_conv);
19987 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
19988 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
19989 return (uintptr_t)ret_conv;
19992 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19993 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
19994 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
19998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19999 if ((_res & 1) != 0) return;
20000 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20001 CHECK_ACCESS(_res_ptr);
20002 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
20004 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
20007 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
20008 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20009 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
20010 return (uintptr_t)ret_conv;
20012 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20013 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
20014 intptr_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
20018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20019 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
20020 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20021 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
20022 return (uintptr_t)ret_conv;
20025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20027 o_conv.inner = (void*)(o & (~1));
20028 o_conv.is_owned = (o & 1) || (o == 0);
20029 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20030 o_conv = Init_clone(&o_conv);
20031 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20032 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20033 return (uintptr_t)ret_conv;
20036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20037 LDKDecodeError e_conv;
20038 e_conv.inner = (void*)(e & (~1));
20039 e_conv.is_owned = (e & 1) || (e == 0);
20040 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20041 e_conv = DecodeError_clone(&e_conv);
20042 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20043 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20044 return (uintptr_t)ret_conv;
20047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20048 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
20049 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
20053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20054 if ((_res & 1) != 0) return;
20055 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20056 CHECK_ACCESS(_res_ptr);
20057 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20059 CResult_InitDecodeErrorZ_free(_res_conv);
20062 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20063 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20064 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20065 return (uintptr_t)ret_conv;
20067 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20068 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
20069 intptr_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20074 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
20075 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20076 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20077 return (uintptr_t)ret_conv;
20080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20081 LDKOpenChannel o_conv;
20082 o_conv.inner = (void*)(o & (~1));
20083 o_conv.is_owned = (o & 1) || (o == 0);
20084 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20085 o_conv = OpenChannel_clone(&o_conv);
20086 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20087 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20088 return (uintptr_t)ret_conv;
20091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20092 LDKDecodeError e_conv;
20093 e_conv.inner = (void*)(e & (~1));
20094 e_conv.is_owned = (e & 1) || (e == 0);
20095 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20096 e_conv = DecodeError_clone(&e_conv);
20097 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20098 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20099 return (uintptr_t)ret_conv;
20102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20103 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
20104 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20109 if ((_res & 1) != 0) return;
20110 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20111 CHECK_ACCESS(_res_ptr);
20112 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20114 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20117 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20118 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20119 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20120 return (uintptr_t)ret_conv;
20122 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20123 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
20124 intptr_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20129 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
20130 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20131 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20132 return (uintptr_t)ret_conv;
20135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20136 LDKRevokeAndACK o_conv;
20137 o_conv.inner = (void*)(o & (~1));
20138 o_conv.is_owned = (o & 1) || (o == 0);
20139 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20140 o_conv = RevokeAndACK_clone(&o_conv);
20141 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20142 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20143 return (uintptr_t)ret_conv;
20146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20147 LDKDecodeError e_conv;
20148 e_conv.inner = (void*)(e & (~1));
20149 e_conv.is_owned = (e & 1) || (e == 0);
20150 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20151 e_conv = DecodeError_clone(&e_conv);
20152 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20153 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20154 return (uintptr_t)ret_conv;
20157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20158 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
20159 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20164 if ((_res & 1) != 0) return;
20165 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20166 CHECK_ACCESS(_res_ptr);
20167 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20169 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20172 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20173 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20174 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20175 return (uintptr_t)ret_conv;
20177 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20178 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
20179 intptr_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20184 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
20185 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20186 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20187 return (uintptr_t)ret_conv;
20190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20191 LDKShutdown o_conv;
20192 o_conv.inner = (void*)(o & (~1));
20193 o_conv.is_owned = (o & 1) || (o == 0);
20194 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20195 o_conv = Shutdown_clone(&o_conv);
20196 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20197 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20198 return (uintptr_t)ret_conv;
20201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20202 LDKDecodeError e_conv;
20203 e_conv.inner = (void*)(e & (~1));
20204 e_conv.is_owned = (e & 1) || (e == 0);
20205 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20206 e_conv = DecodeError_clone(&e_conv);
20207 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20208 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20209 return (uintptr_t)ret_conv;
20212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20213 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
20214 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20219 if ((_res & 1) != 0) return;
20220 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20221 CHECK_ACCESS(_res_ptr);
20222 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20224 CResult_ShutdownDecodeErrorZ_free(_res_conv);
20227 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20228 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20229 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20230 return (uintptr_t)ret_conv;
20232 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20233 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
20234 intptr_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20239 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
20240 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20241 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20242 return (uintptr_t)ret_conv;
20245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20246 LDKUpdateFailHTLC o_conv;
20247 o_conv.inner = (void*)(o & (~1));
20248 o_conv.is_owned = (o & 1) || (o == 0);
20249 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20250 o_conv = UpdateFailHTLC_clone(&o_conv);
20251 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20252 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20253 return (uintptr_t)ret_conv;
20256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20257 LDKDecodeError e_conv;
20258 e_conv.inner = (void*)(e & (~1));
20259 e_conv.is_owned = (e & 1) || (e == 0);
20260 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20261 e_conv = DecodeError_clone(&e_conv);
20262 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20263 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20264 return (uintptr_t)ret_conv;
20267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20268 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
20269 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20274 if ((_res & 1) != 0) return;
20275 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20276 CHECK_ACCESS(_res_ptr);
20277 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20279 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20282 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20283 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20284 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20285 return (uintptr_t)ret_conv;
20287 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20288 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
20289 intptr_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20294 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
20295 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20296 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20297 return (uintptr_t)ret_conv;
20300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20301 LDKUpdateFailMalformedHTLC o_conv;
20302 o_conv.inner = (void*)(o & (~1));
20303 o_conv.is_owned = (o & 1) || (o == 0);
20304 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20305 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20306 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20307 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20308 return (uintptr_t)ret_conv;
20311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20312 LDKDecodeError e_conv;
20313 e_conv.inner = (void*)(e & (~1));
20314 e_conv.is_owned = (e & 1) || (e == 0);
20315 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20316 e_conv = DecodeError_clone(&e_conv);
20317 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20318 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20319 return (uintptr_t)ret_conv;
20322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20323 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
20324 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20329 if ((_res & 1) != 0) return;
20330 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20331 CHECK_ACCESS(_res_ptr);
20332 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20334 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20337 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20338 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20339 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20340 return (uintptr_t)ret_conv;
20342 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20343 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
20344 intptr_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20349 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
20350 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20351 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20352 return (uintptr_t)ret_conv;
20355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20356 LDKUpdateFee o_conv;
20357 o_conv.inner = (void*)(o & (~1));
20358 o_conv.is_owned = (o & 1) || (o == 0);
20359 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20360 o_conv = UpdateFee_clone(&o_conv);
20361 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20362 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20363 return (uintptr_t)ret_conv;
20366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20367 LDKDecodeError e_conv;
20368 e_conv.inner = (void*)(e & (~1));
20369 e_conv.is_owned = (e & 1) || (e == 0);
20370 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20371 e_conv = DecodeError_clone(&e_conv);
20372 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20373 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20374 return (uintptr_t)ret_conv;
20377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20378 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
20379 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20384 if ((_res & 1) != 0) return;
20385 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20386 CHECK_ACCESS(_res_ptr);
20387 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20389 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20392 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20393 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20394 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20395 return (uintptr_t)ret_conv;
20397 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20398 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
20399 intptr_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20404 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
20405 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20406 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20407 return (uintptr_t)ret_conv;
20410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20411 LDKUpdateFulfillHTLC o_conv;
20412 o_conv.inner = (void*)(o & (~1));
20413 o_conv.is_owned = (o & 1) || (o == 0);
20414 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20415 o_conv = UpdateFulfillHTLC_clone(&o_conv);
20416 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20417 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20418 return (uintptr_t)ret_conv;
20421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20422 LDKDecodeError e_conv;
20423 e_conv.inner = (void*)(e & (~1));
20424 e_conv.is_owned = (e & 1) || (e == 0);
20425 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20426 e_conv = DecodeError_clone(&e_conv);
20427 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20428 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20429 return (uintptr_t)ret_conv;
20432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20433 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
20434 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20439 if ((_res & 1) != 0) return;
20440 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20441 CHECK_ACCESS(_res_ptr);
20442 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20444 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20447 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20448 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20449 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20450 return (uintptr_t)ret_conv;
20452 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20453 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
20454 intptr_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20459 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
20460 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20461 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20462 return (uintptr_t)ret_conv;
20465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20466 LDKUpdateAddHTLC o_conv;
20467 o_conv.inner = (void*)(o & (~1));
20468 o_conv.is_owned = (o & 1) || (o == 0);
20469 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20470 o_conv = UpdateAddHTLC_clone(&o_conv);
20471 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20472 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
20473 return (uintptr_t)ret_conv;
20476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20477 LDKDecodeError e_conv;
20478 e_conv.inner = (void*)(e & (~1));
20479 e_conv.is_owned = (e & 1) || (e == 0);
20480 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20481 e_conv = DecodeError_clone(&e_conv);
20482 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20483 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
20484 return (uintptr_t)ret_conv;
20487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20488 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
20489 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
20493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20494 if ((_res & 1) != 0) return;
20495 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20496 CHECK_ACCESS(_res_ptr);
20497 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
20499 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
20502 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
20503 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20504 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
20505 return (uintptr_t)ret_conv;
20507 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20508 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
20509 intptr_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
20513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20514 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
20515 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20516 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
20517 return (uintptr_t)ret_conv;
20520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20522 o_conv.inner = (void*)(o & (~1));
20523 o_conv.is_owned = (o & 1) || (o == 0);
20524 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20525 o_conv = Ping_clone(&o_conv);
20526 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20527 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
20528 return (uintptr_t)ret_conv;
20531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20532 LDKDecodeError e_conv;
20533 e_conv.inner = (void*)(e & (~1));
20534 e_conv.is_owned = (e & 1) || (e == 0);
20535 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20536 e_conv = DecodeError_clone(&e_conv);
20537 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20538 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
20539 return (uintptr_t)ret_conv;
20542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20543 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
20544 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
20548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20549 if ((_res & 1) != 0) return;
20550 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20551 CHECK_ACCESS(_res_ptr);
20552 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
20554 CResult_PingDecodeErrorZ_free(_res_conv);
20557 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
20558 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20559 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
20560 return (uintptr_t)ret_conv;
20562 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20563 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
20564 intptr_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
20568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20569 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
20570 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20571 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
20572 return (uintptr_t)ret_conv;
20575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20577 o_conv.inner = (void*)(o & (~1));
20578 o_conv.is_owned = (o & 1) || (o == 0);
20579 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20580 o_conv = Pong_clone(&o_conv);
20581 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20582 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
20583 return (uintptr_t)ret_conv;
20586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20587 LDKDecodeError e_conv;
20588 e_conv.inner = (void*)(e & (~1));
20589 e_conv.is_owned = (e & 1) || (e == 0);
20590 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20591 e_conv = DecodeError_clone(&e_conv);
20592 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20593 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
20594 return (uintptr_t)ret_conv;
20597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20598 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
20599 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
20603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20604 if ((_res & 1) != 0) return;
20605 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20606 CHECK_ACCESS(_res_ptr);
20607 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
20609 CResult_PongDecodeErrorZ_free(_res_conv);
20612 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
20613 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20614 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
20615 return (uintptr_t)ret_conv;
20617 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20618 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
20619 intptr_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
20623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20624 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
20625 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20626 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
20627 return (uintptr_t)ret_conv;
20630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20631 LDKUnsignedChannelAnnouncement o_conv;
20632 o_conv.inner = (void*)(o & (~1));
20633 o_conv.is_owned = (o & 1) || (o == 0);
20634 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20635 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
20636 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20637 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
20638 return (uintptr_t)ret_conv;
20641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20642 LDKDecodeError e_conv;
20643 e_conv.inner = (void*)(e & (~1));
20644 e_conv.is_owned = (e & 1) || (e == 0);
20645 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20646 e_conv = DecodeError_clone(&e_conv);
20647 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20648 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
20649 return (uintptr_t)ret_conv;
20652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20653 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
20654 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20659 if ((_res & 1) != 0) return;
20660 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20661 CHECK_ACCESS(_res_ptr);
20662 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20664 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
20667 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20668 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20669 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
20670 return (uintptr_t)ret_conv;
20672 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20673 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
20674 intptr_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20679 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
20680 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20681 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20682 return (uintptr_t)ret_conv;
20685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20686 LDKChannelAnnouncement o_conv;
20687 o_conv.inner = (void*)(o & (~1));
20688 o_conv.is_owned = (o & 1) || (o == 0);
20689 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20690 o_conv = ChannelAnnouncement_clone(&o_conv);
20691 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20692 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
20693 return (uintptr_t)ret_conv;
20696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20697 LDKDecodeError e_conv;
20698 e_conv.inner = (void*)(e & (~1));
20699 e_conv.is_owned = (e & 1) || (e == 0);
20700 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20701 e_conv = DecodeError_clone(&e_conv);
20702 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20703 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
20704 return (uintptr_t)ret_conv;
20707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20708 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
20709 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20714 if ((_res & 1) != 0) return;
20715 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20716 CHECK_ACCESS(_res_ptr);
20717 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20719 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
20722 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20723 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20724 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
20725 return (uintptr_t)ret_conv;
20727 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20728 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
20729 intptr_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20734 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
20735 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20736 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20737 return (uintptr_t)ret_conv;
20740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20741 LDKUnsignedChannelUpdate o_conv;
20742 o_conv.inner = (void*)(o & (~1));
20743 o_conv.is_owned = (o & 1) || (o == 0);
20744 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20745 o_conv = UnsignedChannelUpdate_clone(&o_conv);
20746 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20747 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
20748 return (uintptr_t)ret_conv;
20751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20752 LDKDecodeError e_conv;
20753 e_conv.inner = (void*)(e & (~1));
20754 e_conv.is_owned = (e & 1) || (e == 0);
20755 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20756 e_conv = DecodeError_clone(&e_conv);
20757 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20758 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
20759 return (uintptr_t)ret_conv;
20762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20763 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
20764 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
20768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20769 if ((_res & 1) != 0) return;
20770 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20771 CHECK_ACCESS(_res_ptr);
20772 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
20774 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
20777 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20778 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20779 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
20780 return (uintptr_t)ret_conv;
20782 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20783 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
20784 intptr_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20789 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
20790 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20791 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
20792 return (uintptr_t)ret_conv;
20795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20796 LDKChannelUpdate o_conv;
20797 o_conv.inner = (void*)(o & (~1));
20798 o_conv.is_owned = (o & 1) || (o == 0);
20799 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20800 o_conv = ChannelUpdate_clone(&o_conv);
20801 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20802 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
20803 return (uintptr_t)ret_conv;
20806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20807 LDKDecodeError e_conv;
20808 e_conv.inner = (void*)(e & (~1));
20809 e_conv.is_owned = (e & 1) || (e == 0);
20810 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20811 e_conv = DecodeError_clone(&e_conv);
20812 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20813 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
20814 return (uintptr_t)ret_conv;
20817 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20818 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
20819 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
20823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20824 if ((_res & 1) != 0) return;
20825 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20826 CHECK_ACCESS(_res_ptr);
20827 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
20829 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
20832 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20833 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20834 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20835 return (uintptr_t)ret_conv;
20837 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20838 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
20839 intptr_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20844 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
20845 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20846 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20847 return (uintptr_t)ret_conv;
20850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20851 LDKErrorMessage o_conv;
20852 o_conv.inner = (void*)(o & (~1));
20853 o_conv.is_owned = (o & 1) || (o == 0);
20854 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20855 o_conv = ErrorMessage_clone(&o_conv);
20856 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20857 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20858 return (uintptr_t)ret_conv;
20861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20862 LDKDecodeError e_conv;
20863 e_conv.inner = (void*)(e & (~1));
20864 e_conv.is_owned = (e & 1) || (e == 0);
20865 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20866 e_conv = DecodeError_clone(&e_conv);
20867 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20868 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20869 return (uintptr_t)ret_conv;
20872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20873 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
20874 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20879 if ((_res & 1) != 0) return;
20880 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20881 CHECK_ACCESS(_res_ptr);
20882 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20884 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20887 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20888 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20889 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20890 return (uintptr_t)ret_conv;
20892 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20893 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
20894 intptr_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20899 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
20900 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20901 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20902 return (uintptr_t)ret_conv;
20905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20906 LDKUnsignedNodeAnnouncement o_conv;
20907 o_conv.inner = (void*)(o & (~1));
20908 o_conv.is_owned = (o & 1) || (o == 0);
20909 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20910 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
20911 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20912 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
20913 return (uintptr_t)ret_conv;
20916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20917 LDKDecodeError e_conv;
20918 e_conv.inner = (void*)(e & (~1));
20919 e_conv.is_owned = (e & 1) || (e == 0);
20920 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20921 e_conv = DecodeError_clone(&e_conv);
20922 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20923 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
20924 return (uintptr_t)ret_conv;
20927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20928 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
20929 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20934 if ((_res & 1) != 0) return;
20935 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20936 CHECK_ACCESS(_res_ptr);
20937 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
20939 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
20942 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20943 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20944 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
20945 return (uintptr_t)ret_conv;
20947 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20948 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
20949 intptr_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20954 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
20955 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20956 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
20957 return (uintptr_t)ret_conv;
20960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20961 LDKNodeAnnouncement o_conv;
20962 o_conv.inner = (void*)(o & (~1));
20963 o_conv.is_owned = (o & 1) || (o == 0);
20964 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20965 o_conv = NodeAnnouncement_clone(&o_conv);
20966 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20967 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
20968 return (uintptr_t)ret_conv;
20971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20972 LDKDecodeError e_conv;
20973 e_conv.inner = (void*)(e & (~1));
20974 e_conv.is_owned = (e & 1) || (e == 0);
20975 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20976 e_conv = DecodeError_clone(&e_conv);
20977 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20978 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
20979 return (uintptr_t)ret_conv;
20982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20983 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
20984 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20989 if ((_res & 1) != 0) return;
20990 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20991 CHECK_ACCESS(_res_ptr);
20992 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
20994 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
20997 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20998 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20999 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21000 return (uintptr_t)ret_conv;
21002 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21003 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
21004 intptr_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21009 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
21010 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21011 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21012 return (uintptr_t)ret_conv;
21015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21016 LDKQueryShortChannelIds o_conv;
21017 o_conv.inner = (void*)(o & (~1));
21018 o_conv.is_owned = (o & 1) || (o == 0);
21019 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21020 o_conv = QueryShortChannelIds_clone(&o_conv);
21021 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21022 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21023 return (uintptr_t)ret_conv;
21026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21027 LDKDecodeError e_conv;
21028 e_conv.inner = (void*)(e & (~1));
21029 e_conv.is_owned = (e & 1) || (e == 0);
21030 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21031 e_conv = DecodeError_clone(&e_conv);
21032 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21033 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21034 return (uintptr_t)ret_conv;
21037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21038 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
21039 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21044 if ((_res & 1) != 0) return;
21045 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21046 CHECK_ACCESS(_res_ptr);
21047 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21049 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21052 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21053 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21054 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21055 return (uintptr_t)ret_conv;
21057 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21058 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
21059 intptr_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21064 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
21065 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21066 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21067 return (uintptr_t)ret_conv;
21070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21071 LDKReplyShortChannelIdsEnd o_conv;
21072 o_conv.inner = (void*)(o & (~1));
21073 o_conv.is_owned = (o & 1) || (o == 0);
21074 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21075 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21076 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21077 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21078 return (uintptr_t)ret_conv;
21081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21082 LDKDecodeError e_conv;
21083 e_conv.inner = (void*)(e & (~1));
21084 e_conv.is_owned = (e & 1) || (e == 0);
21085 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21086 e_conv = DecodeError_clone(&e_conv);
21087 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21088 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21089 return (uintptr_t)ret_conv;
21092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21093 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
21094 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21099 if ((_res & 1) != 0) return;
21100 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21101 CHECK_ACCESS(_res_ptr);
21102 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21104 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21107 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21108 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21109 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21110 return (uintptr_t)ret_conv;
21112 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21113 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
21114 intptr_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21119 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
21120 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21121 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21122 return (uintptr_t)ret_conv;
21125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21126 LDKQueryChannelRange o_conv;
21127 o_conv.inner = (void*)(o & (~1));
21128 o_conv.is_owned = (o & 1) || (o == 0);
21129 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21130 o_conv = QueryChannelRange_clone(&o_conv);
21131 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21132 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21133 return (uintptr_t)ret_conv;
21136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21137 LDKDecodeError e_conv;
21138 e_conv.inner = (void*)(e & (~1));
21139 e_conv.is_owned = (e & 1) || (e == 0);
21140 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21141 e_conv = DecodeError_clone(&e_conv);
21142 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21143 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21144 return (uintptr_t)ret_conv;
21147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21148 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
21149 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21154 if ((_res & 1) != 0) return;
21155 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21156 CHECK_ACCESS(_res_ptr);
21157 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21159 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21162 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21163 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21164 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21165 return (uintptr_t)ret_conv;
21167 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21168 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
21169 intptr_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21174 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
21175 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21176 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21177 return (uintptr_t)ret_conv;
21180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21181 LDKReplyChannelRange o_conv;
21182 o_conv.inner = (void*)(o & (~1));
21183 o_conv.is_owned = (o & 1) || (o == 0);
21184 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21185 o_conv = ReplyChannelRange_clone(&o_conv);
21186 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21187 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21188 return (uintptr_t)ret_conv;
21191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21192 LDKDecodeError e_conv;
21193 e_conv.inner = (void*)(e & (~1));
21194 e_conv.is_owned = (e & 1) || (e == 0);
21195 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21196 e_conv = DecodeError_clone(&e_conv);
21197 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21198 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21199 return (uintptr_t)ret_conv;
21202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21203 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
21204 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21209 if ((_res & 1) != 0) return;
21210 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21211 CHECK_ACCESS(_res_ptr);
21212 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21214 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21217 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21218 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21219 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21220 return (uintptr_t)ret_conv;
21222 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21223 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
21224 intptr_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21229 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
21230 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21231 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21232 return (uintptr_t)ret_conv;
21235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21236 LDKGossipTimestampFilter o_conv;
21237 o_conv.inner = (void*)(o & (~1));
21238 o_conv.is_owned = (o & 1) || (o == 0);
21239 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21240 o_conv = GossipTimestampFilter_clone(&o_conv);
21241 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21242 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21243 return (uintptr_t)ret_conv;
21246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21247 LDKDecodeError e_conv;
21248 e_conv.inner = (void*)(e & (~1));
21249 e_conv.is_owned = (e & 1) || (e == 0);
21250 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21251 e_conv = DecodeError_clone(&e_conv);
21252 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21253 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21254 return (uintptr_t)ret_conv;
21257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21258 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
21259 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21264 if ((_res & 1) != 0) return;
21265 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21266 CHECK_ACCESS(_res_ptr);
21267 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21269 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21272 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21273 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21274 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21275 return (uintptr_t)ret_conv;
21277 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21278 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
21279 intptr_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21284 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
21285 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21286 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21287 return (uintptr_t)ret_conv;
21290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21292 o_conv.inner = (void*)(o & (~1));
21293 o_conv.is_owned = (o & 1) || (o == 0);
21294 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21295 o_conv = Invoice_clone(&o_conv);
21296 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21297 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
21298 return (uintptr_t)ret_conv;
21301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21302 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
21303 CHECK_ACCESS(e_ptr);
21304 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
21305 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
21306 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21307 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
21308 return (uintptr_t)ret_conv;
21311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21312 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
21313 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
21317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21318 if ((_res & 1) != 0) return;
21319 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21320 CHECK_ACCESS(_res_ptr);
21321 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
21323 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
21326 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
21327 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21328 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
21329 return (uintptr_t)ret_conv;
21331 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21332 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
21333 intptr_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
21337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21338 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
21339 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21340 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
21341 return (uintptr_t)ret_conv;
21344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
21345 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21346 CHECK_ACCESS(o_ptr);
21347 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21348 if (o_conv.free == LDKFilter_JCalls_free) {
21349 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21350 LDKFilter_JCalls_cloned(&o_conv);
21352 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21353 *ret_copy = COption_FilterZ_some(o_conv);
21354 uintptr_t ret_ref = (uintptr_t)ret_copy;
21358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
21359 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21360 *ret_copy = COption_FilterZ_none();
21361 uintptr_t ret_ref = (uintptr_t)ret_copy;
21365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21366 if ((_res & 1) != 0) return;
21367 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21368 CHECK_ACCESS(_res_ptr);
21369 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21371 COption_FilterZ_free(_res_conv);
21374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21375 LDKLockedChannelMonitor o_conv;
21376 o_conv.inner = (void*)(o & (~1));
21377 o_conv.is_owned = (o & 1) || (o == 0);
21378 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21379 // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor
21380 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21381 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21382 return (uintptr_t)ret_conv;
21385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
21386 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21387 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21388 return (uintptr_t)ret_conv;
21391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21392 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
21393 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21398 if ((_res & 1) != 0) return;
21399 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21400 CHECK_ACCESS(_res_ptr);
21401 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21403 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21407 LDKCVec_OutPointZ _res_constr;
21408 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21409 if (_res_constr.datalen > 0)
21410 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21412 _res_constr.data = NULL;
21413 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21414 for (size_t k = 0; k < _res_constr.datalen; k++) {
21415 int64_t _res_conv_10 = _res_vals[k];
21416 LDKOutPoint _res_conv_10_conv;
21417 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
21418 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
21419 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21420 _res_constr.data[k] = _res_conv_10_conv;
21422 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21423 CVec_OutPointZ_free(_res_constr);
21426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21427 if ((this_ptr & 1) != 0) return;
21428 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21429 CHECK_ACCESS(this_ptr_ptr);
21430 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
21431 FREE((void*)this_ptr);
21432 PaymentPurpose_free(this_ptr_conv);
21435 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
21436 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21437 *ret_copy = PaymentPurpose_clone(arg);
21438 uintptr_t ret_ref = (uintptr_t)ret_copy;
21441 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21442 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
21443 intptr_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
21447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21448 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
21449 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21450 *ret_copy = PaymentPurpose_clone(orig_conv);
21451 uintptr_t ret_ref = (uintptr_t)ret_copy;
21455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
21456 LDKThirtyTwoBytes payment_preimage_ref;
21457 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
21458 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
21459 LDKThirtyTwoBytes payment_secret_ref;
21460 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
21461 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
21462 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21463 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
21464 uintptr_t ret_ref = (uintptr_t)ret_copy;
21468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
21469 LDKThirtyTwoBytes a_ref;
21470 CHECK((*env)->GetArrayLength(env, a) == 32);
21471 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
21472 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21473 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
21474 uintptr_t ret_ref = (uintptr_t)ret_copy;
21478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21479 if ((this_ptr & 1) != 0) return;
21480 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21481 CHECK_ACCESS(this_ptr_ptr);
21482 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
21483 FREE((void*)this_ptr);
21484 ClosureReason_free(this_ptr_conv);
21487 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
21488 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21489 *ret_copy = ClosureReason_clone(arg);
21490 uintptr_t ret_ref = (uintptr_t)ret_copy;
21493 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21494 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
21495 intptr_t ret_val = ClosureReason_clone_ptr(arg_conv);
21499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21500 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
21501 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21502 *ret_copy = ClosureReason_clone(orig_conv);
21503 uintptr_t ret_ref = (uintptr_t)ret_copy;
21507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
21508 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
21509 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21510 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
21511 uintptr_t ret_ref = (uintptr_t)ret_copy;
21515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
21516 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21517 *ret_copy = ClosureReason_holder_force_closed();
21518 uintptr_t ret_ref = (uintptr_t)ret_copy;
21522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
21523 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21524 *ret_copy = ClosureReason_cooperative_closure();
21525 uintptr_t ret_ref = (uintptr_t)ret_copy;
21529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
21530 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21531 *ret_copy = ClosureReason_commitment_tx_confirmed();
21532 uintptr_t ret_ref = (uintptr_t)ret_copy;
21536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
21537 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21538 *ret_copy = ClosureReason_funding_timed_out();
21539 uintptr_t ret_ref = (uintptr_t)ret_copy;
21543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
21544 LDKStr err_conv = java_to_owned_str(env, err);
21545 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21546 *ret_copy = ClosureReason_processing_error(err_conv);
21547 uintptr_t ret_ref = (uintptr_t)ret_copy;
21551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
21552 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21553 *ret_copy = ClosureReason_disconnected_peer();
21554 uintptr_t ret_ref = (uintptr_t)ret_copy;
21558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
21559 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21560 *ret_copy = ClosureReason_outdated_channel_manager();
21561 uintptr_t ret_ref = (uintptr_t)ret_copy;
21565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
21566 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
21567 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
21568 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21569 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21570 CVec_u8Z_free(ret_var);
21574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21575 LDKu8slice ser_ref;
21576 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21577 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21578 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
21579 *ret_conv = ClosureReason_read(ser_ref);
21580 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21581 return (uintptr_t)ret_conv;
21584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21585 if ((this_ptr & 1) != 0) return;
21586 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21587 CHECK_ACCESS(this_ptr_ptr);
21588 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
21589 FREE((void*)this_ptr);
21590 Event_free(this_ptr_conv);
21593 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
21594 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21595 *ret_copy = Event_clone(arg);
21596 uintptr_t ret_ref = (uintptr_t)ret_copy;
21599 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21600 LDKEvent* arg_conv = (LDKEvent*)arg;
21601 intptr_t ret_val = Event_clone_ptr(arg_conv);
21605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21606 LDKEvent* orig_conv = (LDKEvent*)orig;
21607 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21608 *ret_copy = Event_clone(orig_conv);
21609 uintptr_t ret_ref = (uintptr_t)ret_copy;
21613 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) {
21614 LDKThirtyTwoBytes temporary_channel_id_ref;
21615 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
21616 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
21617 LDKCVec_u8Z output_script_ref;
21618 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
21619 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
21620 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
21621 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21622 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
21623 uintptr_t ret_ref = (uintptr_t)ret_copy;
21627 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) {
21628 LDKThirtyTwoBytes payment_hash_ref;
21629 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21630 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
21631 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
21632 CHECK_ACCESS(purpose_ptr);
21633 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21634 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
21635 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21636 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
21637 uintptr_t ret_ref = (uintptr_t)ret_copy;
21641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) {
21642 LDKThirtyTwoBytes payment_id_ref;
21643 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
21644 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
21645 LDKThirtyTwoBytes payment_preimage_ref;
21646 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
21647 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
21648 LDKThirtyTwoBytes payment_hash_ref;
21649 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21650 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
21651 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
21652 CHECK_ACCESS(fee_paid_msat_ptr);
21653 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
21654 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
21655 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21656 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
21657 uintptr_t ret_ref = (uintptr_t)ret_copy;
21661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id, int64_t retry) {
21662 LDKThirtyTwoBytes payment_id_ref;
21663 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
21664 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
21665 LDKThirtyTwoBytes payment_hash_ref;
21666 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21667 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
21668 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
21669 CHECK_ACCESS(network_update_ptr);
21670 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
21671 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
21672 LDKCVec_RouteHopZ path_constr;
21673 path_constr.datalen = (*env)->GetArrayLength(env, path);
21674 if (path_constr.datalen > 0)
21675 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21677 path_constr.data = NULL;
21678 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
21679 for (size_t k = 0; k < path_constr.datalen; k++) {
21680 int64_t path_conv_10 = path_vals[k];
21681 LDKRouteHop path_conv_10_conv;
21682 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
21683 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
21684 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21685 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21686 path_constr.data[k] = path_conv_10_conv;
21688 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
21689 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
21690 CHECK_ACCESS(short_channel_id_ptr);
21691 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21692 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
21693 LDKRouteParameters retry_conv;
21694 retry_conv.inner = (void*)(retry & (~1));
21695 retry_conv.is_owned = (retry & 1) || (retry == 0);
21696 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
21697 retry_conv = RouteParameters_clone(&retry_conv);
21698 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21699 *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv);
21700 uintptr_t ret_ref = (uintptr_t)ret_copy;
21704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
21705 LDKThirtyTwoBytes payment_id_ref;
21706 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
21707 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
21708 LDKThirtyTwoBytes payment_hash_ref;
21709 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21710 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
21711 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21712 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
21713 uintptr_t ret_ref = (uintptr_t)ret_copy;
21717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
21718 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21719 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
21720 uintptr_t ret_ref = (uintptr_t)ret_copy;
21724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
21725 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
21726 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
21727 if (outputs_constr.datalen > 0)
21728 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21730 outputs_constr.data = NULL;
21731 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
21732 for (size_t b = 0; b < outputs_constr.datalen; b++) {
21733 int64_t outputs_conv_27 = outputs_vals[b];
21734 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
21735 CHECK_ACCESS(outputs_conv_27_ptr);
21736 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
21737 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
21738 outputs_constr.data[b] = outputs_conv_27_conv;
21740 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
21741 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21742 *ret_copy = Event_spendable_outputs(outputs_constr);
21743 uintptr_t ret_ref = (uintptr_t)ret_copy;
21747 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) {
21748 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
21749 CHECK_ACCESS(fee_earned_msat_ptr);
21750 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
21751 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
21752 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21753 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
21754 uintptr_t ret_ref = (uintptr_t)ret_copy;
21758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t user_channel_id, int64_t reason) {
21759 LDKThirtyTwoBytes channel_id_ref;
21760 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
21761 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
21762 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
21763 CHECK_ACCESS(reason_ptr);
21764 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
21765 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
21766 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21767 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
21768 uintptr_t ret_ref = (uintptr_t)ret_copy;
21772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
21773 LDKThirtyTwoBytes channel_id_ref;
21774 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
21775 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
21776 LDKTransaction transaction_ref;
21777 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
21778 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
21779 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
21780 transaction_ref.data_is_owned = true;
21781 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21782 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
21783 uintptr_t ret_ref = (uintptr_t)ret_copy;
21787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) {
21788 LDKThirtyTwoBytes payment_id_ref;
21789 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
21790 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
21791 LDKThirtyTwoBytes payment_hash_ref;
21792 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
21793 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
21794 LDKCVec_RouteHopZ path_constr;
21795 path_constr.datalen = (*env)->GetArrayLength(env, path);
21796 if (path_constr.datalen > 0)
21797 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21799 path_constr.data = NULL;
21800 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
21801 for (size_t k = 0; k < path_constr.datalen; k++) {
21802 int64_t path_conv_10 = path_vals[k];
21803 LDKRouteHop path_conv_10_conv;
21804 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
21805 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
21806 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21807 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21808 path_constr.data[k] = path_conv_10_conv;
21810 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
21811 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21812 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
21813 uintptr_t ret_ref = (uintptr_t)ret_copy;
21817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
21818 LDKEvent* obj_conv = (LDKEvent*)obj;
21819 LDKCVec_u8Z ret_var = Event_write(obj_conv);
21820 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21821 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21822 CVec_u8Z_free(ret_var);
21826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21827 LDKu8slice ser_ref;
21828 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21829 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21830 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
21831 *ret_conv = Event_read(ser_ref);
21832 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21833 return (uintptr_t)ret_conv;
21836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21837 if ((this_ptr & 1) != 0) return;
21838 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
21839 CHECK_ACCESS(this_ptr_ptr);
21840 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
21841 FREE((void*)this_ptr);
21842 MessageSendEvent_free(this_ptr_conv);
21845 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
21846 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21847 *ret_copy = MessageSendEvent_clone(arg);
21848 uintptr_t ret_ref = (uintptr_t)ret_copy;
21851 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21852 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
21853 intptr_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
21857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21858 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
21859 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21860 *ret_copy = MessageSendEvent_clone(orig_conv);
21861 uintptr_t ret_ref = (uintptr_t)ret_copy;
21865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
21866 LDKPublicKey node_id_ref;
21867 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21868 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21869 LDKAcceptChannel msg_conv;
21870 msg_conv.inner = (void*)(msg & (~1));
21871 msg_conv.is_owned = (msg & 1) || (msg == 0);
21872 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21873 msg_conv = AcceptChannel_clone(&msg_conv);
21874 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21875 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
21876 uintptr_t ret_ref = (uintptr_t)ret_copy;
21880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
21881 LDKPublicKey node_id_ref;
21882 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21883 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21884 LDKOpenChannel msg_conv;
21885 msg_conv.inner = (void*)(msg & (~1));
21886 msg_conv.is_owned = (msg & 1) || (msg == 0);
21887 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21888 msg_conv = OpenChannel_clone(&msg_conv);
21889 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21890 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
21891 uintptr_t ret_ref = (uintptr_t)ret_copy;
21895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
21896 LDKPublicKey node_id_ref;
21897 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21898 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21899 LDKFundingCreated msg_conv;
21900 msg_conv.inner = (void*)(msg & (~1));
21901 msg_conv.is_owned = (msg & 1) || (msg == 0);
21902 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21903 msg_conv = FundingCreated_clone(&msg_conv);
21904 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21905 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
21906 uintptr_t ret_ref = (uintptr_t)ret_copy;
21910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
21911 LDKPublicKey node_id_ref;
21912 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21913 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21914 LDKFundingSigned msg_conv;
21915 msg_conv.inner = (void*)(msg & (~1));
21916 msg_conv.is_owned = (msg & 1) || (msg == 0);
21917 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21918 msg_conv = FundingSigned_clone(&msg_conv);
21919 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21920 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
21921 uintptr_t ret_ref = (uintptr_t)ret_copy;
21925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
21926 LDKPublicKey node_id_ref;
21927 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21928 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21929 LDKFundingLocked msg_conv;
21930 msg_conv.inner = (void*)(msg & (~1));
21931 msg_conv.is_owned = (msg & 1) || (msg == 0);
21932 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21933 msg_conv = FundingLocked_clone(&msg_conv);
21934 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21935 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
21936 uintptr_t ret_ref = (uintptr_t)ret_copy;
21940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
21941 LDKPublicKey node_id_ref;
21942 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21943 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21944 LDKAnnouncementSignatures msg_conv;
21945 msg_conv.inner = (void*)(msg & (~1));
21946 msg_conv.is_owned = (msg & 1) || (msg == 0);
21947 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21948 msg_conv = AnnouncementSignatures_clone(&msg_conv);
21949 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21950 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
21951 uintptr_t ret_ref = (uintptr_t)ret_copy;
21955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
21956 LDKPublicKey node_id_ref;
21957 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21958 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21959 LDKCommitmentUpdate updates_conv;
21960 updates_conv.inner = (void*)(updates & (~1));
21961 updates_conv.is_owned = (updates & 1) || (updates == 0);
21962 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
21963 updates_conv = CommitmentUpdate_clone(&updates_conv);
21964 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21965 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
21966 uintptr_t ret_ref = (uintptr_t)ret_copy;
21970 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) {
21971 LDKPublicKey node_id_ref;
21972 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21973 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21974 LDKRevokeAndACK msg_conv;
21975 msg_conv.inner = (void*)(msg & (~1));
21976 msg_conv.is_owned = (msg & 1) || (msg == 0);
21977 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21978 msg_conv = RevokeAndACK_clone(&msg_conv);
21979 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21980 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
21981 uintptr_t ret_ref = (uintptr_t)ret_copy;
21985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
21986 LDKPublicKey node_id_ref;
21987 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21988 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21989 LDKClosingSigned msg_conv;
21990 msg_conv.inner = (void*)(msg & (~1));
21991 msg_conv.is_owned = (msg & 1) || (msg == 0);
21992 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21993 msg_conv = ClosingSigned_clone(&msg_conv);
21994 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21995 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
21996 uintptr_t ret_ref = (uintptr_t)ret_copy;
22000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
22001 LDKPublicKey node_id_ref;
22002 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22003 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22004 LDKShutdown msg_conv;
22005 msg_conv.inner = (void*)(msg & (~1));
22006 msg_conv.is_owned = (msg & 1) || (msg == 0);
22007 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22008 msg_conv = Shutdown_clone(&msg_conv);
22009 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22010 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
22011 uintptr_t ret_ref = (uintptr_t)ret_copy;
22015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
22016 LDKPublicKey node_id_ref;
22017 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22018 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22019 LDKChannelReestablish msg_conv;
22020 msg_conv.inner = (void*)(msg & (~1));
22021 msg_conv.is_owned = (msg & 1) || (msg == 0);
22022 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22023 msg_conv = ChannelReestablish_clone(&msg_conv);
22024 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22025 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
22026 uintptr_t ret_ref = (uintptr_t)ret_copy;
22030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
22031 LDKChannelAnnouncement msg_conv;
22032 msg_conv.inner = (void*)(msg & (~1));
22033 msg_conv.is_owned = (msg & 1) || (msg == 0);
22034 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22035 msg_conv = ChannelAnnouncement_clone(&msg_conv);
22036 LDKChannelUpdate update_msg_conv;
22037 update_msg_conv.inner = (void*)(update_msg & (~1));
22038 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
22039 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22040 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22041 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22042 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
22043 uintptr_t ret_ref = (uintptr_t)ret_copy;
22047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
22048 LDKNodeAnnouncement msg_conv;
22049 msg_conv.inner = (void*)(msg & (~1));
22050 msg_conv.is_owned = (msg & 1) || (msg == 0);
22051 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22052 msg_conv = NodeAnnouncement_clone(&msg_conv);
22053 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22054 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
22055 uintptr_t ret_ref = (uintptr_t)ret_copy;
22059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
22060 LDKChannelUpdate msg_conv;
22061 msg_conv.inner = (void*)(msg & (~1));
22062 msg_conv.is_owned = (msg & 1) || (msg == 0);
22063 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22064 msg_conv = ChannelUpdate_clone(&msg_conv);
22065 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22066 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
22067 uintptr_t ret_ref = (uintptr_t)ret_copy;
22071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
22072 LDKPublicKey node_id_ref;
22073 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22074 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22075 LDKChannelUpdate msg_conv;
22076 msg_conv.inner = (void*)(msg & (~1));
22077 msg_conv.is_owned = (msg & 1) || (msg == 0);
22078 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22079 msg_conv = ChannelUpdate_clone(&msg_conv);
22080 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22081 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
22082 uintptr_t ret_ref = (uintptr_t)ret_copy;
22086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
22087 LDKPublicKey node_id_ref;
22088 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22089 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22090 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
22091 CHECK_ACCESS(action_ptr);
22092 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
22093 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
22094 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22095 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
22096 uintptr_t ret_ref = (uintptr_t)ret_copy;
22100 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) {
22101 LDKPublicKey node_id_ref;
22102 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22103 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22104 LDKQueryChannelRange msg_conv;
22105 msg_conv.inner = (void*)(msg & (~1));
22106 msg_conv.is_owned = (msg & 1) || (msg == 0);
22107 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22108 msg_conv = QueryChannelRange_clone(&msg_conv);
22109 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22110 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
22111 uintptr_t ret_ref = (uintptr_t)ret_copy;
22115 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) {
22116 LDKPublicKey node_id_ref;
22117 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22118 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22119 LDKQueryShortChannelIds msg_conv;
22120 msg_conv.inner = (void*)(msg & (~1));
22121 msg_conv.is_owned = (msg & 1) || (msg == 0);
22122 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22123 msg_conv = QueryShortChannelIds_clone(&msg_conv);
22124 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22125 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
22126 uintptr_t ret_ref = (uintptr_t)ret_copy;
22130 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) {
22131 LDKPublicKey node_id_ref;
22132 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22133 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22134 LDKReplyChannelRange msg_conv;
22135 msg_conv.inner = (void*)(msg & (~1));
22136 msg_conv.is_owned = (msg & 1) || (msg == 0);
22137 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22138 msg_conv = ReplyChannelRange_clone(&msg_conv);
22139 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22140 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
22141 uintptr_t ret_ref = (uintptr_t)ret_copy;
22145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22146 if ((this_ptr & 1) != 0) return;
22147 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22148 CHECK_ACCESS(this_ptr_ptr);
22149 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
22150 FREE((void*)this_ptr);
22151 MessageSendEventsProvider_free(this_ptr_conv);
22154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22155 if ((this_ptr & 1) != 0) return;
22156 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22157 CHECK_ACCESS(this_ptr_ptr);
22158 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
22159 FREE((void*)this_ptr);
22160 EventsProvider_free(this_ptr_conv);
22163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22164 if ((this_ptr & 1) != 0) return;
22165 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22166 CHECK_ACCESS(this_ptr_ptr);
22167 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
22168 FREE((void*)this_ptr);
22169 EventHandler_free(this_ptr_conv);
22172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22173 if ((this_ptr & 1) != 0) return;
22174 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22175 CHECK_ACCESS(this_ptr_ptr);
22176 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
22177 FREE((void*)this_ptr);
22178 APIError_free(this_ptr_conv);
22181 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
22182 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22183 *ret_copy = APIError_clone(arg);
22184 uintptr_t ret_ref = (uintptr_t)ret_copy;
22187 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22188 LDKAPIError* arg_conv = (LDKAPIError*)arg;
22189 intptr_t ret_val = APIError_clone_ptr(arg_conv);
22193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22194 LDKAPIError* orig_conv = (LDKAPIError*)orig;
22195 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22196 *ret_copy = APIError_clone(orig_conv);
22197 uintptr_t ret_ref = (uintptr_t)ret_copy;
22201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
22202 LDKStr err_conv = java_to_owned_str(env, err);
22203 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22204 *ret_copy = APIError_apimisuse_error(err_conv);
22205 uintptr_t ret_ref = (uintptr_t)ret_copy;
22209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
22210 LDKStr err_conv = java_to_owned_str(env, err);
22211 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22212 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
22213 uintptr_t ret_ref = (uintptr_t)ret_copy;
22217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
22218 LDKStr err_conv = java_to_owned_str(env, err);
22219 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22220 *ret_copy = APIError_route_error(err_conv);
22221 uintptr_t ret_ref = (uintptr_t)ret_copy;
22225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
22226 LDKStr err_conv = java_to_owned_str(env, err);
22227 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22228 *ret_copy = APIError_channel_unavailable(err_conv);
22229 uintptr_t ret_ref = (uintptr_t)ret_copy;
22233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
22234 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22235 *ret_copy = APIError_monitor_update_failed();
22236 uintptr_t ret_ref = (uintptr_t)ret_copy;
22240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
22241 LDKShutdownScript script_conv;
22242 script_conv.inner = (void*)(script & (~1));
22243 script_conv.is_owned = (script & 1) || (script == 0);
22244 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
22245 script_conv = ShutdownScript_clone(&script_conv);
22246 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22247 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
22248 uintptr_t ret_ref = (uintptr_t)ret_copy;
22252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
22253 LDKu8slice msg_ref;
22254 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
22255 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
22256 unsigned char sk_arr[32];
22257 CHECK((*env)->GetArrayLength(env, sk) == 32);
22258 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
22259 unsigned char (*sk_ref)[32] = &sk_arr;
22260 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22261 *ret_conv = sign(msg_ref, sk_ref);
22262 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
22263 return (uintptr_t)ret_conv;
22266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
22267 LDKu8slice msg_ref;
22268 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
22269 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
22270 LDKStr sig_conv = java_to_owned_str(env, sig);
22271 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22272 *ret_conv = recover_pk(msg_ref, sig_conv);
22273 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
22274 return (uintptr_t)ret_conv;
22277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
22278 LDKu8slice msg_ref;
22279 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
22280 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
22281 LDKStr sig_conv = java_to_owned_str(env, sig);
22282 LDKPublicKey pk_ref;
22283 CHECK((*env)->GetArrayLength(env, pk) == 33);
22284 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
22285 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
22286 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
22290 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22291 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
22292 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
22296 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
22297 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
22301 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
22302 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
22306 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
22307 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
22311 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
22312 jclass ret_conv = LDKLevel_to_java(env, Level_info());
22316 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
22317 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
22321 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
22322 jclass ret_conv = LDKLevel_to_java(env, Level_error());
22326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22327 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
22328 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
22329 jboolean ret_val = Level_eq(a_conv, b_conv);
22333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
22334 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
22335 int64_t ret_val = Level_hash(o_conv);
22339 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
22340 jclass ret_conv = LDKLevel_to_java(env, Level_max());
22344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22345 LDKRecord this_obj_conv;
22346 this_obj_conv.inner = (void*)(this_obj & (~1));
22347 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22349 Record_free(this_obj_conv);
22352 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
22353 LDKRecord this_ptr_conv;
22354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22355 this_ptr_conv.is_owned = false;
22356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22357 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
22361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
22362 LDKRecord this_ptr_conv;
22363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22364 this_ptr_conv.is_owned = false;
22365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22366 LDKLevel val_conv = LDKLevel_from_java(env, val);
22367 Record_set_level(&this_ptr_conv, val_conv);
22370 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
22371 LDKRecord this_ptr_conv;
22372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22373 this_ptr_conv.is_owned = false;
22374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22375 LDKStr ret_str = Record_get_args(&this_ptr_conv);
22376 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
22381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
22382 LDKRecord this_ptr_conv;
22383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22384 this_ptr_conv.is_owned = false;
22385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22386 LDKStr val_conv = java_to_owned_str(env, val);
22387 Record_set_args(&this_ptr_conv, val_conv);
22390 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
22391 LDKRecord this_ptr_conv;
22392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22393 this_ptr_conv.is_owned = false;
22394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22395 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
22396 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
22401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
22402 LDKRecord this_ptr_conv;
22403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22404 this_ptr_conv.is_owned = false;
22405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22406 LDKStr val_conv = java_to_owned_str(env, val);
22407 Record_set_module_path(&this_ptr_conv, val_conv);
22410 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
22411 LDKRecord this_ptr_conv;
22412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22413 this_ptr_conv.is_owned = false;
22414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22415 LDKStr ret_str = Record_get_file(&this_ptr_conv);
22416 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
22421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
22422 LDKRecord this_ptr_conv;
22423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22424 this_ptr_conv.is_owned = false;
22425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22426 LDKStr val_conv = java_to_owned_str(env, val);
22427 Record_set_file(&this_ptr_conv, val_conv);
22430 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
22431 LDKRecord this_ptr_conv;
22432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22433 this_ptr_conv.is_owned = false;
22434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22435 int32_t ret_val = Record_get_line(&this_ptr_conv);
22439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22440 LDKRecord this_ptr_conv;
22441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22442 this_ptr_conv.is_owned = false;
22443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22444 Record_set_line(&this_ptr_conv, val);
22447 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
22448 LDKRecord ret_var = Record_clone(arg);
22449 uintptr_t ret_ref = 0;
22450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22453 ret_ref = (uintptr_t)ret_var.inner;
22454 if (ret_var.is_owned) {
22459 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22460 LDKRecord arg_conv;
22461 arg_conv.inner = (void*)(arg & (~1));
22462 arg_conv.is_owned = false;
22463 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22464 intptr_t ret_val = Record_clone_ptr(&arg_conv);
22468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22469 LDKRecord orig_conv;
22470 orig_conv.inner = (void*)(orig & (~1));
22471 orig_conv.is_owned = false;
22472 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22473 LDKRecord ret_var = Record_clone(&orig_conv);
22474 uintptr_t ret_ref = 0;
22475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22478 ret_ref = (uintptr_t)ret_var.inner;
22479 if (ret_var.is_owned) {
22485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22486 if ((this_ptr & 1) != 0) return;
22487 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22488 CHECK_ACCESS(this_ptr_ptr);
22489 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
22490 FREE((void*)this_ptr);
22491 Logger_free(this_ptr_conv);
22494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22495 LDKChannelHandshakeConfig this_obj_conv;
22496 this_obj_conv.inner = (void*)(this_obj & (~1));
22497 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22499 ChannelHandshakeConfig_free(this_obj_conv);
22502 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
22503 LDKChannelHandshakeConfig this_ptr_conv;
22504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22505 this_ptr_conv.is_owned = false;
22506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22507 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
22511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22512 LDKChannelHandshakeConfig this_ptr_conv;
22513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22514 this_ptr_conv.is_owned = false;
22515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22516 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
22519 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22520 LDKChannelHandshakeConfig this_ptr_conv;
22521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22522 this_ptr_conv.is_owned = false;
22523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22524 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
22528 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) {
22529 LDKChannelHandshakeConfig this_ptr_conv;
22530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22531 this_ptr_conv.is_owned = false;
22532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22533 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
22536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22537 LDKChannelHandshakeConfig this_ptr_conv;
22538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22539 this_ptr_conv.is_owned = false;
22540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22541 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
22545 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) {
22546 LDKChannelHandshakeConfig this_ptr_conv;
22547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22548 this_ptr_conv.is_owned = false;
22549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22550 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
22553 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) {
22554 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
22555 uintptr_t ret_ref = 0;
22556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22559 ret_ref = (uintptr_t)ret_var.inner;
22560 if (ret_var.is_owned) {
22566 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
22567 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
22568 uintptr_t ret_ref = 0;
22569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22572 ret_ref = (uintptr_t)ret_var.inner;
22573 if (ret_var.is_owned) {
22578 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22579 LDKChannelHandshakeConfig arg_conv;
22580 arg_conv.inner = (void*)(arg & (~1));
22581 arg_conv.is_owned = false;
22582 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22583 intptr_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
22587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22588 LDKChannelHandshakeConfig orig_conv;
22589 orig_conv.inner = (void*)(orig & (~1));
22590 orig_conv.is_owned = false;
22591 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22592 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
22593 uintptr_t ret_ref = 0;
22594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22597 ret_ref = (uintptr_t)ret_var.inner;
22598 if (ret_var.is_owned) {
22604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
22605 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
22606 uintptr_t ret_ref = 0;
22607 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22608 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22610 ret_ref = (uintptr_t)ret_var.inner;
22611 if (ret_var.is_owned) {
22617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22618 LDKChannelHandshakeLimits this_obj_conv;
22619 this_obj_conv.inner = (void*)(this_obj & (~1));
22620 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22622 ChannelHandshakeLimits_free(this_obj_conv);
22625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
22626 LDKChannelHandshakeLimits this_ptr_conv;
22627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22628 this_ptr_conv.is_owned = false;
22629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22630 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
22634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22635 LDKChannelHandshakeLimits this_ptr_conv;
22636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22637 this_ptr_conv.is_owned = false;
22638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22639 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
22642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22643 LDKChannelHandshakeLimits this_ptr_conv;
22644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22645 this_ptr_conv.is_owned = false;
22646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22647 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
22651 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) {
22652 LDKChannelHandshakeLimits this_ptr_conv;
22653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22654 this_ptr_conv.is_owned = false;
22655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22656 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
22659 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) {
22660 LDKChannelHandshakeLimits this_ptr_conv;
22661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22662 this_ptr_conv.is_owned = false;
22663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22664 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
22668 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) {
22669 LDKChannelHandshakeLimits this_ptr_conv;
22670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22671 this_ptr_conv.is_owned = false;
22672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22673 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
22677 LDKChannelHandshakeLimits this_ptr_conv;
22678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22679 this_ptr_conv.is_owned = false;
22680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22681 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
22685 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) {
22686 LDKChannelHandshakeLimits this_ptr_conv;
22687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22688 this_ptr_conv.is_owned = false;
22689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22690 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
22693 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22694 LDKChannelHandshakeLimits this_ptr_conv;
22695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22696 this_ptr_conv.is_owned = false;
22697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22698 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
22702 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) {
22703 LDKChannelHandshakeLimits this_ptr_conv;
22704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22705 this_ptr_conv.is_owned = false;
22706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22707 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
22710 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
22711 LDKChannelHandshakeLimits this_ptr_conv;
22712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22713 this_ptr_conv.is_owned = false;
22714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22715 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
22719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22720 LDKChannelHandshakeLimits this_ptr_conv;
22721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22722 this_ptr_conv.is_owned = false;
22723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22724 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
22727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
22728 LDKChannelHandshakeLimits this_ptr_conv;
22729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22730 this_ptr_conv.is_owned = false;
22731 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22732 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
22736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22737 LDKChannelHandshakeLimits this_ptr_conv;
22738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22739 this_ptr_conv.is_owned = false;
22740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22741 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
22744 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22745 LDKChannelHandshakeLimits this_ptr_conv;
22746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22747 this_ptr_conv.is_owned = false;
22748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22749 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
22753 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) {
22754 LDKChannelHandshakeLimits this_ptr_conv;
22755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22756 this_ptr_conv.is_owned = false;
22757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22758 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
22761 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) {
22762 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);
22763 uintptr_t ret_ref = 0;
22764 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22765 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22766 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22767 ret_ref = (uintptr_t)ret_var.inner;
22768 if (ret_var.is_owned) {
22774 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
22775 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
22776 uintptr_t ret_ref = 0;
22777 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22778 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22779 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22780 ret_ref = (uintptr_t)ret_var.inner;
22781 if (ret_var.is_owned) {
22786 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22787 LDKChannelHandshakeLimits arg_conv;
22788 arg_conv.inner = (void*)(arg & (~1));
22789 arg_conv.is_owned = false;
22790 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22791 intptr_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
22795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22796 LDKChannelHandshakeLimits orig_conv;
22797 orig_conv.inner = (void*)(orig & (~1));
22798 orig_conv.is_owned = false;
22799 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22800 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
22801 uintptr_t ret_ref = 0;
22802 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22803 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22805 ret_ref = (uintptr_t)ret_var.inner;
22806 if (ret_var.is_owned) {
22812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
22813 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
22814 uintptr_t ret_ref = 0;
22815 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22816 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22817 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22818 ret_ref = (uintptr_t)ret_var.inner;
22819 if (ret_var.is_owned) {
22825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22826 LDKChannelConfig this_obj_conv;
22827 this_obj_conv.inner = (void*)(this_obj & (~1));
22828 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22830 ChannelConfig_free(this_obj_conv);
22833 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
22834 LDKChannelConfig this_ptr_conv;
22835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22836 this_ptr_conv.is_owned = false;
22837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22838 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
22842 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) {
22843 LDKChannelConfig this_ptr_conv;
22844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22845 this_ptr_conv.is_owned = false;
22846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22847 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
22850 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22851 LDKChannelConfig this_ptr_conv;
22852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22853 this_ptr_conv.is_owned = false;
22854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22855 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
22859 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) {
22860 LDKChannelConfig this_ptr_conv;
22861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22862 this_ptr_conv.is_owned = false;
22863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22864 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
22867 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22868 LDKChannelConfig this_ptr_conv;
22869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22870 this_ptr_conv.is_owned = false;
22871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22872 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
22876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22877 LDKChannelConfig this_ptr_conv;
22878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22879 this_ptr_conv.is_owned = false;
22880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22881 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
22884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
22885 LDKChannelConfig this_ptr_conv;
22886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22887 this_ptr_conv.is_owned = false;
22888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22889 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
22893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22894 LDKChannelConfig this_ptr_conv;
22895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22896 this_ptr_conv.is_owned = false;
22897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22898 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
22901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22902 LDKChannelConfig this_ptr_conv;
22903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22904 this_ptr_conv.is_owned = false;
22905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22906 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
22910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22911 LDKChannelConfig this_ptr_conv;
22912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22913 this_ptr_conv.is_owned = false;
22914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22915 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
22918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22919 LDKChannelConfig this_ptr_conv;
22920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22921 this_ptr_conv.is_owned = false;
22922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22923 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
22927 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) {
22928 LDKChannelConfig this_ptr_conv;
22929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22930 this_ptr_conv.is_owned = false;
22931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22932 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
22935 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) {
22936 LDKChannelConfig this_ptr_conv;
22937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22938 this_ptr_conv.is_owned = false;
22939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22940 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
22944 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) {
22945 LDKChannelConfig this_ptr_conv;
22946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22947 this_ptr_conv.is_owned = false;
22948 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22949 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
22952 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) {
22953 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);
22954 uintptr_t ret_ref = 0;
22955 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22956 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22957 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22958 ret_ref = (uintptr_t)ret_var.inner;
22959 if (ret_var.is_owned) {
22965 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
22966 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
22967 uintptr_t ret_ref = 0;
22968 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22969 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22970 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22971 ret_ref = (uintptr_t)ret_var.inner;
22972 if (ret_var.is_owned) {
22977 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22978 LDKChannelConfig arg_conv;
22979 arg_conv.inner = (void*)(arg & (~1));
22980 arg_conv.is_owned = false;
22981 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22982 intptr_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
22986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22987 LDKChannelConfig orig_conv;
22988 orig_conv.inner = (void*)(orig & (~1));
22989 orig_conv.is_owned = false;
22990 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22991 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
22992 uintptr_t ret_ref = 0;
22993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22996 ret_ref = (uintptr_t)ret_var.inner;
22997 if (ret_var.is_owned) {
23003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
23004 LDKChannelConfig ret_var = ChannelConfig_default();
23005 uintptr_t ret_ref = 0;
23006 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23007 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23009 ret_ref = (uintptr_t)ret_var.inner;
23010 if (ret_var.is_owned) {
23016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
23017 LDKChannelConfig obj_conv;
23018 obj_conv.inner = (void*)(obj & (~1));
23019 obj_conv.is_owned = false;
23020 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23021 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
23022 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23023 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23024 CVec_u8Z_free(ret_var);
23028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23029 LDKu8slice ser_ref;
23030 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23031 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23032 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23033 *ret_conv = ChannelConfig_read(ser_ref);
23034 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23035 return (uintptr_t)ret_conv;
23038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23039 LDKUserConfig this_obj_conv;
23040 this_obj_conv.inner = (void*)(this_obj & (~1));
23041 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23043 UserConfig_free(this_obj_conv);
23046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
23047 LDKUserConfig this_ptr_conv;
23048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23049 this_ptr_conv.is_owned = false;
23050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23051 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
23052 uintptr_t ret_ref = 0;
23053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23056 ret_ref = (uintptr_t)ret_var.inner;
23057 if (ret_var.is_owned) {
23063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23064 LDKUserConfig this_ptr_conv;
23065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23066 this_ptr_conv.is_owned = false;
23067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23068 LDKChannelHandshakeConfig val_conv;
23069 val_conv.inner = (void*)(val & (~1));
23070 val_conv.is_owned = (val & 1) || (val == 0);
23071 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23072 val_conv = ChannelHandshakeConfig_clone(&val_conv);
23073 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
23076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
23077 LDKUserConfig this_ptr_conv;
23078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23079 this_ptr_conv.is_owned = false;
23080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23081 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
23082 uintptr_t ret_ref = 0;
23083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23086 ret_ref = (uintptr_t)ret_var.inner;
23087 if (ret_var.is_owned) {
23093 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) {
23094 LDKUserConfig this_ptr_conv;
23095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23096 this_ptr_conv.is_owned = false;
23097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23098 LDKChannelHandshakeLimits val_conv;
23099 val_conv.inner = (void*)(val & (~1));
23100 val_conv.is_owned = (val & 1) || (val == 0);
23101 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23102 val_conv = ChannelHandshakeLimits_clone(&val_conv);
23103 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
23106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
23107 LDKUserConfig this_ptr_conv;
23108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23109 this_ptr_conv.is_owned = false;
23110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23111 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
23112 uintptr_t ret_ref = 0;
23113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23116 ret_ref = (uintptr_t)ret_var.inner;
23117 if (ret_var.is_owned) {
23123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23124 LDKUserConfig this_ptr_conv;
23125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23126 this_ptr_conv.is_owned = false;
23127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23128 LDKChannelConfig val_conv;
23129 val_conv.inner = (void*)(val & (~1));
23130 val_conv.is_owned = (val & 1) || (val == 0);
23131 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23132 val_conv = ChannelConfig_clone(&val_conv);
23133 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
23136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
23137 LDKUserConfig this_ptr_conv;
23138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23139 this_ptr_conv.is_owned = false;
23140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23141 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
23145 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) {
23146 LDKUserConfig this_ptr_conv;
23147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23148 this_ptr_conv.is_owned = false;
23149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23150 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
23153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
23154 LDKUserConfig this_ptr_conv;
23155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23156 this_ptr_conv.is_owned = false;
23157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23158 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
23162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23163 LDKUserConfig this_ptr_conv;
23164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23165 this_ptr_conv.is_owned = false;
23166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23167 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
23170 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, jboolean accept_inbound_channels_arg) {
23171 LDKChannelHandshakeConfig own_channel_config_arg_conv;
23172 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
23173 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
23174 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
23175 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
23176 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
23177 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
23178 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
23179 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
23180 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
23181 LDKChannelConfig channel_options_arg_conv;
23182 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
23183 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
23184 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
23185 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
23186 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, accept_inbound_channels_arg);
23187 uintptr_t ret_ref = 0;
23188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23191 ret_ref = (uintptr_t)ret_var.inner;
23192 if (ret_var.is_owned) {
23198 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
23199 LDKUserConfig ret_var = UserConfig_clone(arg);
23200 uintptr_t ret_ref = 0;
23201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23204 ret_ref = (uintptr_t)ret_var.inner;
23205 if (ret_var.is_owned) {
23210 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23211 LDKUserConfig arg_conv;
23212 arg_conv.inner = (void*)(arg & (~1));
23213 arg_conv.is_owned = false;
23214 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23215 intptr_t ret_val = UserConfig_clone_ptr(&arg_conv);
23219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23220 LDKUserConfig orig_conv;
23221 orig_conv.inner = (void*)(orig & (~1));
23222 orig_conv.is_owned = false;
23223 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23224 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
23225 uintptr_t ret_ref = 0;
23226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23229 ret_ref = (uintptr_t)ret_var.inner;
23230 if (ret_var.is_owned) {
23236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
23237 LDKUserConfig ret_var = UserConfig_default();
23238 uintptr_t ret_ref = 0;
23239 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23240 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23242 ret_ref = (uintptr_t)ret_var.inner;
23243 if (ret_var.is_owned) {
23249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23250 LDKBestBlock this_obj_conv;
23251 this_obj_conv.inner = (void*)(this_obj & (~1));
23252 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23254 BestBlock_free(this_obj_conv);
23257 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
23258 LDKBestBlock ret_var = BestBlock_clone(arg);
23259 uintptr_t ret_ref = 0;
23260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23263 ret_ref = (uintptr_t)ret_var.inner;
23264 if (ret_var.is_owned) {
23269 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23270 LDKBestBlock arg_conv;
23271 arg_conv.inner = (void*)(arg & (~1));
23272 arg_conv.is_owned = false;
23273 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23274 intptr_t ret_val = BestBlock_clone_ptr(&arg_conv);
23278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23279 LDKBestBlock orig_conv;
23280 orig_conv.inner = (void*)(orig & (~1));
23281 orig_conv.is_owned = false;
23282 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23283 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
23284 uintptr_t ret_ref = 0;
23285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23288 ret_ref = (uintptr_t)ret_var.inner;
23289 if (ret_var.is_owned) {
23295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
23296 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
23297 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
23298 uintptr_t ret_ref = 0;
23299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23302 ret_ref = (uintptr_t)ret_var.inner;
23303 if (ret_var.is_owned) {
23309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
23310 LDKThirtyTwoBytes block_hash_ref;
23311 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
23312 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
23313 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
23314 uintptr_t ret_ref = 0;
23315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23318 ret_ref = (uintptr_t)ret_var.inner;
23319 if (ret_var.is_owned) {
23325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
23326 LDKBestBlock this_arg_conv;
23327 this_arg_conv.inner = (void*)(this_arg & (~1));
23328 this_arg_conv.is_owned = false;
23329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23330 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23331 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
23335 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
23336 LDKBestBlock this_arg_conv;
23337 this_arg_conv.inner = (void*)(this_arg & (~1));
23338 this_arg_conv.is_owned = false;
23339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23340 int32_t ret_val = BestBlock_height(&this_arg_conv);
23344 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23345 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
23346 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
23350 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
23351 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
23355 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
23356 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
23360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23361 if ((this_ptr & 1) != 0) return;
23362 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23363 CHECK_ACCESS(this_ptr_ptr);
23364 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
23365 FREE((void*)this_ptr);
23366 Access_free(this_ptr_conv);
23369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23370 if ((this_ptr & 1) != 0) return;
23371 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23372 CHECK_ACCESS(this_ptr_ptr);
23373 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
23374 FREE((void*)this_ptr);
23375 Listen_free(this_ptr_conv);
23378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23379 if ((this_ptr & 1) != 0) return;
23380 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23381 CHECK_ACCESS(this_ptr_ptr);
23382 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
23383 FREE((void*)this_ptr);
23384 Confirm_free(this_ptr_conv);
23387 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23388 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
23389 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
23393 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
23394 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
23398 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
23399 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
23403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23404 if ((this_ptr & 1) != 0) return;
23405 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23406 CHECK_ACCESS(this_ptr_ptr);
23407 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
23408 FREE((void*)this_ptr);
23409 Watch_free(this_ptr_conv);
23412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23413 if ((this_ptr & 1) != 0) return;
23414 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23415 CHECK_ACCESS(this_ptr_ptr);
23416 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
23417 FREE((void*)this_ptr);
23418 Filter_free(this_ptr_conv);
23421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23422 LDKWatchedOutput this_obj_conv;
23423 this_obj_conv.inner = (void*)(this_obj & (~1));
23424 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23426 WatchedOutput_free(this_obj_conv);
23429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23430 LDKWatchedOutput this_ptr_conv;
23431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23432 this_ptr_conv.is_owned = false;
23433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23434 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
23439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23440 LDKWatchedOutput this_ptr_conv;
23441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23442 this_ptr_conv.is_owned = false;
23443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23444 LDKThirtyTwoBytes val_ref;
23445 CHECK((*env)->GetArrayLength(env, val) == 32);
23446 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23447 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
23450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
23451 LDKWatchedOutput this_ptr_conv;
23452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23453 this_ptr_conv.is_owned = false;
23454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23455 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
23456 uintptr_t ret_ref = 0;
23457 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23458 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23460 ret_ref = (uintptr_t)ret_var.inner;
23461 if (ret_var.is_owned) {
23467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23468 LDKWatchedOutput this_ptr_conv;
23469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23470 this_ptr_conv.is_owned = false;
23471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23472 LDKOutPoint val_conv;
23473 val_conv.inner = (void*)(val & (~1));
23474 val_conv.is_owned = (val & 1) || (val == 0);
23475 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23476 val_conv = OutPoint_clone(&val_conv);
23477 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
23480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
23481 LDKWatchedOutput this_ptr_conv;
23482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23483 this_ptr_conv.is_owned = false;
23484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23485 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
23486 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23487 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23492 LDKWatchedOutput this_ptr_conv;
23493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23494 this_ptr_conv.is_owned = false;
23495 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23496 LDKCVec_u8Z val_ref;
23497 val_ref.datalen = (*env)->GetArrayLength(env, val);
23498 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23499 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
23500 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
23503 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) {
23504 LDKThirtyTwoBytes block_hash_arg_ref;
23505 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
23506 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
23507 LDKOutPoint outpoint_arg_conv;
23508 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
23509 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
23510 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23511 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23512 LDKCVec_u8Z script_pubkey_arg_ref;
23513 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
23514 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23515 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
23516 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
23517 uintptr_t ret_ref = 0;
23518 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23519 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23521 ret_ref = (uintptr_t)ret_var.inner;
23522 if (ret_var.is_owned) {
23528 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
23529 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
23530 uintptr_t ret_ref = 0;
23531 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23532 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23533 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23534 ret_ref = (uintptr_t)ret_var.inner;
23535 if (ret_var.is_owned) {
23540 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23541 LDKWatchedOutput arg_conv;
23542 arg_conv.inner = (void*)(arg & (~1));
23543 arg_conv.is_owned = false;
23544 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23545 intptr_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
23549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23550 LDKWatchedOutput orig_conv;
23551 orig_conv.inner = (void*)(orig & (~1));
23552 orig_conv.is_owned = false;
23553 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23554 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
23555 uintptr_t ret_ref = 0;
23556 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23557 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23559 ret_ref = (uintptr_t)ret_var.inner;
23560 if (ret_var.is_owned) {
23566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
23567 LDKWatchedOutput o_conv;
23568 o_conv.inner = (void*)(o & (~1));
23569 o_conv.is_owned = false;
23570 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23571 int64_t ret_val = WatchedOutput_hash(&o_conv);
23575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23576 if ((this_ptr & 1) != 0) return;
23577 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23578 CHECK_ACCESS(this_ptr_ptr);
23579 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
23580 FREE((void*)this_ptr);
23581 BroadcasterInterface_free(this_ptr_conv);
23584 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23585 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
23586 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
23590 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
23591 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
23595 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
23596 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
23600 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
23601 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
23605 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23606 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
23607 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
23608 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
23612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23613 if ((this_ptr & 1) != 0) return;
23614 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23615 CHECK_ACCESS(this_ptr_ptr);
23616 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
23617 FREE((void*)this_ptr);
23618 FeeEstimator_free(this_ptr_conv);
23621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23622 LDKMonitorUpdateId this_obj_conv;
23623 this_obj_conv.inner = (void*)(this_obj & (~1));
23624 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23626 MonitorUpdateId_free(this_obj_conv);
23629 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
23630 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
23631 uintptr_t ret_ref = 0;
23632 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23633 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23634 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23635 ret_ref = (uintptr_t)ret_var.inner;
23636 if (ret_var.is_owned) {
23641 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23642 LDKMonitorUpdateId arg_conv;
23643 arg_conv.inner = (void*)(arg & (~1));
23644 arg_conv.is_owned = false;
23645 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23646 intptr_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
23650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23651 LDKMonitorUpdateId orig_conv;
23652 orig_conv.inner = (void*)(orig & (~1));
23653 orig_conv.is_owned = false;
23654 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23655 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
23656 uintptr_t ret_ref = 0;
23657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23660 ret_ref = (uintptr_t)ret_var.inner;
23661 if (ret_var.is_owned) {
23667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
23668 LDKMonitorUpdateId o_conv;
23669 o_conv.inner = (void*)(o & (~1));
23670 o_conv.is_owned = false;
23671 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23672 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
23676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23677 LDKMonitorUpdateId a_conv;
23678 a_conv.inner = (void*)(a & (~1));
23679 a_conv.is_owned = false;
23680 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23681 LDKMonitorUpdateId b_conv;
23682 b_conv.inner = (void*)(b & (~1));
23683 b_conv.is_owned = false;
23684 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23685 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
23689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23690 if ((this_ptr & 1) != 0) return;
23691 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23692 CHECK_ACCESS(this_ptr_ptr);
23693 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
23694 FREE((void*)this_ptr);
23695 Persist_free(this_ptr_conv);
23698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23699 LDKLockedChannelMonitor this_obj_conv;
23700 this_obj_conv.inner = (void*)(this_obj & (~1));
23701 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23703 LockedChannelMonitor_free(this_obj_conv);
23706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23707 LDKChainMonitor this_obj_conv;
23708 this_obj_conv.inner = (void*)(this_obj & (~1));
23709 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23711 ChainMonitor_free(this_obj_conv);
23714 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) {
23715 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
23716 CHECK_ACCESS(chain_source_ptr);
23717 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
23718 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
23719 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
23720 // Manually implement clone for Java trait instances
23721 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
23722 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23723 LDKFilter_JCalls_cloned(&chain_source_conv.some);
23726 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
23727 CHECK_ACCESS(broadcaster_ptr);
23728 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23729 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23730 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23731 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23733 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
23734 CHECK_ACCESS(logger_ptr);
23735 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23736 if (logger_conv.free == LDKLogger_JCalls_free) {
23737 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23738 LDKLogger_JCalls_cloned(&logger_conv);
23740 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
23741 CHECK_ACCESS(feeest_ptr);
23742 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
23743 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
23744 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23745 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
23747 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
23748 CHECK_ACCESS(persister_ptr);
23749 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
23750 if (persister_conv.free == LDKPersist_JCalls_free) {
23751 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23752 LDKPersist_JCalls_cloned(&persister_conv);
23754 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
23755 uintptr_t ret_ref = 0;
23756 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23757 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23759 ret_ref = (uintptr_t)ret_var.inner;
23760 if (ret_var.is_owned) {
23766 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) {
23767 LDKChainMonitor this_arg_conv;
23768 this_arg_conv.inner = (void*)(this_arg & (~1));
23769 this_arg_conv.is_owned = false;
23770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23771 LDKCVec_ChannelDetailsZ ignored_channels_constr;
23772 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
23773 if (ignored_channels_constr.datalen > 0)
23774 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23776 ignored_channels_constr.data = NULL;
23777 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
23778 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
23779 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
23780 LDKChannelDetails ignored_channels_conv_16_conv;
23781 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
23782 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
23783 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
23784 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
23785 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
23787 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
23788 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
23789 int64_tArray ret_arr = NULL;
23790 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23791 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23792 for (size_t j = 0; j < ret_var.datalen; j++) {
23793 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23794 *ret_conv_9_copy = ret_var.data[j];
23795 uintptr_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
23796 ret_arr_ptr[j] = ret_conv_9_ref;
23798 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23799 FREE(ret_var.data);
23803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
23804 LDKChainMonitor this_arg_conv;
23805 this_arg_conv.inner = (void*)(this_arg & (~1));
23806 this_arg_conv.is_owned = false;
23807 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23808 LDKOutPoint funding_txo_conv;
23809 funding_txo_conv.inner = (void*)(funding_txo & (~1));
23810 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
23811 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23812 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23813 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23814 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
23815 return (uintptr_t)ret_conv;
23818 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
23819 LDKChainMonitor this_arg_conv;
23820 this_arg_conv.inner = (void*)(this_arg & (~1));
23821 this_arg_conv.is_owned = false;
23822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23823 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
23824 int64_tArray ret_arr = NULL;
23825 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
23826 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
23827 for (size_t k = 0; k < ret_var.datalen; k++) {
23828 LDKOutPoint ret_conv_10_var = ret_var.data[k];
23829 uintptr_t ret_conv_10_ref = 0;
23830 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23831 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
23833 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
23834 if (ret_conv_10_var.is_owned) {
23835 ret_conv_10_ref |= 1;
23837 ret_arr_ptr[k] = ret_conv_10_ref;
23839 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
23840 FREE(ret_var.data);
23844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t completed_update_id) {
23845 LDKChainMonitor this_arg_conv;
23846 this_arg_conv.inner = (void*)(this_arg & (~1));
23847 this_arg_conv.is_owned = false;
23848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23849 LDKOutPoint funding_txo_conv;
23850 funding_txo_conv.inner = (void*)(funding_txo & (~1));
23851 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
23852 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23853 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23854 LDKMonitorUpdateId completed_update_id_conv;
23855 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
23856 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
23857 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
23858 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
23859 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
23860 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
23861 return (uintptr_t)ret_conv;
23864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
23865 LDKChainMonitor this_arg_conv;
23866 this_arg_conv.inner = (void*)(this_arg & (~1));
23867 this_arg_conv.is_owned = false;
23868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23869 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
23870 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
23871 return (uintptr_t)ret_ret;
23874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
23875 LDKChainMonitor this_arg_conv;
23876 this_arg_conv.inner = (void*)(this_arg & (~1));
23877 this_arg_conv.is_owned = false;
23878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23879 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
23880 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
23881 return (uintptr_t)ret_ret;
23884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
23885 LDKChainMonitor this_arg_conv;
23886 this_arg_conv.inner = (void*)(this_arg & (~1));
23887 this_arg_conv.is_owned = false;
23888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23889 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
23890 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
23891 return (uintptr_t)ret_ret;
23894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23895 LDKChainMonitor this_arg_conv;
23896 this_arg_conv.inner = (void*)(this_arg & (~1));
23897 this_arg_conv.is_owned = false;
23898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23899 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
23900 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
23901 return (uintptr_t)ret_ret;
23904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23905 LDKChannelMonitorUpdate this_obj_conv;
23906 this_obj_conv.inner = (void*)(this_obj & (~1));
23907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23909 ChannelMonitorUpdate_free(this_obj_conv);
23912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23913 LDKChannelMonitorUpdate this_ptr_conv;
23914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23915 this_ptr_conv.is_owned = false;
23916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23917 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
23921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23922 LDKChannelMonitorUpdate this_ptr_conv;
23923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23924 this_ptr_conv.is_owned = false;
23925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23926 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
23929 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
23930 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
23931 uintptr_t ret_ref = 0;
23932 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23933 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23935 ret_ref = (uintptr_t)ret_var.inner;
23936 if (ret_var.is_owned) {
23941 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23942 LDKChannelMonitorUpdate arg_conv;
23943 arg_conv.inner = (void*)(arg & (~1));
23944 arg_conv.is_owned = false;
23945 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23946 intptr_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
23950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23951 LDKChannelMonitorUpdate orig_conv;
23952 orig_conv.inner = (void*)(orig & (~1));
23953 orig_conv.is_owned = false;
23954 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23955 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
23956 uintptr_t ret_ref = 0;
23957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23960 ret_ref = (uintptr_t)ret_var.inner;
23961 if (ret_var.is_owned) {
23967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
23968 LDKChannelMonitorUpdate obj_conv;
23969 obj_conv.inner = (void*)(obj & (~1));
23970 obj_conv.is_owned = false;
23971 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23972 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
23973 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23974 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23975 CVec_u8Z_free(ret_var);
23979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23980 LDKu8slice ser_ref;
23981 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23982 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23983 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23984 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
23985 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23986 return (uintptr_t)ret_conv;
23989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23990 if ((this_ptr & 1) != 0) return;
23991 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23992 CHECK_ACCESS(this_ptr_ptr);
23993 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
23994 FREE((void*)this_ptr);
23995 MonitorEvent_free(this_ptr_conv);
23998 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
23999 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24000 *ret_copy = MonitorEvent_clone(arg);
24001 uintptr_t ret_ref = (uintptr_t)ret_copy;
24004 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24005 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
24006 intptr_t ret_val = MonitorEvent_clone_ptr(arg_conv);
24010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24011 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
24012 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24013 *ret_copy = MonitorEvent_clone(orig_conv);
24014 uintptr_t ret_ref = (uintptr_t)ret_copy;
24018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
24019 LDKHTLCUpdate a_conv;
24020 a_conv.inner = (void*)(a & (~1));
24021 a_conv.is_owned = (a & 1) || (a == 0);
24022 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24023 a_conv = HTLCUpdate_clone(&a_conv);
24024 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24025 *ret_copy = MonitorEvent_htlcevent(a_conv);
24026 uintptr_t ret_ref = (uintptr_t)ret_copy;
24030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
24031 LDKOutPoint a_conv;
24032 a_conv.inner = (void*)(a & (~1));
24033 a_conv.is_owned = (a & 1) || (a == 0);
24034 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24035 a_conv = OutPoint_clone(&a_conv);
24036 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24037 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
24038 uintptr_t ret_ref = (uintptr_t)ret_copy;
24042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t monitor_update_id) {
24043 LDKOutPoint funding_txo_conv;
24044 funding_txo_conv.inner = (void*)(funding_txo & (~1));
24045 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
24046 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24047 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24048 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24049 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
24050 uintptr_t ret_ref = (uintptr_t)ret_copy;
24054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
24055 LDKOutPoint a_conv;
24056 a_conv.inner = (void*)(a & (~1));
24057 a_conv.is_owned = (a & 1) || (a == 0);
24058 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24059 a_conv = OutPoint_clone(&a_conv);
24060 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24061 *ret_copy = MonitorEvent_update_failed(a_conv);
24062 uintptr_t ret_ref = (uintptr_t)ret_copy;
24066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
24067 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
24068 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
24069 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24070 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24071 CVec_u8Z_free(ret_var);
24075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24076 LDKu8slice ser_ref;
24077 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24078 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24079 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
24080 *ret_conv = MonitorEvent_read(ser_ref);
24081 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24082 return (uintptr_t)ret_conv;
24085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24086 LDKHTLCUpdate this_obj_conv;
24087 this_obj_conv.inner = (void*)(this_obj & (~1));
24088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24090 HTLCUpdate_free(this_obj_conv);
24093 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
24094 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
24095 uintptr_t ret_ref = 0;
24096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24099 ret_ref = (uintptr_t)ret_var.inner;
24100 if (ret_var.is_owned) {
24105 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24106 LDKHTLCUpdate arg_conv;
24107 arg_conv.inner = (void*)(arg & (~1));
24108 arg_conv.is_owned = false;
24109 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24110 intptr_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
24114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24115 LDKHTLCUpdate orig_conv;
24116 orig_conv.inner = (void*)(orig & (~1));
24117 orig_conv.is_owned = false;
24118 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24119 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
24120 uintptr_t ret_ref = 0;
24121 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24122 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24123 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24124 ret_ref = (uintptr_t)ret_var.inner;
24125 if (ret_var.is_owned) {
24131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
24132 LDKHTLCUpdate obj_conv;
24133 obj_conv.inner = (void*)(obj & (~1));
24134 obj_conv.is_owned = false;
24135 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24136 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
24137 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24138 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24139 CVec_u8Z_free(ret_var);
24143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24144 LDKu8slice ser_ref;
24145 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24146 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24147 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
24148 *ret_conv = HTLCUpdate_read(ser_ref);
24149 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24150 return (uintptr_t)ret_conv;
24153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24154 if ((this_ptr & 1) != 0) return;
24155 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24156 CHECK_ACCESS(this_ptr_ptr);
24157 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
24158 FREE((void*)this_ptr);
24159 Balance_free(this_ptr_conv);
24162 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
24163 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24164 *ret_copy = Balance_clone(arg);
24165 uintptr_t ret_ref = (uintptr_t)ret_copy;
24168 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24169 LDKBalance* arg_conv = (LDKBalance*)arg;
24170 intptr_t ret_val = Balance_clone_ptr(arg_conv);
24174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24175 LDKBalance* orig_conv = (LDKBalance*)orig;
24176 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24177 *ret_copy = Balance_clone(orig_conv);
24178 uintptr_t ret_ref = (uintptr_t)ret_copy;
24182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
24183 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24184 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
24185 uintptr_t ret_ref = (uintptr_t)ret_copy;
24189 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) {
24190 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24191 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
24192 uintptr_t ret_ref = (uintptr_t)ret_copy;
24196 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) {
24197 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24198 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
24199 uintptr_t ret_ref = (uintptr_t)ret_copy;
24203 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) {
24204 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24205 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
24206 uintptr_t ret_ref = (uintptr_t)ret_copy;
24210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24211 LDKBalance* a_conv = (LDKBalance*)a;
24212 LDKBalance* b_conv = (LDKBalance*)b;
24213 jboolean ret_val = Balance_eq(a_conv, b_conv);
24217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24218 LDKChannelMonitor this_obj_conv;
24219 this_obj_conv.inner = (void*)(this_obj & (~1));
24220 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24222 ChannelMonitor_free(this_obj_conv);
24225 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
24226 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
24227 uintptr_t ret_ref = 0;
24228 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24229 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24230 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24231 ret_ref = (uintptr_t)ret_var.inner;
24232 if (ret_var.is_owned) {
24237 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24238 LDKChannelMonitor arg_conv;
24239 arg_conv.inner = (void*)(arg & (~1));
24240 arg_conv.is_owned = false;
24241 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24242 intptr_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
24246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24247 LDKChannelMonitor orig_conv;
24248 orig_conv.inner = (void*)(orig & (~1));
24249 orig_conv.is_owned = false;
24250 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24251 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
24252 uintptr_t ret_ref = 0;
24253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24256 ret_ref = (uintptr_t)ret_var.inner;
24257 if (ret_var.is_owned) {
24263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
24264 LDKChannelMonitor obj_conv;
24265 obj_conv.inner = (void*)(obj & (~1));
24266 obj_conv.is_owned = false;
24267 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24268 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
24269 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24270 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24271 CVec_u8Z_free(ret_var);
24275 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) {
24276 LDKChannelMonitor this_arg_conv;
24277 this_arg_conv.inner = (void*)(this_arg & (~1));
24278 this_arg_conv.is_owned = false;
24279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24280 LDKChannelMonitorUpdate updates_conv;
24281 updates_conv.inner = (void*)(updates & (~1));
24282 updates_conv.is_owned = false;
24283 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
24284 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24285 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
24286 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
24287 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24288 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
24289 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
24290 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24291 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
24292 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24293 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
24294 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
24295 return (uintptr_t)ret_conv;
24298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
24299 LDKChannelMonitor this_arg_conv;
24300 this_arg_conv.inner = (void*)(this_arg & (~1));
24301 this_arg_conv.is_owned = false;
24302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24303 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
24307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
24308 LDKChannelMonitor this_arg_conv;
24309 this_arg_conv.inner = (void*)(this_arg & (~1));
24310 this_arg_conv.is_owned = false;
24311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24312 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
24313 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
24314 return ((uintptr_t)ret_conv);
24317 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
24318 LDKChannelMonitor this_arg_conv;
24319 this_arg_conv.inner = (void*)(this_arg & (~1));
24320 this_arg_conv.is_owned = false;
24321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24322 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
24323 int64_tArray ret_arr = NULL;
24324 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24325 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24326 for (size_t o = 0; o < ret_var.datalen; o++) {
24327 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
24328 *ret_conv_40_conv = ret_var.data[o];
24329 ret_arr_ptr[o] = ((uintptr_t)ret_conv_40_conv);
24331 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24332 FREE(ret_var.data);
24336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
24337 LDKChannelMonitor this_arg_conv;
24338 this_arg_conv.inner = (void*)(this_arg & (~1));
24339 this_arg_conv.is_owned = false;
24340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24341 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
24342 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
24343 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
24344 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
24347 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
24348 LDKChannelMonitor this_arg_conv;
24349 this_arg_conv.inner = (void*)(this_arg & (~1));
24350 this_arg_conv.is_owned = false;
24351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24352 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
24353 int64_tArray ret_arr = NULL;
24354 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24355 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24356 for (size_t o = 0; o < ret_var.datalen; o++) {
24357 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24358 *ret_conv_14_copy = ret_var.data[o];
24359 uintptr_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
24360 ret_arr_ptr[o] = ret_conv_14_ref;
24362 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24363 FREE(ret_var.data);
24367 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
24368 LDKChannelMonitor this_arg_conv;
24369 this_arg_conv.inner = (void*)(this_arg & (~1));
24370 this_arg_conv.is_owned = false;
24371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24372 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
24373 int64_tArray ret_arr = NULL;
24374 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24375 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24376 for (size_t h = 0; h < ret_var.datalen; h++) {
24377 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24378 *ret_conv_7_copy = ret_var.data[h];
24379 uintptr_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
24380 ret_arr_ptr[h] = ret_conv_7_ref;
24382 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24383 FREE(ret_var.data);
24387 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) {
24388 LDKChannelMonitor this_arg_conv;
24389 this_arg_conv.inner = (void*)(this_arg & (~1));
24390 this_arg_conv.is_owned = false;
24391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24392 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24393 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
24394 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24395 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
24396 jobjectArray ret_arr = NULL;
24397 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
24399 for (size_t i = 0; i < ret_var.datalen; i++) {
24400 LDKTransaction ret_conv_8_var = ret_var.data[i];
24401 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
24402 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
24403 Transaction_free(ret_conv_8_var);
24404 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
24407 FREE(ret_var.data);
24411 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) {
24412 LDKChannelMonitor this_arg_conv;
24413 this_arg_conv.inner = (void*)(this_arg & (~1));
24414 this_arg_conv.is_owned = false;
24415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24416 unsigned char header_arr[80];
24417 CHECK((*env)->GetArrayLength(env, header) == 80);
24418 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
24419 unsigned char (*header_ref)[80] = &header_arr;
24420 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24421 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
24422 if (txdata_constr.datalen > 0)
24423 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24425 txdata_constr.data = NULL;
24426 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
24427 for (size_t c = 0; c < txdata_constr.datalen; c++) {
24428 int64_t txdata_conv_28 = txdata_vals[c];
24429 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
24430 CHECK_ACCESS(txdata_conv_28_ptr);
24431 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24432 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
24433 txdata_constr.data[c] = txdata_conv_28_conv;
24435 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
24436 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24437 CHECK_ACCESS(broadcaster_ptr);
24438 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24439 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24440 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24441 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24443 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24444 CHECK_ACCESS(fee_estimator_ptr);
24445 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24446 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24447 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24448 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24450 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24451 CHECK_ACCESS(logger_ptr);
24452 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24453 if (logger_conv.free == LDKLogger_JCalls_free) {
24454 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24455 LDKLogger_JCalls_cloned(&logger_conv);
24457 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);
24458 int64_tArray ret_arr = NULL;
24459 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24460 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24461 for (size_t n = 0; n < ret_var.datalen; n++) {
24462 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24463 *ret_conv_39_conv = ret_var.data[n];
24464 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
24466 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24467 FREE(ret_var.data);
24471 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) {
24472 LDKChannelMonitor this_arg_conv;
24473 this_arg_conv.inner = (void*)(this_arg & (~1));
24474 this_arg_conv.is_owned = false;
24475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24476 unsigned char header_arr[80];
24477 CHECK((*env)->GetArrayLength(env, header) == 80);
24478 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
24479 unsigned char (*header_ref)[80] = &header_arr;
24480 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24481 CHECK_ACCESS(broadcaster_ptr);
24482 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24483 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24484 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24485 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24487 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24488 CHECK_ACCESS(fee_estimator_ptr);
24489 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24490 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24491 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24492 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24494 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24495 CHECK_ACCESS(logger_ptr);
24496 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24497 if (logger_conv.free == LDKLogger_JCalls_free) {
24498 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24499 LDKLogger_JCalls_cloned(&logger_conv);
24501 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24504 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) {
24505 LDKChannelMonitor this_arg_conv;
24506 this_arg_conv.inner = (void*)(this_arg & (~1));
24507 this_arg_conv.is_owned = false;
24508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24509 unsigned char header_arr[80];
24510 CHECK((*env)->GetArrayLength(env, header) == 80);
24511 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
24512 unsigned char (*header_ref)[80] = &header_arr;
24513 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24514 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
24515 if (txdata_constr.datalen > 0)
24516 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24518 txdata_constr.data = NULL;
24519 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
24520 for (size_t c = 0; c < txdata_constr.datalen; c++) {
24521 int64_t txdata_conv_28 = txdata_vals[c];
24522 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
24523 CHECK_ACCESS(txdata_conv_28_ptr);
24524 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24525 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
24526 txdata_constr.data[c] = txdata_conv_28_conv;
24528 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
24529 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24530 CHECK_ACCESS(broadcaster_ptr);
24531 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24532 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24533 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24534 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24536 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24537 CHECK_ACCESS(fee_estimator_ptr);
24538 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24539 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24540 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24541 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24543 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24544 CHECK_ACCESS(logger_ptr);
24545 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24546 if (logger_conv.free == LDKLogger_JCalls_free) {
24547 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24548 LDKLogger_JCalls_cloned(&logger_conv);
24550 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);
24551 int64_tArray ret_arr = NULL;
24552 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24553 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24554 for (size_t n = 0; n < ret_var.datalen; n++) {
24555 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24556 *ret_conv_39_conv = ret_var.data[n];
24557 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
24559 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24560 FREE(ret_var.data);
24564 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) {
24565 LDKChannelMonitor this_arg_conv;
24566 this_arg_conv.inner = (void*)(this_arg & (~1));
24567 this_arg_conv.is_owned = false;
24568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24569 unsigned char txid_arr[32];
24570 CHECK((*env)->GetArrayLength(env, txid) == 32);
24571 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
24572 unsigned char (*txid_ref)[32] = &txid_arr;
24573 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24574 CHECK_ACCESS(broadcaster_ptr);
24575 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24576 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24577 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24578 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24580 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24581 CHECK_ACCESS(fee_estimator_ptr);
24582 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24583 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24584 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24585 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24587 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24588 CHECK_ACCESS(logger_ptr);
24589 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24590 if (logger_conv.free == LDKLogger_JCalls_free) {
24591 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24592 LDKLogger_JCalls_cloned(&logger_conv);
24594 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
24597 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) {
24598 LDKChannelMonitor this_arg_conv;
24599 this_arg_conv.inner = (void*)(this_arg & (~1));
24600 this_arg_conv.is_owned = false;
24601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24602 unsigned char header_arr[80];
24603 CHECK((*env)->GetArrayLength(env, header) == 80);
24604 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
24605 unsigned char (*header_ref)[80] = &header_arr;
24606 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
24607 CHECK_ACCESS(broadcaster_ptr);
24608 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24609 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24610 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24611 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24613 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
24614 CHECK_ACCESS(fee_estimator_ptr);
24615 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24616 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24617 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24618 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24620 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
24621 CHECK_ACCESS(logger_ptr);
24622 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24623 if (logger_conv.free == LDKLogger_JCalls_free) {
24624 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24625 LDKLogger_JCalls_cloned(&logger_conv);
24627 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24628 int64_tArray ret_arr = NULL;
24629 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24630 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24631 for (size_t n = 0; n < ret_var.datalen; n++) {
24632 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24633 *ret_conv_39_conv = ret_var.data[n];
24634 ret_arr_ptr[n] = ((uintptr_t)ret_conv_39_conv);
24636 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24637 FREE(ret_var.data);
24641 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
24642 LDKChannelMonitor this_arg_conv;
24643 this_arg_conv.inner = (void*)(this_arg & (~1));
24644 this_arg_conv.is_owned = false;
24645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24646 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
24647 jobjectArray ret_arr = NULL;
24648 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
24650 for (size_t i = 0; i < ret_var.datalen; i++) {
24651 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
24652 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
24653 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
24656 FREE(ret_var.data);
24660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
24661 LDKChannelMonitor this_arg_conv;
24662 this_arg_conv.inner = (void*)(this_arg & (~1));
24663 this_arg_conv.is_owned = false;
24664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24665 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
24666 uintptr_t ret_ref = 0;
24667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24670 ret_ref = (uintptr_t)ret_var.inner;
24671 if (ret_var.is_owned) {
24677 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
24678 LDKChannelMonitor this_arg_conv;
24679 this_arg_conv.inner = (void*)(this_arg & (~1));
24680 this_arg_conv.is_owned = false;
24681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24682 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
24683 int64_tArray ret_arr = NULL;
24684 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
24685 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
24686 for (size_t j = 0; j < ret_var.datalen; j++) {
24687 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24688 *ret_conv_9_copy = ret_var.data[j];
24689 uintptr_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
24690 ret_arr_ptr[j] = ret_conv_9_ref;
24692 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
24693 FREE(ret_var.data);
24697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
24698 LDKu8slice ser_ref;
24699 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24700 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24701 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
24702 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
24703 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
24704 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
24705 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
24706 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24707 return (uintptr_t)ret_conv;
24710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24711 LDKOutPoint this_obj_conv;
24712 this_obj_conv.inner = (void*)(this_obj & (~1));
24713 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24715 OutPoint_free(this_obj_conv);
24718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
24719 LDKOutPoint this_ptr_conv;
24720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24721 this_ptr_conv.is_owned = false;
24722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24723 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24724 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
24728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24729 LDKOutPoint this_ptr_conv;
24730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24731 this_ptr_conv.is_owned = false;
24732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24733 LDKThirtyTwoBytes val_ref;
24734 CHECK((*env)->GetArrayLength(env, val) == 32);
24735 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24736 OutPoint_set_txid(&this_ptr_conv, val_ref);
24739 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
24740 LDKOutPoint this_ptr_conv;
24741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24742 this_ptr_conv.is_owned = false;
24743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24744 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
24748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24749 LDKOutPoint this_ptr_conv;
24750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24751 this_ptr_conv.is_owned = false;
24752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24753 OutPoint_set_index(&this_ptr_conv, val);
24756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
24757 LDKThirtyTwoBytes txid_arg_ref;
24758 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
24759 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
24760 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
24761 uintptr_t ret_ref = 0;
24762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24765 ret_ref = (uintptr_t)ret_var.inner;
24766 if (ret_var.is_owned) {
24772 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
24773 LDKOutPoint ret_var = OutPoint_clone(arg);
24774 uintptr_t ret_ref = 0;
24775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24778 ret_ref = (uintptr_t)ret_var.inner;
24779 if (ret_var.is_owned) {
24784 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24785 LDKOutPoint arg_conv;
24786 arg_conv.inner = (void*)(arg & (~1));
24787 arg_conv.is_owned = false;
24788 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24789 intptr_t ret_val = OutPoint_clone_ptr(&arg_conv);
24793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24794 LDKOutPoint orig_conv;
24795 orig_conv.inner = (void*)(orig & (~1));
24796 orig_conv.is_owned = false;
24797 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24798 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
24799 uintptr_t ret_ref = 0;
24800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24803 ret_ref = (uintptr_t)ret_var.inner;
24804 if (ret_var.is_owned) {
24810 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24811 LDKOutPoint a_conv;
24812 a_conv.inner = (void*)(a & (~1));
24813 a_conv.is_owned = false;
24814 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24815 LDKOutPoint b_conv;
24816 b_conv.inner = (void*)(b & (~1));
24817 b_conv.is_owned = false;
24818 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24819 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
24823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
24824 LDKOutPoint o_conv;
24825 o_conv.inner = (void*)(o & (~1));
24826 o_conv.is_owned = false;
24827 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24828 int64_t ret_val = OutPoint_hash(&o_conv);
24832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
24833 LDKOutPoint this_arg_conv;
24834 this_arg_conv.inner = (void*)(this_arg & (~1));
24835 this_arg_conv.is_owned = false;
24836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24837 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24838 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
24842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
24843 LDKOutPoint obj_conv;
24844 obj_conv.inner = (void*)(obj & (~1));
24845 obj_conv.is_owned = false;
24846 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24847 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
24848 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24849 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24850 CVec_u8Z_free(ret_var);
24854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24855 LDKu8slice ser_ref;
24856 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24857 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24858 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
24859 *ret_conv = OutPoint_read(ser_ref);
24860 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24861 return (uintptr_t)ret_conv;
24864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24865 LDKDelayedPaymentOutputDescriptor this_obj_conv;
24866 this_obj_conv.inner = (void*)(this_obj & (~1));
24867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24869 DelayedPaymentOutputDescriptor_free(this_obj_conv);
24872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24873 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24875 this_ptr_conv.is_owned = false;
24876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24877 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24878 uintptr_t ret_ref = 0;
24879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24882 ret_ref = (uintptr_t)ret_var.inner;
24883 if (ret_var.is_owned) {
24889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24890 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24892 this_ptr_conv.is_owned = false;
24893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24894 LDKOutPoint val_conv;
24895 val_conv.inner = (void*)(val & (~1));
24896 val_conv.is_owned = (val & 1) || (val == 0);
24897 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24898 val_conv = OutPoint_clone(&val_conv);
24899 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24903 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24905 this_ptr_conv.is_owned = false;
24906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24907 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24908 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
24912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24913 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24915 this_ptr_conv.is_owned = false;
24916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24917 LDKPublicKey val_ref;
24918 CHECK((*env)->GetArrayLength(env, val) == 33);
24919 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24920 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
24923 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24924 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24926 this_ptr_conv.is_owned = false;
24927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24928 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
24932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24933 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24935 this_ptr_conv.is_owned = false;
24936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24937 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
24940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24941 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24943 this_ptr_conv.is_owned = false;
24944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24945 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
24946 CHECK_ACCESS(val_ptr);
24947 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24948 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
24949 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24953 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24955 this_ptr_conv.is_owned = false;
24956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24957 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24958 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
24962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24963 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24965 this_ptr_conv.is_owned = false;
24966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24967 LDKPublicKey val_ref;
24968 CHECK((*env)->GetArrayLength(env, val) == 33);
24969 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24970 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
24973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24974 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24976 this_ptr_conv.is_owned = false;
24977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24978 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24979 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
24983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24984 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24986 this_ptr_conv.is_owned = false;
24987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24988 LDKThirtyTwoBytes val_ref;
24989 CHECK((*env)->GetArrayLength(env, val) == 32);
24990 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24991 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24995 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24997 this_ptr_conv.is_owned = false;
24998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24999 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25004 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25006 this_ptr_conv.is_owned = false;
25007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25008 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25011 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) {
25012 LDKOutPoint outpoint_arg_conv;
25013 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
25014 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
25015 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25016 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25017 LDKPublicKey per_commitment_point_arg_ref;
25018 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
25019 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
25020 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
25021 CHECK_ACCESS(output_arg_ptr);
25022 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25023 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
25024 LDKPublicKey revocation_pubkey_arg_ref;
25025 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
25026 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
25027 LDKThirtyTwoBytes channel_keys_id_arg_ref;
25028 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
25029 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
25030 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);
25031 uintptr_t ret_ref = 0;
25032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25035 ret_ref = (uintptr_t)ret_var.inner;
25036 if (ret_var.is_owned) {
25042 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
25043 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
25044 uintptr_t ret_ref = 0;
25045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25048 ret_ref = (uintptr_t)ret_var.inner;
25049 if (ret_var.is_owned) {
25054 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25055 LDKDelayedPaymentOutputDescriptor arg_conv;
25056 arg_conv.inner = (void*)(arg & (~1));
25057 arg_conv.is_owned = false;
25058 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25059 intptr_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
25063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25064 LDKDelayedPaymentOutputDescriptor orig_conv;
25065 orig_conv.inner = (void*)(orig & (~1));
25066 orig_conv.is_owned = false;
25067 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25068 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
25069 uintptr_t ret_ref = 0;
25070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25073 ret_ref = (uintptr_t)ret_var.inner;
25074 if (ret_var.is_owned) {
25080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
25081 LDKDelayedPaymentOutputDescriptor obj_conv;
25082 obj_conv.inner = (void*)(obj & (~1));
25083 obj_conv.is_owned = false;
25084 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25085 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
25086 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25087 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25088 CVec_u8Z_free(ret_var);
25092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25093 LDKu8slice ser_ref;
25094 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25095 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25096 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
25097 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
25098 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25099 return (uintptr_t)ret_conv;
25102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25103 LDKStaticPaymentOutputDescriptor this_obj_conv;
25104 this_obj_conv.inner = (void*)(this_obj & (~1));
25105 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25107 StaticPaymentOutputDescriptor_free(this_obj_conv);
25110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25111 LDKStaticPaymentOutputDescriptor this_ptr_conv;
25112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25113 this_ptr_conv.is_owned = false;
25114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25115 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
25116 uintptr_t ret_ref = 0;
25117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25120 ret_ref = (uintptr_t)ret_var.inner;
25121 if (ret_var.is_owned) {
25127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25128 LDKStaticPaymentOutputDescriptor this_ptr_conv;
25129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25130 this_ptr_conv.is_owned = false;
25131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25132 LDKOutPoint val_conv;
25133 val_conv.inner = (void*)(val & (~1));
25134 val_conv.is_owned = (val & 1) || (val == 0);
25135 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25136 val_conv = OutPoint_clone(&val_conv);
25137 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
25140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25141 LDKStaticPaymentOutputDescriptor this_ptr_conv;
25142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25143 this_ptr_conv.is_owned = false;
25144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25145 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
25146 CHECK_ACCESS(val_ptr);
25147 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
25148 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
25149 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
25152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
25153 LDKStaticPaymentOutputDescriptor this_ptr_conv;
25154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25155 this_ptr_conv.is_owned = false;
25156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25157 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25158 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
25162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25163 LDKStaticPaymentOutputDescriptor this_ptr_conv;
25164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25165 this_ptr_conv.is_owned = false;
25166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25167 LDKThirtyTwoBytes val_ref;
25168 CHECK((*env)->GetArrayLength(env, val) == 32);
25169 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25170 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
25173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
25174 LDKStaticPaymentOutputDescriptor this_ptr_conv;
25175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25176 this_ptr_conv.is_owned = false;
25177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25178 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25183 LDKStaticPaymentOutputDescriptor this_ptr_conv;
25184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25185 this_ptr_conv.is_owned = false;
25186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25187 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25190 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) {
25191 LDKOutPoint outpoint_arg_conv;
25192 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
25193 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
25194 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25195 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25196 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
25197 CHECK_ACCESS(output_arg_ptr);
25198 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25199 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
25200 LDKThirtyTwoBytes channel_keys_id_arg_ref;
25201 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
25202 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
25203 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
25204 uintptr_t ret_ref = 0;
25205 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25206 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25208 ret_ref = (uintptr_t)ret_var.inner;
25209 if (ret_var.is_owned) {
25215 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
25216 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
25217 uintptr_t ret_ref = 0;
25218 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25219 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25221 ret_ref = (uintptr_t)ret_var.inner;
25222 if (ret_var.is_owned) {
25227 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25228 LDKStaticPaymentOutputDescriptor arg_conv;
25229 arg_conv.inner = (void*)(arg & (~1));
25230 arg_conv.is_owned = false;
25231 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25232 intptr_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
25236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25237 LDKStaticPaymentOutputDescriptor orig_conv;
25238 orig_conv.inner = (void*)(orig & (~1));
25239 orig_conv.is_owned = false;
25240 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25241 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
25242 uintptr_t ret_ref = 0;
25243 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25244 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25246 ret_ref = (uintptr_t)ret_var.inner;
25247 if (ret_var.is_owned) {
25253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
25254 LDKStaticPaymentOutputDescriptor obj_conv;
25255 obj_conv.inner = (void*)(obj & (~1));
25256 obj_conv.is_owned = false;
25257 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25258 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
25259 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25260 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25261 CVec_u8Z_free(ret_var);
25265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25266 LDKu8slice ser_ref;
25267 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25268 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25269 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25270 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
25271 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25272 return (uintptr_t)ret_conv;
25275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25276 if ((this_ptr & 1) != 0) return;
25277 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25278 CHECK_ACCESS(this_ptr_ptr);
25279 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
25280 FREE((void*)this_ptr);
25281 SpendableOutputDescriptor_free(this_ptr_conv);
25284 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
25285 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25286 *ret_copy = SpendableOutputDescriptor_clone(arg);
25287 uintptr_t ret_ref = (uintptr_t)ret_copy;
25290 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25291 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
25292 intptr_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
25296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25297 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
25298 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25299 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
25300 uintptr_t ret_ref = (uintptr_t)ret_copy;
25304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
25305 LDKOutPoint outpoint_conv;
25306 outpoint_conv.inner = (void*)(outpoint & (~1));
25307 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
25308 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
25309 outpoint_conv = OutPoint_clone(&outpoint_conv);
25310 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
25311 CHECK_ACCESS(output_ptr);
25312 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
25313 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
25314 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25315 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
25316 uintptr_t ret_ref = (uintptr_t)ret_copy;
25320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
25321 LDKDelayedPaymentOutputDescriptor a_conv;
25322 a_conv.inner = (void*)(a & (~1));
25323 a_conv.is_owned = (a & 1) || (a == 0);
25324 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25325 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
25326 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25327 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
25328 uintptr_t ret_ref = (uintptr_t)ret_copy;
25332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
25333 LDKStaticPaymentOutputDescriptor a_conv;
25334 a_conv.inner = (void*)(a & (~1));
25335 a_conv.is_owned = (a & 1) || (a == 0);
25336 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25337 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
25338 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25339 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
25340 uintptr_t ret_ref = (uintptr_t)ret_copy;
25344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
25345 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
25346 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
25347 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25348 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25349 CVec_u8Z_free(ret_var);
25353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25354 LDKu8slice ser_ref;
25355 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25356 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25357 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25358 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
25359 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25360 return (uintptr_t)ret_conv;
25363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25364 if ((this_ptr & 1) != 0) return;
25365 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25366 CHECK_ACCESS(this_ptr_ptr);
25367 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
25368 FREE((void*)this_ptr);
25369 BaseSign_free(this_ptr_conv);
25372 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
25373 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25374 *ret_ret = Sign_clone(arg);
25375 return (uintptr_t)ret_ret;
25377 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25378 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
25379 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
25380 LDKSign* arg_conv = (LDKSign*)arg_ptr;
25381 intptr_t ret_val = Sign_clone_ptr(arg_conv);
25385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25386 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
25387 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
25388 LDKSign* orig_conv = (LDKSign*)orig_ptr;
25389 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25390 *ret_ret = Sign_clone(orig_conv);
25391 return (uintptr_t)ret_ret;
25394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25395 if ((this_ptr & 1) != 0) return;
25396 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25397 CHECK_ACCESS(this_ptr_ptr);
25398 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
25399 FREE((void*)this_ptr);
25400 Sign_free(this_ptr_conv);
25403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25404 if ((this_ptr & 1) != 0) return;
25405 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25406 CHECK_ACCESS(this_ptr_ptr);
25407 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
25408 FREE((void*)this_ptr);
25409 KeysInterface_free(this_ptr_conv);
25412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25413 LDKInMemorySigner this_obj_conv;
25414 this_obj_conv.inner = (void*)(this_obj & (~1));
25415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25417 InMemorySigner_free(this_obj_conv);
25420 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25421 LDKInMemorySigner this_ptr_conv;
25422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25423 this_ptr_conv.is_owned = false;
25424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25425 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25426 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
25430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25431 LDKInMemorySigner this_ptr_conv;
25432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25433 this_ptr_conv.is_owned = false;
25434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25435 LDKSecretKey val_ref;
25436 CHECK((*env)->GetArrayLength(env, val) == 32);
25437 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
25438 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
25441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25442 LDKInMemorySigner this_ptr_conv;
25443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25444 this_ptr_conv.is_owned = false;
25445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25446 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25447 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
25451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25452 LDKInMemorySigner this_ptr_conv;
25453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25454 this_ptr_conv.is_owned = false;
25455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25456 LDKSecretKey val_ref;
25457 CHECK((*env)->GetArrayLength(env, val) == 32);
25458 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
25459 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
25462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25463 LDKInMemorySigner this_ptr_conv;
25464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25465 this_ptr_conv.is_owned = false;
25466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25467 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25468 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
25472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25473 LDKInMemorySigner this_ptr_conv;
25474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25475 this_ptr_conv.is_owned = false;
25476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25477 LDKSecretKey val_ref;
25478 CHECK((*env)->GetArrayLength(env, val) == 32);
25479 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
25480 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
25483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25484 LDKInMemorySigner this_ptr_conv;
25485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25486 this_ptr_conv.is_owned = false;
25487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25488 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25489 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
25493 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) {
25494 LDKInMemorySigner this_ptr_conv;
25495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25496 this_ptr_conv.is_owned = false;
25497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25498 LDKSecretKey val_ref;
25499 CHECK((*env)->GetArrayLength(env, val) == 32);
25500 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
25501 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
25504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
25505 LDKInMemorySigner this_ptr_conv;
25506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25507 this_ptr_conv.is_owned = false;
25508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25509 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
25514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25515 LDKInMemorySigner this_ptr_conv;
25516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25517 this_ptr_conv.is_owned = false;
25518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25519 LDKSecretKey val_ref;
25520 CHECK((*env)->GetArrayLength(env, val) == 32);
25521 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
25522 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
25525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
25526 LDKInMemorySigner this_ptr_conv;
25527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25528 this_ptr_conv.is_owned = false;
25529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25530 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25531 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
25535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25536 LDKInMemorySigner this_ptr_conv;
25537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25538 this_ptr_conv.is_owned = false;
25539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25540 LDKThirtyTwoBytes val_ref;
25541 CHECK((*env)->GetArrayLength(env, val) == 32);
25542 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25543 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
25546 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
25547 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
25548 uintptr_t ret_ref = 0;
25549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25552 ret_ref = (uintptr_t)ret_var.inner;
25553 if (ret_var.is_owned) {
25558 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25559 LDKInMemorySigner arg_conv;
25560 arg_conv.inner = (void*)(arg & (~1));
25561 arg_conv.is_owned = false;
25562 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25563 intptr_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
25567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25568 LDKInMemorySigner orig_conv;
25569 orig_conv.inner = (void*)(orig & (~1));
25570 orig_conv.is_owned = false;
25571 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25572 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
25573 uintptr_t ret_ref = 0;
25574 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25575 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25576 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25577 ret_ref = (uintptr_t)ret_var.inner;
25578 if (ret_var.is_owned) {
25584 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) {
25585 LDKSecretKey funding_key_ref;
25586 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
25587 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
25588 LDKSecretKey revocation_base_key_ref;
25589 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
25590 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
25591 LDKSecretKey payment_key_ref;
25592 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
25593 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
25594 LDKSecretKey delayed_payment_base_key_ref;
25595 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
25596 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
25597 LDKSecretKey htlc_base_key_ref;
25598 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
25599 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
25600 LDKThirtyTwoBytes commitment_seed_ref;
25601 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
25602 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
25603 LDKThirtyTwoBytes channel_keys_id_ref;
25604 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
25605 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
25606 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);
25607 uintptr_t ret_ref = 0;
25608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25611 ret_ref = (uintptr_t)ret_var.inner;
25612 if (ret_var.is_owned) {
25618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
25619 LDKInMemorySigner this_arg_conv;
25620 this_arg_conv.inner = (void*)(this_arg & (~1));
25621 this_arg_conv.is_owned = false;
25622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25623 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
25624 uintptr_t ret_ref = 0;
25625 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25626 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25628 ret_ref = (uintptr_t)ret_var.inner;
25629 if (ret_var.is_owned) {
25635 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
25636 LDKInMemorySigner this_arg_conv;
25637 this_arg_conv.inner = (void*)(this_arg & (~1));
25638 this_arg_conv.is_owned = false;
25639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25640 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
25644 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
25645 LDKInMemorySigner this_arg_conv;
25646 this_arg_conv.inner = (void*)(this_arg & (~1));
25647 this_arg_conv.is_owned = false;
25648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25649 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
25653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
25654 LDKInMemorySigner this_arg_conv;
25655 this_arg_conv.inner = (void*)(this_arg & (~1));
25656 this_arg_conv.is_owned = false;
25657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25658 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
25662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
25663 LDKInMemorySigner this_arg_conv;
25664 this_arg_conv.inner = (void*)(this_arg & (~1));
25665 this_arg_conv.is_owned = false;
25666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25667 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
25668 uintptr_t ret_ref = 0;
25669 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25670 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25672 ret_ref = (uintptr_t)ret_var.inner;
25673 if (ret_var.is_owned) {
25679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
25680 LDKInMemorySigner this_arg_conv;
25681 this_arg_conv.inner = (void*)(this_arg & (~1));
25682 this_arg_conv.is_owned = false;
25683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25684 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
25685 uintptr_t ret_ref = 0;
25686 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25687 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25688 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25689 ret_ref = (uintptr_t)ret_var.inner;
25690 if (ret_var.is_owned) {
25696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
25697 LDKInMemorySigner this_arg_conv;
25698 this_arg_conv.inner = (void*)(this_arg & (~1));
25699 this_arg_conv.is_owned = false;
25700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25701 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
25705 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, intptr_t input_idx, int64_t descriptor) {
25706 LDKInMemorySigner this_arg_conv;
25707 this_arg_conv.inner = (void*)(this_arg & (~1));
25708 this_arg_conv.is_owned = false;
25709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25710 LDKTransaction spend_tx_ref;
25711 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
25712 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25713 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
25714 spend_tx_ref.data_is_owned = true;
25715 LDKStaticPaymentOutputDescriptor descriptor_conv;
25716 descriptor_conv.inner = (void*)(descriptor & (~1));
25717 descriptor_conv.is_owned = false;
25718 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25719 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25720 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25721 return (uintptr_t)ret_conv;
25724 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, intptr_t input_idx, int64_t descriptor) {
25725 LDKInMemorySigner this_arg_conv;
25726 this_arg_conv.inner = (void*)(this_arg & (~1));
25727 this_arg_conv.is_owned = false;
25728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25729 LDKTransaction spend_tx_ref;
25730 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
25731 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25732 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
25733 spend_tx_ref.data_is_owned = true;
25734 LDKDelayedPaymentOutputDescriptor descriptor_conv;
25735 descriptor_conv.inner = (void*)(descriptor & (~1));
25736 descriptor_conv.is_owned = false;
25737 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25738 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25739 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25740 return (uintptr_t)ret_conv;
25743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
25744 LDKInMemorySigner this_arg_conv;
25745 this_arg_conv.inner = (void*)(this_arg & (~1));
25746 this_arg_conv.is_owned = false;
25747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25748 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
25749 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
25750 return (uintptr_t)ret_ret;
25753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
25754 LDKInMemorySigner this_arg_conv;
25755 this_arg_conv.inner = (void*)(this_arg & (~1));
25756 this_arg_conv.is_owned = false;
25757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25758 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25759 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
25760 return (uintptr_t)ret_ret;
25763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
25764 LDKInMemorySigner obj_conv;
25765 obj_conv.inner = (void*)(obj & (~1));
25766 obj_conv.is_owned = false;
25767 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25768 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
25769 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25770 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25771 CVec_u8Z_free(ret_var);
25775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25776 LDKu8slice ser_ref;
25777 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25778 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25779 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
25780 *ret_conv = InMemorySigner_read(ser_ref);
25781 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25782 return (uintptr_t)ret_conv;
25785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25786 LDKKeysManager this_obj_conv;
25787 this_obj_conv.inner = (void*)(this_obj & (~1));
25788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25790 KeysManager_free(this_obj_conv);
25793 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) {
25794 unsigned char seed_arr[32];
25795 CHECK((*env)->GetArrayLength(env, seed) == 32);
25796 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
25797 unsigned char (*seed_ref)[32] = &seed_arr;
25798 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
25799 uintptr_t ret_ref = 0;
25800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25803 ret_ref = (uintptr_t)ret_var.inner;
25804 if (ret_var.is_owned) {
25810 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) {
25811 LDKKeysManager this_arg_conv;
25812 this_arg_conv.inner = (void*)(this_arg & (~1));
25813 this_arg_conv.is_owned = false;
25814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25815 unsigned char params_arr[32];
25816 CHECK((*env)->GetArrayLength(env, params) == 32);
25817 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
25818 unsigned char (*params_ref)[32] = ¶ms_arr;
25819 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25820 uintptr_t ret_ref = 0;
25821 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25822 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25824 ret_ref = (uintptr_t)ret_var.inner;
25825 if (ret_var.is_owned) {
25831 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) {
25832 LDKKeysManager this_arg_conv;
25833 this_arg_conv.inner = (void*)(this_arg & (~1));
25834 this_arg_conv.is_owned = false;
25835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25836 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25837 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
25838 if (descriptors_constr.datalen > 0)
25839 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25841 descriptors_constr.data = NULL;
25842 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
25843 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25844 int64_t descriptors_conv_27 = descriptors_vals[b];
25845 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
25846 CHECK_ACCESS(descriptors_conv_27_ptr);
25847 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25848 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
25849 descriptors_constr.data[b] = descriptors_conv_27_conv;
25851 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
25852 LDKCVec_TxOutZ outputs_constr;
25853 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
25854 if (outputs_constr.datalen > 0)
25855 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25857 outputs_constr.data = NULL;
25858 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
25859 for (size_t h = 0; h < outputs_constr.datalen; h++) {
25860 int64_t outputs_conv_7 = outputs_vals[h];
25861 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
25862 CHECK_ACCESS(outputs_conv_7_ptr);
25863 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25864 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
25865 outputs_constr.data[h] = outputs_conv_7_conv;
25867 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
25868 LDKCVec_u8Z change_destination_script_ref;
25869 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
25870 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25871 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
25872 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25873 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25874 return (uintptr_t)ret_conv;
25877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
25878 LDKKeysManager this_arg_conv;
25879 this_arg_conv.inner = (void*)(this_arg & (~1));
25880 this_arg_conv.is_owned = false;
25881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25882 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25883 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
25884 return (uintptr_t)ret_ret;
25887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25888 LDKChannelManager this_obj_conv;
25889 this_obj_conv.inner = (void*)(this_obj & (~1));
25890 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25892 ChannelManager_free(this_obj_conv);
25895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25896 LDKChainParameters this_obj_conv;
25897 this_obj_conv.inner = (void*)(this_obj & (~1));
25898 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25900 ChainParameters_free(this_obj_conv);
25903 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
25904 LDKChainParameters this_ptr_conv;
25905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25906 this_ptr_conv.is_owned = false;
25907 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25908 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
25912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
25913 LDKChainParameters this_ptr_conv;
25914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25915 this_ptr_conv.is_owned = false;
25916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25917 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
25918 ChainParameters_set_network(&this_ptr_conv, val_conv);
25921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
25922 LDKChainParameters this_ptr_conv;
25923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25924 this_ptr_conv.is_owned = false;
25925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25926 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
25927 uintptr_t ret_ref = 0;
25928 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25929 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25931 ret_ref = (uintptr_t)ret_var.inner;
25932 if (ret_var.is_owned) {
25938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25939 LDKChainParameters this_ptr_conv;
25940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25941 this_ptr_conv.is_owned = false;
25942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25943 LDKBestBlock val_conv;
25944 val_conv.inner = (void*)(val & (~1));
25945 val_conv.is_owned = (val & 1) || (val == 0);
25946 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25947 val_conv = BestBlock_clone(&val_conv);
25948 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
25951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
25952 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
25953 LDKBestBlock best_block_arg_conv;
25954 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
25955 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
25956 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
25957 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
25958 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
25959 uintptr_t ret_ref = 0;
25960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25963 ret_ref = (uintptr_t)ret_var.inner;
25964 if (ret_var.is_owned) {
25970 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
25971 LDKChainParameters ret_var = ChainParameters_clone(arg);
25972 uintptr_t ret_ref = 0;
25973 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25974 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25975 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25976 ret_ref = (uintptr_t)ret_var.inner;
25977 if (ret_var.is_owned) {
25982 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25983 LDKChainParameters arg_conv;
25984 arg_conv.inner = (void*)(arg & (~1));
25985 arg_conv.is_owned = false;
25986 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25987 intptr_t ret_val = ChainParameters_clone_ptr(&arg_conv);
25991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25992 LDKChainParameters orig_conv;
25993 orig_conv.inner = (void*)(orig & (~1));
25994 orig_conv.is_owned = false;
25995 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25996 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
25997 uintptr_t ret_ref = 0;
25998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26001 ret_ref = (uintptr_t)ret_var.inner;
26002 if (ret_var.is_owned) {
26008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26009 LDKCounterpartyForwardingInfo this_obj_conv;
26010 this_obj_conv.inner = (void*)(this_obj & (~1));
26011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26013 CounterpartyForwardingInfo_free(this_obj_conv);
26016 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26017 LDKCounterpartyForwardingInfo this_ptr_conv;
26018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26019 this_ptr_conv.is_owned = false;
26020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26021 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
26025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26026 LDKCounterpartyForwardingInfo this_ptr_conv;
26027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26028 this_ptr_conv.is_owned = false;
26029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26030 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
26033 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26034 LDKCounterpartyForwardingInfo this_ptr_conv;
26035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26036 this_ptr_conv.is_owned = false;
26037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26038 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
26042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26043 LDKCounterpartyForwardingInfo this_ptr_conv;
26044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26045 this_ptr_conv.is_owned = false;
26046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26047 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
26050 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26051 LDKCounterpartyForwardingInfo this_ptr_conv;
26052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26053 this_ptr_conv.is_owned = false;
26054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26055 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
26059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26060 LDKCounterpartyForwardingInfo this_ptr_conv;
26061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26062 this_ptr_conv.is_owned = false;
26063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26064 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
26067 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) {
26068 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
26069 uintptr_t ret_ref = 0;
26070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26073 ret_ref = (uintptr_t)ret_var.inner;
26074 if (ret_var.is_owned) {
26080 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
26081 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
26082 uintptr_t ret_ref = 0;
26083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26086 ret_ref = (uintptr_t)ret_var.inner;
26087 if (ret_var.is_owned) {
26092 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26093 LDKCounterpartyForwardingInfo arg_conv;
26094 arg_conv.inner = (void*)(arg & (~1));
26095 arg_conv.is_owned = false;
26096 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26097 intptr_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
26101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26102 LDKCounterpartyForwardingInfo orig_conv;
26103 orig_conv.inner = (void*)(orig & (~1));
26104 orig_conv.is_owned = false;
26105 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26106 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
26107 uintptr_t ret_ref = 0;
26108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26111 ret_ref = (uintptr_t)ret_var.inner;
26112 if (ret_var.is_owned) {
26118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26119 LDKChannelCounterparty this_obj_conv;
26120 this_obj_conv.inner = (void*)(this_obj & (~1));
26121 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26123 ChannelCounterparty_free(this_obj_conv);
26126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26127 LDKChannelCounterparty this_ptr_conv;
26128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26129 this_ptr_conv.is_owned = false;
26130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26131 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26132 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
26136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26137 LDKChannelCounterparty this_ptr_conv;
26138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26139 this_ptr_conv.is_owned = false;
26140 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26141 LDKPublicKey val_ref;
26142 CHECK((*env)->GetArrayLength(env, val) == 33);
26143 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26144 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
26147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26148 LDKChannelCounterparty this_ptr_conv;
26149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26150 this_ptr_conv.is_owned = false;
26151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26152 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
26153 uintptr_t ret_ref = 0;
26154 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26155 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26157 ret_ref = (uintptr_t)ret_var.inner;
26158 if (ret_var.is_owned) {
26164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26165 LDKChannelCounterparty this_ptr_conv;
26166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26167 this_ptr_conv.is_owned = false;
26168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26169 LDKInitFeatures val_conv;
26170 val_conv.inner = (void*)(val & (~1));
26171 val_conv.is_owned = (val & 1) || (val == 0);
26172 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26173 val_conv = InitFeatures_clone(&val_conv);
26174 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
26177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
26178 LDKChannelCounterparty this_ptr_conv;
26179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26180 this_ptr_conv.is_owned = false;
26181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26182 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
26186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26187 LDKChannelCounterparty this_ptr_conv;
26188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26189 this_ptr_conv.is_owned = false;
26190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26191 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
26194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
26195 LDKChannelCounterparty this_ptr_conv;
26196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26197 this_ptr_conv.is_owned = false;
26198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26199 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
26200 uintptr_t ret_ref = 0;
26201 if ((uintptr_t)ret_var.inner > 4096) {
26202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26205 ret_ref = (uintptr_t)ret_var.inner;
26206 if (ret_var.is_owned) {
26213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26214 LDKChannelCounterparty this_ptr_conv;
26215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26216 this_ptr_conv.is_owned = false;
26217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26218 LDKCounterpartyForwardingInfo val_conv;
26219 val_conv.inner = (void*)(val & (~1));
26220 val_conv.is_owned = (val & 1) || (val == 0);
26221 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26222 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
26223 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
26226 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) {
26227 LDKPublicKey node_id_arg_ref;
26228 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
26229 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
26230 LDKInitFeatures features_arg_conv;
26231 features_arg_conv.inner = (void*)(features_arg & (~1));
26232 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
26233 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26234 features_arg_conv = InitFeatures_clone(&features_arg_conv);
26235 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
26236 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
26237 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
26238 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
26239 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
26240 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
26241 uintptr_t ret_ref = 0;
26242 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26243 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26244 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26245 ret_ref = (uintptr_t)ret_var.inner;
26246 if (ret_var.is_owned) {
26252 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
26253 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
26254 uintptr_t ret_ref = 0;
26255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26258 ret_ref = (uintptr_t)ret_var.inner;
26259 if (ret_var.is_owned) {
26264 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26265 LDKChannelCounterparty arg_conv;
26266 arg_conv.inner = (void*)(arg & (~1));
26267 arg_conv.is_owned = false;
26268 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26269 intptr_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
26273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26274 LDKChannelCounterparty orig_conv;
26275 orig_conv.inner = (void*)(orig & (~1));
26276 orig_conv.is_owned = false;
26277 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26278 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
26279 uintptr_t ret_ref = 0;
26280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26283 ret_ref = (uintptr_t)ret_var.inner;
26284 if (ret_var.is_owned) {
26290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26291 LDKChannelDetails this_obj_conv;
26292 this_obj_conv.inner = (void*)(this_obj & (~1));
26293 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26295 ChannelDetails_free(this_obj_conv);
26298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26299 LDKChannelDetails this_ptr_conv;
26300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26301 this_ptr_conv.is_owned = false;
26302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26303 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
26308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26309 LDKChannelDetails this_ptr_conv;
26310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26311 this_ptr_conv.is_owned = false;
26312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26313 LDKThirtyTwoBytes val_ref;
26314 CHECK((*env)->GetArrayLength(env, val) == 32);
26315 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26316 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
26319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
26320 LDKChannelDetails this_ptr_conv;
26321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26322 this_ptr_conv.is_owned = false;
26323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26324 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
26325 uintptr_t ret_ref = 0;
26326 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26327 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26328 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26329 ret_ref = (uintptr_t)ret_var.inner;
26330 if (ret_var.is_owned) {
26336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26337 LDKChannelDetails this_ptr_conv;
26338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26339 this_ptr_conv.is_owned = false;
26340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26341 LDKChannelCounterparty val_conv;
26342 val_conv.inner = (void*)(val & (~1));
26343 val_conv.is_owned = (val & 1) || (val == 0);
26344 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26345 val_conv = ChannelCounterparty_clone(&val_conv);
26346 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
26349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
26350 LDKChannelDetails this_ptr_conv;
26351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26352 this_ptr_conv.is_owned = false;
26353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26354 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
26355 uintptr_t ret_ref = 0;
26356 if ((uintptr_t)ret_var.inner > 4096) {
26357 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26358 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26359 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26360 ret_ref = (uintptr_t)ret_var.inner;
26361 if (ret_var.is_owned) {
26368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26369 LDKChannelDetails this_ptr_conv;
26370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26371 this_ptr_conv.is_owned = false;
26372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26373 LDKOutPoint val_conv;
26374 val_conv.inner = (void*)(val & (~1));
26375 val_conv.is_owned = (val & 1) || (val == 0);
26376 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26377 val_conv = OutPoint_clone(&val_conv);
26378 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
26381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26382 LDKChannelDetails this_ptr_conv;
26383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26384 this_ptr_conv.is_owned = false;
26385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26386 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26387 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
26388 uintptr_t ret_ref = (uintptr_t)ret_copy;
26392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26393 LDKChannelDetails this_ptr_conv;
26394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26395 this_ptr_conv.is_owned = false;
26396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26397 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26398 CHECK_ACCESS(val_ptr);
26399 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26400 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26401 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
26404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26405 LDKChannelDetails this_ptr_conv;
26406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26407 this_ptr_conv.is_owned = false;
26408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26409 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
26413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26414 LDKChannelDetails this_ptr_conv;
26415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26416 this_ptr_conv.is_owned = false;
26417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26418 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
26421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
26422 LDKChannelDetails this_ptr_conv;
26423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26424 this_ptr_conv.is_owned = false;
26425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26426 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26427 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
26428 uintptr_t ret_ref = (uintptr_t)ret_copy;
26432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26433 LDKChannelDetails this_ptr_conv;
26434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26435 this_ptr_conv.is_owned = false;
26436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26437 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26438 CHECK_ACCESS(val_ptr);
26439 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26440 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
26441 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
26444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26445 LDKChannelDetails this_ptr_conv;
26446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26447 this_ptr_conv.is_owned = false;
26448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26449 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
26453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26454 LDKChannelDetails this_ptr_conv;
26455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26456 this_ptr_conv.is_owned = false;
26457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26458 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
26461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26462 LDKChannelDetails this_ptr_conv;
26463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26464 this_ptr_conv.is_owned = false;
26465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26466 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
26470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26471 LDKChannelDetails this_ptr_conv;
26472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26473 this_ptr_conv.is_owned = false;
26474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26475 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
26478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26479 LDKChannelDetails this_ptr_conv;
26480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26481 this_ptr_conv.is_owned = false;
26482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26483 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
26487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26488 LDKChannelDetails this_ptr_conv;
26489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26490 this_ptr_conv.is_owned = false;
26491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26492 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
26495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26496 LDKChannelDetails this_ptr_conv;
26497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26498 this_ptr_conv.is_owned = false;
26499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26500 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
26504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26505 LDKChannelDetails this_ptr_conv;
26506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26507 this_ptr_conv.is_owned = false;
26508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26509 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
26512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
26513 LDKChannelDetails this_ptr_conv;
26514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26515 this_ptr_conv.is_owned = false;
26516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26517 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
26518 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
26519 uintptr_t ret_ref = (uintptr_t)ret_copy;
26523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26524 LDKChannelDetails this_ptr_conv;
26525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26526 this_ptr_conv.is_owned = false;
26527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26528 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26529 CHECK_ACCESS(val_ptr);
26530 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
26531 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
26532 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
26535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26536 LDKChannelDetails this_ptr_conv;
26537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26538 this_ptr_conv.is_owned = false;
26539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26540 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26541 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
26542 uintptr_t ret_ref = (uintptr_t)ret_copy;
26546 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) {
26547 LDKChannelDetails this_ptr_conv;
26548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26549 this_ptr_conv.is_owned = false;
26550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26551 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26552 CHECK_ACCESS(val_ptr);
26553 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
26554 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
26555 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
26558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
26559 LDKChannelDetails this_ptr_conv;
26560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26561 this_ptr_conv.is_owned = false;
26562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26563 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
26567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26568 LDKChannelDetails this_ptr_conv;
26569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26570 this_ptr_conv.is_owned = false;
26571 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26572 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
26575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
26576 LDKChannelDetails this_ptr_conv;
26577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26578 this_ptr_conv.is_owned = false;
26579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26580 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
26584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26585 LDKChannelDetails this_ptr_conv;
26586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26587 this_ptr_conv.is_owned = false;
26588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26589 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
26592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
26593 LDKChannelDetails this_ptr_conv;
26594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26595 this_ptr_conv.is_owned = false;
26596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26597 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
26601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26602 LDKChannelDetails this_ptr_conv;
26603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26604 this_ptr_conv.is_owned = false;
26605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26606 ChannelDetails_set_is_usable(&this_ptr_conv, val);
26609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
26610 LDKChannelDetails this_ptr_conv;
26611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26612 this_ptr_conv.is_owned = false;
26613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26614 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
26618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
26619 LDKChannelDetails this_ptr_conv;
26620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26621 this_ptr_conv.is_owned = false;
26622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26623 ChannelDetails_set_is_public(&this_ptr_conv, val);
26626 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_channel_id_arg, int64_t balance_msat_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) {
26627 LDKThirtyTwoBytes channel_id_arg_ref;
26628 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
26629 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
26630 LDKChannelCounterparty counterparty_arg_conv;
26631 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
26632 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
26633 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
26634 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
26635 LDKOutPoint funding_txo_arg_conv;
26636 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
26637 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
26638 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
26639 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
26640 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
26641 CHECK_ACCESS(short_channel_id_arg_ptr);
26642 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
26643 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
26644 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
26645 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
26646 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
26647 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
26648 CHECK_ACCESS(confirmations_required_arg_ptr);
26649 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
26650 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
26651 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
26652 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
26653 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
26654 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
26655 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_channel_id_arg, balance_msat_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);
26656 uintptr_t ret_ref = 0;
26657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26660 ret_ref = (uintptr_t)ret_var.inner;
26661 if (ret_var.is_owned) {
26667 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
26668 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
26669 uintptr_t ret_ref = 0;
26670 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26671 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26672 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26673 ret_ref = (uintptr_t)ret_var.inner;
26674 if (ret_var.is_owned) {
26679 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26680 LDKChannelDetails arg_conv;
26681 arg_conv.inner = (void*)(arg & (~1));
26682 arg_conv.is_owned = false;
26683 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26684 intptr_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
26688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26689 LDKChannelDetails orig_conv;
26690 orig_conv.inner = (void*)(orig & (~1));
26691 orig_conv.is_owned = false;
26692 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26693 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
26694 uintptr_t ret_ref = 0;
26695 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26696 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26697 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26698 ret_ref = (uintptr_t)ret_var.inner;
26699 if (ret_var.is_owned) {
26705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26706 if ((this_ptr & 1) != 0) return;
26707 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26708 CHECK_ACCESS(this_ptr_ptr);
26709 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
26710 FREE((void*)this_ptr);
26711 PaymentSendFailure_free(this_ptr_conv);
26714 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
26715 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26716 *ret_copy = PaymentSendFailure_clone(arg);
26717 uintptr_t ret_ref = (uintptr_t)ret_copy;
26720 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26721 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
26722 intptr_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
26726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26727 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
26728 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26729 *ret_copy = PaymentSendFailure_clone(orig_conv);
26730 uintptr_t ret_ref = (uintptr_t)ret_copy;
26734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
26735 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
26736 CHECK_ACCESS(a_ptr);
26737 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
26738 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
26739 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26740 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
26741 uintptr_t ret_ref = (uintptr_t)ret_copy;
26745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
26746 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
26747 a_constr.datalen = (*env)->GetArrayLength(env, a);
26748 if (a_constr.datalen > 0)
26749 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26751 a_constr.data = NULL;
26752 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
26753 for (size_t w = 0; w < a_constr.datalen; w++) {
26754 int64_t a_conv_22 = a_vals[w];
26755 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
26756 CHECK_ACCESS(a_conv_22_ptr);
26757 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
26758 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
26759 a_constr.data[w] = a_conv_22_conv;
26761 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
26762 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26763 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
26764 uintptr_t ret_ref = (uintptr_t)ret_copy;
26768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
26769 LDKCVec_APIErrorZ a_constr;
26770 a_constr.datalen = (*env)->GetArrayLength(env, a);
26771 if (a_constr.datalen > 0)
26772 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
26774 a_constr.data = NULL;
26775 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
26776 for (size_t k = 0; k < a_constr.datalen; k++) {
26777 int64_t a_conv_10 = a_vals[k];
26778 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
26779 CHECK_ACCESS(a_conv_10_ptr);
26780 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
26781 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
26782 a_constr.data[k] = a_conv_10_conv;
26784 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
26785 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26786 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
26787 uintptr_t ret_ref = (uintptr_t)ret_copy;
26791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray results, int64_t failed_paths_retry, int8_tArray payment_id) {
26792 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
26793 results_constr.datalen = (*env)->GetArrayLength(env, results);
26794 if (results_constr.datalen > 0)
26795 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26797 results_constr.data = NULL;
26798 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
26799 for (size_t w = 0; w < results_constr.datalen; w++) {
26800 int64_t results_conv_22 = results_vals[w];
26801 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
26802 CHECK_ACCESS(results_conv_22_ptr);
26803 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
26804 results_constr.data[w] = results_conv_22_conv;
26806 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
26807 LDKRouteParameters failed_paths_retry_conv;
26808 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
26809 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
26810 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
26811 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
26812 LDKThirtyTwoBytes payment_id_ref;
26813 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
26814 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
26815 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26816 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
26817 uintptr_t ret_ref = (uintptr_t)ret_copy;
26821 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) {
26822 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
26823 CHECK_ACCESS(fee_est_ptr);
26824 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
26825 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
26826 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26827 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
26829 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
26830 CHECK_ACCESS(chain_monitor_ptr);
26831 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
26832 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
26833 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26834 LDKWatch_JCalls_cloned(&chain_monitor_conv);
26836 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
26837 CHECK_ACCESS(tx_broadcaster_ptr);
26838 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
26839 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26840 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26841 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
26843 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26844 CHECK_ACCESS(logger_ptr);
26845 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26846 if (logger_conv.free == LDKLogger_JCalls_free) {
26847 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26848 LDKLogger_JCalls_cloned(&logger_conv);
26850 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
26851 CHECK_ACCESS(keys_manager_ptr);
26852 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
26853 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26854 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26855 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26857 LDKUserConfig config_conv;
26858 config_conv.inner = (void*)(config & (~1));
26859 config_conv.is_owned = (config & 1) || (config == 0);
26860 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
26861 config_conv = UserConfig_clone(&config_conv);
26862 LDKChainParameters params_conv;
26863 params_conv.inner = (void*)(params & (~1));
26864 params_conv.is_owned = (params & 1) || (params == 0);
26865 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
26866 params_conv = ChainParameters_clone(¶ms_conv);
26867 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
26868 uintptr_t ret_ref = 0;
26869 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26870 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26872 ret_ref = (uintptr_t)ret_var.inner;
26873 if (ret_var.is_owned) {
26879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
26880 LDKChannelManager this_arg_conv;
26881 this_arg_conv.inner = (void*)(this_arg & (~1));
26882 this_arg_conv.is_owned = false;
26883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26884 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
26885 uintptr_t ret_ref = 0;
26886 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26887 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26889 ret_ref = (uintptr_t)ret_var.inner;
26890 if (ret_var.is_owned) {
26896 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_channel_id, int64_t override_config) {
26897 LDKChannelManager this_arg_conv;
26898 this_arg_conv.inner = (void*)(this_arg & (~1));
26899 this_arg_conv.is_owned = false;
26900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26901 LDKPublicKey their_network_key_ref;
26902 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
26903 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
26904 LDKUserConfig override_config_conv;
26905 override_config_conv.inner = (void*)(override_config & (~1));
26906 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
26907 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
26908 override_config_conv = UserConfig_clone(&override_config_conv);
26909 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
26910 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
26911 return (uintptr_t)ret_conv;
26914 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
26915 LDKChannelManager this_arg_conv;
26916 this_arg_conv.inner = (void*)(this_arg & (~1));
26917 this_arg_conv.is_owned = false;
26918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26919 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
26920 int64_tArray ret_arr = NULL;
26921 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26922 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26923 for (size_t q = 0; q < ret_var.datalen; q++) {
26924 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26925 uintptr_t ret_conv_16_ref = 0;
26926 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26927 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26929 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26930 if (ret_conv_16_var.is_owned) {
26931 ret_conv_16_ref |= 1;
26933 ret_arr_ptr[q] = ret_conv_16_ref;
26935 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26936 FREE(ret_var.data);
26940 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
26941 LDKChannelManager this_arg_conv;
26942 this_arg_conv.inner = (void*)(this_arg & (~1));
26943 this_arg_conv.is_owned = false;
26944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26945 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
26946 int64_tArray ret_arr = NULL;
26947 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26948 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26949 for (size_t q = 0; q < ret_var.datalen; q++) {
26950 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26951 uintptr_t ret_conv_16_ref = 0;
26952 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26953 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26954 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
26955 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
26956 if (ret_conv_16_var.is_owned) {
26957 ret_conv_16_ref |= 1;
26959 ret_arr_ptr[q] = ret_conv_16_ref;
26961 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26962 FREE(ret_var.data);
26966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
26967 LDKChannelManager this_arg_conv;
26968 this_arg_conv.inner = (void*)(this_arg & (~1));
26969 this_arg_conv.is_owned = false;
26970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26971 unsigned char channel_id_arr[32];
26972 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
26973 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
26974 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26975 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26976 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
26977 return (uintptr_t)ret_conv;
26980 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) {
26981 LDKChannelManager this_arg_conv;
26982 this_arg_conv.inner = (void*)(this_arg & (~1));
26983 this_arg_conv.is_owned = false;
26984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26985 unsigned char channel_id_arr[32];
26986 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
26987 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
26988 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
26989 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
26990 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
26991 return (uintptr_t)ret_conv;
26994 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) {
26995 LDKChannelManager this_arg_conv;
26996 this_arg_conv.inner = (void*)(this_arg & (~1));
26997 this_arg_conv.is_owned = false;
26998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26999 unsigned char channel_id_arr[32];
27000 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
27001 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
27002 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27003 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27004 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
27005 return (uintptr_t)ret_conv;
27008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
27009 LDKChannelManager this_arg_conv;
27010 this_arg_conv.inner = (void*)(this_arg & (~1));
27011 this_arg_conv.is_owned = false;
27012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27013 ChannelManager_force_close_all_channels(&this_arg_conv);
27016 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) {
27017 LDKChannelManager this_arg_conv;
27018 this_arg_conv.inner = (void*)(this_arg & (~1));
27019 this_arg_conv.is_owned = false;
27020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27021 LDKRoute route_conv;
27022 route_conv.inner = (void*)(route & (~1));
27023 route_conv.is_owned = false;
27024 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27025 LDKThirtyTwoBytes payment_hash_ref;
27026 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
27027 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
27028 LDKThirtyTwoBytes payment_secret_ref;
27029 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
27030 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
27031 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
27032 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
27033 return (uintptr_t)ret_conv;
27036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) {
27037 LDKChannelManager this_arg_conv;
27038 this_arg_conv.inner = (void*)(this_arg & (~1));
27039 this_arg_conv.is_owned = false;
27040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27041 LDKRoute route_conv;
27042 route_conv.inner = (void*)(route & (~1));
27043 route_conv.is_owned = false;
27044 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27045 LDKThirtyTwoBytes payment_id_ref;
27046 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
27047 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
27048 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27049 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
27050 return (uintptr_t)ret_conv;
27053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
27054 LDKChannelManager this_arg_conv;
27055 this_arg_conv.inner = (void*)(this_arg & (~1));
27056 this_arg_conv.is_owned = false;
27057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27058 LDKThirtyTwoBytes payment_id_ref;
27059 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
27060 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
27061 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
27064 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) {
27065 LDKChannelManager this_arg_conv;
27066 this_arg_conv.inner = (void*)(this_arg & (~1));
27067 this_arg_conv.is_owned = false;
27068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27069 LDKRoute route_conv;
27070 route_conv.inner = (void*)(route & (~1));
27071 route_conv.is_owned = false;
27072 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27073 LDKThirtyTwoBytes payment_preimage_ref;
27074 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
27075 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
27076 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27077 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
27078 return (uintptr_t)ret_conv;
27081 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) {
27082 LDKChannelManager this_arg_conv;
27083 this_arg_conv.inner = (void*)(this_arg & (~1));
27084 this_arg_conv.is_owned = false;
27085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27086 unsigned char temporary_channel_id_arr[32];
27087 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
27088 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
27089 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27090 LDKTransaction funding_transaction_ref;
27091 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
27092 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
27093 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
27094 funding_transaction_ref.data_is_owned = true;
27095 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27096 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
27097 return (uintptr_t)ret_conv;
27100 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) {
27101 LDKChannelManager this_arg_conv;
27102 this_arg_conv.inner = (void*)(this_arg & (~1));
27103 this_arg_conv.is_owned = false;
27104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27105 LDKThreeBytes rgb_ref;
27106 CHECK((*env)->GetArrayLength(env, rgb) == 3);
27107 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
27108 LDKThirtyTwoBytes alias_ref;
27109 CHECK((*env)->GetArrayLength(env, alias) == 32);
27110 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
27111 LDKCVec_NetAddressZ addresses_constr;
27112 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
27113 if (addresses_constr.datalen > 0)
27114 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
27116 addresses_constr.data = NULL;
27117 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
27118 for (size_t m = 0; m < addresses_constr.datalen; m++) {
27119 int64_t addresses_conv_12 = addresses_vals[m];
27120 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
27121 CHECK_ACCESS(addresses_conv_12_ptr);
27122 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
27123 addresses_constr.data[m] = addresses_conv_12_conv;
27125 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
27126 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
27129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
27130 LDKChannelManager this_arg_conv;
27131 this_arg_conv.inner = (void*)(this_arg & (~1));
27132 this_arg_conv.is_owned = false;
27133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27134 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
27137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
27138 LDKChannelManager this_arg_conv;
27139 this_arg_conv.inner = (void*)(this_arg & (~1));
27140 this_arg_conv.is_owned = false;
27141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27142 ChannelManager_timer_tick_occurred(&this_arg_conv);
27145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
27146 LDKChannelManager this_arg_conv;
27147 this_arg_conv.inner = (void*)(this_arg & (~1));
27148 this_arg_conv.is_owned = false;
27149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27150 unsigned char payment_hash_arr[32];
27151 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
27152 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
27153 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
27154 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
27158 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
27159 LDKChannelManager this_arg_conv;
27160 this_arg_conv.inner = (void*)(this_arg & (~1));
27161 this_arg_conv.is_owned = false;
27162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27163 LDKThirtyTwoBytes payment_preimage_ref;
27164 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
27165 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
27166 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
27170 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
27171 LDKChannelManager this_arg_conv;
27172 this_arg_conv.inner = (void*)(this_arg & (~1));
27173 this_arg_conv.is_owned = false;
27174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27175 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27176 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
27180 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) {
27181 LDKChannelManager this_arg_conv;
27182 this_arg_conv.inner = (void*)(this_arg & (~1));
27183 this_arg_conv.is_owned = false;
27184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27185 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27186 CHECK_ACCESS(min_value_msat_ptr);
27187 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27188 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27189 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27190 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27191 return (uintptr_t)ret_conv;
27194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
27195 LDKChannelManager this_arg_conv;
27196 this_arg_conv.inner = (void*)(this_arg & (~1));
27197 this_arg_conv.is_owned = false;
27198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27199 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27200 CHECK_ACCESS(min_value_msat_ptr);
27201 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27202 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27203 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
27204 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27205 return (uintptr_t)ret_conv;
27208 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) {
27209 LDKChannelManager this_arg_conv;
27210 this_arg_conv.inner = (void*)(this_arg & (~1));
27211 this_arg_conv.is_owned = false;
27212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27213 LDKThirtyTwoBytes payment_hash_ref;
27214 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
27215 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
27216 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27217 CHECK_ACCESS(min_value_msat_ptr);
27218 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27219 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27220 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27221 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27222 return (uintptr_t)ret_conv;
27225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) {
27226 LDKChannelManager this_arg_conv;
27227 this_arg_conv.inner = (void*)(this_arg & (~1));
27228 this_arg_conv.is_owned = false;
27229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27230 LDKThirtyTwoBytes payment_hash_ref;
27231 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
27232 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
27233 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
27234 CHECK_ACCESS(min_value_msat_ptr);
27235 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27236 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
27237 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
27238 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27239 return (uintptr_t)ret_conv;
27242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
27243 LDKChannelManager this_arg_conv;
27244 this_arg_conv.inner = (void*)(this_arg & (~1));
27245 this_arg_conv.is_owned = false;
27246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27247 LDKThirtyTwoBytes payment_hash_ref;
27248 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
27249 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
27250 LDKThirtyTwoBytes payment_secret_ref;
27251 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
27252 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
27253 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
27254 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
27255 return (uintptr_t)ret_conv;
27258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27259 LDKChannelManager this_arg_conv;
27260 this_arg_conv.inner = (void*)(this_arg & (~1));
27261 this_arg_conv.is_owned = false;
27262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27263 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27264 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
27265 return (uintptr_t)ret_ret;
27268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27269 LDKChannelManager this_arg_conv;
27270 this_arg_conv.inner = (void*)(this_arg & (~1));
27271 this_arg_conv.is_owned = false;
27272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27273 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27274 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
27275 return (uintptr_t)ret_ret;
27278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
27279 LDKChannelManager this_arg_conv;
27280 this_arg_conv.inner = (void*)(this_arg & (~1));
27281 this_arg_conv.is_owned = false;
27282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27283 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27284 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
27285 return (uintptr_t)ret_ret;
27288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
27289 LDKChannelManager this_arg_conv;
27290 this_arg_conv.inner = (void*)(this_arg & (~1));
27291 this_arg_conv.is_owned = false;
27292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27293 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27294 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
27295 return (uintptr_t)ret_ret;
27298 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) {
27299 LDKChannelManager this_arg_conv;
27300 this_arg_conv.inner = (void*)(this_arg & (~1));
27301 this_arg_conv.is_owned = false;
27302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27303 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
27307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
27308 LDKChannelManager this_arg_conv;
27309 this_arg_conv.inner = (void*)(this_arg & (~1));
27310 this_arg_conv.is_owned = false;
27311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27312 ChannelManager_await_persistable_update(&this_arg_conv);
27315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
27316 LDKChannelManager this_arg_conv;
27317 this_arg_conv.inner = (void*)(this_arg & (~1));
27318 this_arg_conv.is_owned = false;
27319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27320 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
27321 uintptr_t ret_ref = 0;
27322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27325 ret_ref = (uintptr_t)ret_var.inner;
27326 if (ret_var.is_owned) {
27332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27333 LDKChannelManager this_arg_conv;
27334 this_arg_conv.inner = (void*)(this_arg & (~1));
27335 this_arg_conv.is_owned = false;
27336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27337 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
27338 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
27339 return (uintptr_t)ret_ret;
27342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
27343 LDKChannelManager obj_conv;
27344 obj_conv.inner = (void*)(obj & (~1));
27345 obj_conv.is_owned = false;
27346 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27347 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
27348 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27349 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27350 CVec_u8Z_free(ret_var);
27354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27355 LDKChannelManagerReadArgs this_obj_conv;
27356 this_obj_conv.inner = (void*)(this_obj & (~1));
27357 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27359 ChannelManagerReadArgs_free(this_obj_conv);
27362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
27363 LDKChannelManagerReadArgs this_ptr_conv;
27364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27365 this_ptr_conv.is_owned = false;
27366 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27367 // WARNING: This object doesn't live past this scope, needs clone!
27368 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
27372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27373 LDKChannelManagerReadArgs this_ptr_conv;
27374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27375 this_ptr_conv.is_owned = false;
27376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27377 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27378 CHECK_ACCESS(val_ptr);
27379 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
27380 if (val_conv.free == LDKKeysInterface_JCalls_free) {
27381 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27382 LDKKeysInterface_JCalls_cloned(&val_conv);
27384 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
27387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
27388 LDKChannelManagerReadArgs this_ptr_conv;
27389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27390 this_ptr_conv.is_owned = false;
27391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27392 // WARNING: This object doesn't live past this scope, needs clone!
27393 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
27397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27398 LDKChannelManagerReadArgs this_ptr_conv;
27399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27400 this_ptr_conv.is_owned = false;
27401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27402 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27403 CHECK_ACCESS(val_ptr);
27404 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
27405 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
27406 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27407 LDKFeeEstimator_JCalls_cloned(&val_conv);
27409 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
27412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
27413 LDKChannelManagerReadArgs this_ptr_conv;
27414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27415 this_ptr_conv.is_owned = false;
27416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27417 // WARNING: This object doesn't live past this scope, needs clone!
27418 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
27422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27423 LDKChannelManagerReadArgs this_ptr_conv;
27424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27425 this_ptr_conv.is_owned = false;
27426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27427 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27428 CHECK_ACCESS(val_ptr);
27429 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
27430 if (val_conv.free == LDKWatch_JCalls_free) {
27431 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27432 LDKWatch_JCalls_cloned(&val_conv);
27434 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
27437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
27438 LDKChannelManagerReadArgs this_ptr_conv;
27439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27440 this_ptr_conv.is_owned = false;
27441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27442 // WARNING: This object doesn't live past this scope, needs clone!
27443 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
27447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27448 LDKChannelManagerReadArgs this_ptr_conv;
27449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27450 this_ptr_conv.is_owned = false;
27451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27452 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27453 CHECK_ACCESS(val_ptr);
27454 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
27455 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
27456 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27457 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
27459 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
27462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
27463 LDKChannelManagerReadArgs this_ptr_conv;
27464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27465 this_ptr_conv.is_owned = false;
27466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27467 // WARNING: This object doesn't live past this scope, needs clone!
27468 uintptr_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
27472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27473 LDKChannelManagerReadArgs this_ptr_conv;
27474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27475 this_ptr_conv.is_owned = false;
27476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27477 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27478 CHECK_ACCESS(val_ptr);
27479 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
27480 if (val_conv.free == LDKLogger_JCalls_free) {
27481 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27482 LDKLogger_JCalls_cloned(&val_conv);
27484 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
27487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
27488 LDKChannelManagerReadArgs this_ptr_conv;
27489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27490 this_ptr_conv.is_owned = false;
27491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27492 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
27493 uintptr_t ret_ref = 0;
27494 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27495 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27496 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27497 ret_ref = (uintptr_t)ret_var.inner;
27498 if (ret_var.is_owned) {
27504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27505 LDKChannelManagerReadArgs this_ptr_conv;
27506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27507 this_ptr_conv.is_owned = false;
27508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27509 LDKUserConfig val_conv;
27510 val_conv.inner = (void*)(val & (~1));
27511 val_conv.is_owned = (val & 1) || (val == 0);
27512 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27513 val_conv = UserConfig_clone(&val_conv);
27514 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
27517 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) {
27518 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
27519 CHECK_ACCESS(keys_manager_ptr);
27520 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
27521 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27522 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27523 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27525 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
27526 CHECK_ACCESS(fee_estimator_ptr);
27527 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
27528 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
27529 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27530 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
27532 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
27533 CHECK_ACCESS(chain_monitor_ptr);
27534 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27535 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27536 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27537 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27539 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
27540 CHECK_ACCESS(tx_broadcaster_ptr);
27541 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27542 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27543 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27544 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27546 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
27547 CHECK_ACCESS(logger_ptr);
27548 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27549 if (logger_conv.free == LDKLogger_JCalls_free) {
27550 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27551 LDKLogger_JCalls_cloned(&logger_conv);
27553 LDKUserConfig default_config_conv;
27554 default_config_conv.inner = (void*)(default_config & (~1));
27555 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
27556 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
27557 default_config_conv = UserConfig_clone(&default_config_conv);
27558 LDKCVec_ChannelMonitorZ channel_monitors_constr;
27559 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
27560 if (channel_monitors_constr.datalen > 0)
27561 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
27563 channel_monitors_constr.data = NULL;
27564 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
27565 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
27566 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
27567 LDKChannelMonitor channel_monitors_conv_16_conv;
27568 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
27569 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
27570 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
27571 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
27573 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
27574 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);
27575 uintptr_t ret_ref = 0;
27576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27579 ret_ref = (uintptr_t)ret_var.inner;
27580 if (ret_var.is_owned) {
27586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
27587 LDKu8slice ser_ref;
27588 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27589 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27590 LDKChannelManagerReadArgs arg_conv;
27591 arg_conv.inner = (void*)(arg & (~1));
27592 arg_conv.is_owned = (arg & 1) || (arg == 0);
27593 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27594 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
27595 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
27596 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
27597 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27598 return (uintptr_t)ret_conv;
27601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27602 LDKDecodeError this_obj_conv;
27603 this_obj_conv.inner = (void*)(this_obj & (~1));
27604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27606 DecodeError_free(this_obj_conv);
27609 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
27610 LDKDecodeError ret_var = DecodeError_clone(arg);
27611 uintptr_t ret_ref = 0;
27612 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27613 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27614 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27615 ret_ref = (uintptr_t)ret_var.inner;
27616 if (ret_var.is_owned) {
27621 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27622 LDKDecodeError arg_conv;
27623 arg_conv.inner = (void*)(arg & (~1));
27624 arg_conv.is_owned = false;
27625 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27626 intptr_t ret_val = DecodeError_clone_ptr(&arg_conv);
27630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27631 LDKDecodeError orig_conv;
27632 orig_conv.inner = (void*)(orig & (~1));
27633 orig_conv.is_owned = false;
27634 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27635 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
27636 uintptr_t ret_ref = 0;
27637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27640 ret_ref = (uintptr_t)ret_var.inner;
27641 if (ret_var.is_owned) {
27647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27648 LDKInit this_obj_conv;
27649 this_obj_conv.inner = (void*)(this_obj & (~1));
27650 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27652 Init_free(this_obj_conv);
27655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27656 LDKInit this_ptr_conv;
27657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27658 this_ptr_conv.is_owned = false;
27659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27660 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
27661 uintptr_t ret_ref = 0;
27662 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27663 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27664 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27665 ret_ref = (uintptr_t)ret_var.inner;
27666 if (ret_var.is_owned) {
27672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27673 LDKInit this_ptr_conv;
27674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27675 this_ptr_conv.is_owned = false;
27676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27677 LDKInitFeatures val_conv;
27678 val_conv.inner = (void*)(val & (~1));
27679 val_conv.is_owned = (val & 1) || (val == 0);
27680 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27681 val_conv = InitFeatures_clone(&val_conv);
27682 Init_set_features(&this_ptr_conv, val_conv);
27685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
27686 LDKInitFeatures features_arg_conv;
27687 features_arg_conv.inner = (void*)(features_arg & (~1));
27688 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27689 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27690 features_arg_conv = InitFeatures_clone(&features_arg_conv);
27691 LDKInit ret_var = Init_new(features_arg_conv);
27692 uintptr_t ret_ref = 0;
27693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27696 ret_ref = (uintptr_t)ret_var.inner;
27697 if (ret_var.is_owned) {
27703 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
27704 LDKInit ret_var = Init_clone(arg);
27705 uintptr_t ret_ref = 0;
27706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27709 ret_ref = (uintptr_t)ret_var.inner;
27710 if (ret_var.is_owned) {
27715 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27717 arg_conv.inner = (void*)(arg & (~1));
27718 arg_conv.is_owned = false;
27719 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27720 intptr_t ret_val = Init_clone_ptr(&arg_conv);
27724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27726 orig_conv.inner = (void*)(orig & (~1));
27727 orig_conv.is_owned = false;
27728 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27729 LDKInit ret_var = Init_clone(&orig_conv);
27730 uintptr_t ret_ref = 0;
27731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27734 ret_ref = (uintptr_t)ret_var.inner;
27735 if (ret_var.is_owned) {
27741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27742 LDKErrorMessage this_obj_conv;
27743 this_obj_conv.inner = (void*)(this_obj & (~1));
27744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27746 ErrorMessage_free(this_obj_conv);
27749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27750 LDKErrorMessage this_ptr_conv;
27751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27752 this_ptr_conv.is_owned = false;
27753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27754 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27755 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
27759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27760 LDKErrorMessage this_ptr_conv;
27761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27762 this_ptr_conv.is_owned = false;
27763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27764 LDKThirtyTwoBytes val_ref;
27765 CHECK((*env)->GetArrayLength(env, val) == 32);
27766 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27767 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
27770 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
27771 LDKErrorMessage this_ptr_conv;
27772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27773 this_ptr_conv.is_owned = false;
27774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27775 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
27776 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
27782 LDKErrorMessage this_ptr_conv;
27783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27784 this_ptr_conv.is_owned = false;
27785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27786 LDKStr val_conv = java_to_owned_str(env, val);
27787 ErrorMessage_set_data(&this_ptr_conv, val_conv);
27790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
27791 LDKThirtyTwoBytes channel_id_arg_ref;
27792 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
27793 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
27794 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
27795 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
27796 uintptr_t ret_ref = 0;
27797 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27798 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27800 ret_ref = (uintptr_t)ret_var.inner;
27801 if (ret_var.is_owned) {
27807 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
27808 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
27809 uintptr_t ret_ref = 0;
27810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27813 ret_ref = (uintptr_t)ret_var.inner;
27814 if (ret_var.is_owned) {
27819 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27820 LDKErrorMessage arg_conv;
27821 arg_conv.inner = (void*)(arg & (~1));
27822 arg_conv.is_owned = false;
27823 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27824 intptr_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
27828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27829 LDKErrorMessage orig_conv;
27830 orig_conv.inner = (void*)(orig & (~1));
27831 orig_conv.is_owned = false;
27832 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27833 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
27834 uintptr_t ret_ref = 0;
27835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27838 ret_ref = (uintptr_t)ret_var.inner;
27839 if (ret_var.is_owned) {
27845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27846 LDKPing this_obj_conv;
27847 this_obj_conv.inner = (void*)(this_obj & (~1));
27848 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27849 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27850 Ping_free(this_obj_conv);
27853 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
27854 LDKPing this_ptr_conv;
27855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27856 this_ptr_conv.is_owned = false;
27857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27858 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
27862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27863 LDKPing this_ptr_conv;
27864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27865 this_ptr_conv.is_owned = false;
27866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27867 Ping_set_ponglen(&this_ptr_conv, val);
27870 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
27871 LDKPing this_ptr_conv;
27872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27873 this_ptr_conv.is_owned = false;
27874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27875 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
27879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27880 LDKPing this_ptr_conv;
27881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27882 this_ptr_conv.is_owned = false;
27883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27884 Ping_set_byteslen(&this_ptr_conv, val);
27887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
27888 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
27889 uintptr_t ret_ref = 0;
27890 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27891 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27892 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27893 ret_ref = (uintptr_t)ret_var.inner;
27894 if (ret_var.is_owned) {
27900 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
27901 LDKPing ret_var = Ping_clone(arg);
27902 uintptr_t ret_ref = 0;
27903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27906 ret_ref = (uintptr_t)ret_var.inner;
27907 if (ret_var.is_owned) {
27912 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27914 arg_conv.inner = (void*)(arg & (~1));
27915 arg_conv.is_owned = false;
27916 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27917 intptr_t ret_val = Ping_clone_ptr(&arg_conv);
27921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27923 orig_conv.inner = (void*)(orig & (~1));
27924 orig_conv.is_owned = false;
27925 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27926 LDKPing ret_var = Ping_clone(&orig_conv);
27927 uintptr_t ret_ref = 0;
27928 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27929 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27931 ret_ref = (uintptr_t)ret_var.inner;
27932 if (ret_var.is_owned) {
27938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27939 LDKPong this_obj_conv;
27940 this_obj_conv.inner = (void*)(this_obj & (~1));
27941 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27943 Pong_free(this_obj_conv);
27946 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
27947 LDKPong this_ptr_conv;
27948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27949 this_ptr_conv.is_owned = false;
27950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27951 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
27955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27956 LDKPong this_ptr_conv;
27957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27958 this_ptr_conv.is_owned = false;
27959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27960 Pong_set_byteslen(&this_ptr_conv, val);
27963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
27964 LDKPong ret_var = Pong_new(byteslen_arg);
27965 uintptr_t ret_ref = 0;
27966 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27967 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27968 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27969 ret_ref = (uintptr_t)ret_var.inner;
27970 if (ret_var.is_owned) {
27976 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
27977 LDKPong ret_var = Pong_clone(arg);
27978 uintptr_t ret_ref = 0;
27979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27982 ret_ref = (uintptr_t)ret_var.inner;
27983 if (ret_var.is_owned) {
27988 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27990 arg_conv.inner = (void*)(arg & (~1));
27991 arg_conv.is_owned = false;
27992 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27993 intptr_t ret_val = Pong_clone_ptr(&arg_conv);
27997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27999 orig_conv.inner = (void*)(orig & (~1));
28000 orig_conv.is_owned = false;
28001 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28002 LDKPong ret_var = Pong_clone(&orig_conv);
28003 uintptr_t ret_ref = 0;
28004 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28005 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28006 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28007 ret_ref = (uintptr_t)ret_var.inner;
28008 if (ret_var.is_owned) {
28014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28015 LDKOpenChannel this_obj_conv;
28016 this_obj_conv.inner = (void*)(this_obj & (~1));
28017 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28019 OpenChannel_free(this_obj_conv);
28022 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
28023 LDKOpenChannel this_ptr_conv;
28024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28025 this_ptr_conv.is_owned = false;
28026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28027 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28028 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
28032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28033 LDKOpenChannel this_ptr_conv;
28034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28035 this_ptr_conv.is_owned = false;
28036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28037 LDKThirtyTwoBytes val_ref;
28038 CHECK((*env)->GetArrayLength(env, val) == 32);
28039 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28040 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
28043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28044 LDKOpenChannel this_ptr_conv;
28045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28046 this_ptr_conv.is_owned = false;
28047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28048 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
28053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28054 LDKOpenChannel this_ptr_conv;
28055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28056 this_ptr_conv.is_owned = false;
28057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28058 LDKThirtyTwoBytes val_ref;
28059 CHECK((*env)->GetArrayLength(env, val) == 32);
28060 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28061 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28065 LDKOpenChannel this_ptr_conv;
28066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28067 this_ptr_conv.is_owned = false;
28068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28069 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
28073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28074 LDKOpenChannel this_ptr_conv;
28075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28076 this_ptr_conv.is_owned = false;
28077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28078 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
28081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28082 LDKOpenChannel this_ptr_conv;
28083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28084 this_ptr_conv.is_owned = false;
28085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28086 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
28090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28091 LDKOpenChannel this_ptr_conv;
28092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28093 this_ptr_conv.is_owned = false;
28094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28095 OpenChannel_set_push_msat(&this_ptr_conv, val);
28098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28099 LDKOpenChannel this_ptr_conv;
28100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28101 this_ptr_conv.is_owned = false;
28102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28103 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
28107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28108 LDKOpenChannel this_ptr_conv;
28109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28110 this_ptr_conv.is_owned = false;
28111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28112 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28115 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) {
28116 LDKOpenChannel this_ptr_conv;
28117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28118 this_ptr_conv.is_owned = false;
28119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28120 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28124 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) {
28125 LDKOpenChannel this_ptr_conv;
28126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28127 this_ptr_conv.is_owned = false;
28128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28129 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28133 LDKOpenChannel this_ptr_conv;
28134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28135 this_ptr_conv.is_owned = false;
28136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28137 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28142 LDKOpenChannel this_ptr_conv;
28143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28144 this_ptr_conv.is_owned = false;
28145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28146 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28150 LDKOpenChannel this_ptr_conv;
28151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28152 this_ptr_conv.is_owned = false;
28153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28154 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
28158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28159 LDKOpenChannel this_ptr_conv;
28160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28161 this_ptr_conv.is_owned = false;
28162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28163 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28166 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
28167 LDKOpenChannel this_ptr_conv;
28168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28169 this_ptr_conv.is_owned = false;
28170 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28171 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
28175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28176 LDKOpenChannel this_ptr_conv;
28177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28178 this_ptr_conv.is_owned = false;
28179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28180 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
28183 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28184 LDKOpenChannel this_ptr_conv;
28185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28186 this_ptr_conv.is_owned = false;
28187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28188 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
28192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28193 LDKOpenChannel this_ptr_conv;
28194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28195 this_ptr_conv.is_owned = false;
28196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28197 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
28200 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
28201 LDKOpenChannel this_ptr_conv;
28202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28203 this_ptr_conv.is_owned = false;
28204 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28205 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
28209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28210 LDKOpenChannel this_ptr_conv;
28211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28212 this_ptr_conv.is_owned = false;
28213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28214 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28218 LDKOpenChannel this_ptr_conv;
28219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28220 this_ptr_conv.is_owned = false;
28221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28222 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
28227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28228 LDKOpenChannel this_ptr_conv;
28229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28230 this_ptr_conv.is_owned = false;
28231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28232 LDKPublicKey val_ref;
28233 CHECK((*env)->GetArrayLength(env, val) == 33);
28234 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28235 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28239 LDKOpenChannel this_ptr_conv;
28240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28241 this_ptr_conv.is_owned = false;
28242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28243 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28244 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
28248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28249 LDKOpenChannel this_ptr_conv;
28250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28251 this_ptr_conv.is_owned = false;
28252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28253 LDKPublicKey val_ref;
28254 CHECK((*env)->GetArrayLength(env, val) == 33);
28255 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28256 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28260 LDKOpenChannel this_ptr_conv;
28261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28262 this_ptr_conv.is_owned = false;
28263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28264 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28265 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
28269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28270 LDKOpenChannel this_ptr_conv;
28271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28272 this_ptr_conv.is_owned = false;
28273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28274 LDKPublicKey val_ref;
28275 CHECK((*env)->GetArrayLength(env, val) == 33);
28276 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28277 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
28280 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28281 LDKOpenChannel this_ptr_conv;
28282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28283 this_ptr_conv.is_owned = false;
28284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28285 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28286 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
28290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28291 LDKOpenChannel this_ptr_conv;
28292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28293 this_ptr_conv.is_owned = false;
28294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28295 LDKPublicKey val_ref;
28296 CHECK((*env)->GetArrayLength(env, val) == 33);
28297 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28298 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28302 LDKOpenChannel this_ptr_conv;
28303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28304 this_ptr_conv.is_owned = false;
28305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28306 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28307 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
28311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28312 LDKOpenChannel this_ptr_conv;
28313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28314 this_ptr_conv.is_owned = false;
28315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28316 LDKPublicKey val_ref;
28317 CHECK((*env)->GetArrayLength(env, val) == 33);
28318 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28319 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
28322 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28323 LDKOpenChannel this_ptr_conv;
28324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28325 this_ptr_conv.is_owned = false;
28326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28327 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28328 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
28332 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) {
28333 LDKOpenChannel this_ptr_conv;
28334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28335 this_ptr_conv.is_owned = false;
28336 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28337 LDKPublicKey val_ref;
28338 CHECK((*env)->GetArrayLength(env, val) == 33);
28339 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28340 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28343 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
28344 LDKOpenChannel this_ptr_conv;
28345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28346 this_ptr_conv.is_owned = false;
28347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28348 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
28352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
28353 LDKOpenChannel this_ptr_conv;
28354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28355 this_ptr_conv.is_owned = false;
28356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28357 OpenChannel_set_channel_flags(&this_ptr_conv, val);
28360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
28361 LDKOpenChannel this_ptr_conv;
28362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28363 this_ptr_conv.is_owned = false;
28364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28365 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
28366 uintptr_t ret_ref = 0;
28367 if ((uintptr_t)ret_var.inner > 4096) {
28368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28371 ret_ref = (uintptr_t)ret_var.inner;
28372 if (ret_var.is_owned) {
28379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28380 LDKOpenChannel this_ptr_conv;
28381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28382 this_ptr_conv.is_owned = false;
28383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28384 LDKChannelTypeFeatures val_conv;
28385 val_conv.inner = (void*)(val & (~1));
28386 val_conv.is_owned = (val & 1) || (val == 0);
28387 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28388 val_conv = ChannelTypeFeatures_clone(&val_conv);
28389 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
28392 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
28393 LDKOpenChannel ret_var = OpenChannel_clone(arg);
28394 uintptr_t ret_ref = 0;
28395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28398 ret_ref = (uintptr_t)ret_var.inner;
28399 if (ret_var.is_owned) {
28404 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28405 LDKOpenChannel arg_conv;
28406 arg_conv.inner = (void*)(arg & (~1));
28407 arg_conv.is_owned = false;
28408 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28409 intptr_t ret_val = OpenChannel_clone_ptr(&arg_conv);
28413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28414 LDKOpenChannel orig_conv;
28415 orig_conv.inner = (void*)(orig & (~1));
28416 orig_conv.is_owned = false;
28417 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28418 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
28419 uintptr_t ret_ref = 0;
28420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28423 ret_ref = (uintptr_t)ret_var.inner;
28424 if (ret_var.is_owned) {
28430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28431 LDKAcceptChannel this_obj_conv;
28432 this_obj_conv.inner = (void*)(this_obj & (~1));
28433 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28435 AcceptChannel_free(this_obj_conv);
28438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28439 LDKAcceptChannel this_ptr_conv;
28440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28441 this_ptr_conv.is_owned = false;
28442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28443 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28444 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
28448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28449 LDKAcceptChannel this_ptr_conv;
28450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28451 this_ptr_conv.is_owned = false;
28452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28453 LDKThirtyTwoBytes val_ref;
28454 CHECK((*env)->GetArrayLength(env, val) == 32);
28455 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28456 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28460 LDKAcceptChannel this_ptr_conv;
28461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28462 this_ptr_conv.is_owned = false;
28463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28464 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
28468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28469 LDKAcceptChannel this_ptr_conv;
28470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28471 this_ptr_conv.is_owned = false;
28472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28473 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28476 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) {
28477 LDKAcceptChannel this_ptr_conv;
28478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28479 this_ptr_conv.is_owned = false;
28480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28481 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28485 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) {
28486 LDKAcceptChannel this_ptr_conv;
28487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28488 this_ptr_conv.is_owned = false;
28489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28490 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28494 LDKAcceptChannel this_ptr_conv;
28495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28496 this_ptr_conv.is_owned = false;
28497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28498 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28503 LDKAcceptChannel this_ptr_conv;
28504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28505 this_ptr_conv.is_owned = false;
28506 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28507 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28511 LDKAcceptChannel this_ptr_conv;
28512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28513 this_ptr_conv.is_owned = false;
28514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28515 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
28519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28520 LDKAcceptChannel this_ptr_conv;
28521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28522 this_ptr_conv.is_owned = false;
28523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28524 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28527 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
28528 LDKAcceptChannel this_ptr_conv;
28529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28530 this_ptr_conv.is_owned = false;
28531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28532 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
28536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
28537 LDKAcceptChannel this_ptr_conv;
28538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28539 this_ptr_conv.is_owned = false;
28540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28541 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
28544 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28545 LDKAcceptChannel this_ptr_conv;
28546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28547 this_ptr_conv.is_owned = false;
28548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28549 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
28553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28554 LDKAcceptChannel this_ptr_conv;
28555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28556 this_ptr_conv.is_owned = false;
28557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28558 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
28561 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
28562 LDKAcceptChannel this_ptr_conv;
28563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28564 this_ptr_conv.is_owned = false;
28565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28566 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
28570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28571 LDKAcceptChannel this_ptr_conv;
28572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28573 this_ptr_conv.is_owned = false;
28574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28575 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28579 LDKAcceptChannel this_ptr_conv;
28580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28581 this_ptr_conv.is_owned = false;
28582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28583 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28584 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
28588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28589 LDKAcceptChannel this_ptr_conv;
28590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28591 this_ptr_conv.is_owned = false;
28592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28593 LDKPublicKey val_ref;
28594 CHECK((*env)->GetArrayLength(env, val) == 33);
28595 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28596 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28600 LDKAcceptChannel this_ptr_conv;
28601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28602 this_ptr_conv.is_owned = false;
28603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28604 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28605 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
28609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28610 LDKAcceptChannel this_ptr_conv;
28611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28612 this_ptr_conv.is_owned = false;
28613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28614 LDKPublicKey val_ref;
28615 CHECK((*env)->GetArrayLength(env, val) == 33);
28616 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28617 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28621 LDKAcceptChannel this_ptr_conv;
28622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28623 this_ptr_conv.is_owned = false;
28624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28625 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28626 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
28630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28631 LDKAcceptChannel this_ptr_conv;
28632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28633 this_ptr_conv.is_owned = false;
28634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28635 LDKPublicKey val_ref;
28636 CHECK((*env)->GetArrayLength(env, val) == 33);
28637 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28638 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
28641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28642 LDKAcceptChannel this_ptr_conv;
28643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28644 this_ptr_conv.is_owned = false;
28645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28646 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28647 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
28651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28652 LDKAcceptChannel this_ptr_conv;
28653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28654 this_ptr_conv.is_owned = false;
28655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28656 LDKPublicKey val_ref;
28657 CHECK((*env)->GetArrayLength(env, val) == 33);
28658 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28659 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
28662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
28663 LDKAcceptChannel this_ptr_conv;
28664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28665 this_ptr_conv.is_owned = false;
28666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28667 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28668 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
28672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28673 LDKAcceptChannel this_ptr_conv;
28674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28675 this_ptr_conv.is_owned = false;
28676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28677 LDKPublicKey val_ref;
28678 CHECK((*env)->GetArrayLength(env, val) == 33);
28679 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28680 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
28683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
28684 LDKAcceptChannel this_ptr_conv;
28685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28686 this_ptr_conv.is_owned = false;
28687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28688 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28689 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
28693 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) {
28694 LDKAcceptChannel this_ptr_conv;
28695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28696 this_ptr_conv.is_owned = false;
28697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28698 LDKPublicKey val_ref;
28699 CHECK((*env)->GetArrayLength(env, val) == 33);
28700 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28701 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
28704 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
28705 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
28706 uintptr_t ret_ref = 0;
28707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28710 ret_ref = (uintptr_t)ret_var.inner;
28711 if (ret_var.is_owned) {
28716 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28717 LDKAcceptChannel arg_conv;
28718 arg_conv.inner = (void*)(arg & (~1));
28719 arg_conv.is_owned = false;
28720 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28721 intptr_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
28725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28726 LDKAcceptChannel orig_conv;
28727 orig_conv.inner = (void*)(orig & (~1));
28728 orig_conv.is_owned = false;
28729 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28730 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
28731 uintptr_t ret_ref = 0;
28732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28735 ret_ref = (uintptr_t)ret_var.inner;
28736 if (ret_var.is_owned) {
28742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28743 LDKFundingCreated this_obj_conv;
28744 this_obj_conv.inner = (void*)(this_obj & (~1));
28745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28747 FundingCreated_free(this_obj_conv);
28750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28751 LDKFundingCreated this_ptr_conv;
28752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28753 this_ptr_conv.is_owned = false;
28754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28755 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
28760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28761 LDKFundingCreated this_ptr_conv;
28762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28763 this_ptr_conv.is_owned = false;
28764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28765 LDKThirtyTwoBytes val_ref;
28766 CHECK((*env)->GetArrayLength(env, val) == 32);
28767 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28768 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
28771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28772 LDKFundingCreated this_ptr_conv;
28773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28774 this_ptr_conv.is_owned = false;
28775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28776 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28777 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
28781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28782 LDKFundingCreated this_ptr_conv;
28783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28784 this_ptr_conv.is_owned = false;
28785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28786 LDKThirtyTwoBytes val_ref;
28787 CHECK((*env)->GetArrayLength(env, val) == 32);
28788 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28789 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
28792 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
28793 LDKFundingCreated this_ptr_conv;
28794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28795 this_ptr_conv.is_owned = false;
28796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28797 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
28801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
28802 LDKFundingCreated this_ptr_conv;
28803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28804 this_ptr_conv.is_owned = false;
28805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28806 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
28809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
28810 LDKFundingCreated this_ptr_conv;
28811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28812 this_ptr_conv.is_owned = false;
28813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28814 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
28815 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
28819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28820 LDKFundingCreated this_ptr_conv;
28821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28822 this_ptr_conv.is_owned = false;
28823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28824 LDKSignature val_ref;
28825 CHECK((*env)->GetArrayLength(env, val) == 64);
28826 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
28827 FundingCreated_set_signature(&this_ptr_conv, val_ref);
28830 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) {
28831 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
28832 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
28833 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
28834 LDKThirtyTwoBytes funding_txid_arg_ref;
28835 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
28836 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
28837 LDKSignature signature_arg_ref;
28838 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
28839 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
28840 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
28841 uintptr_t ret_ref = 0;
28842 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28843 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28844 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28845 ret_ref = (uintptr_t)ret_var.inner;
28846 if (ret_var.is_owned) {
28852 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
28853 LDKFundingCreated ret_var = FundingCreated_clone(arg);
28854 uintptr_t ret_ref = 0;
28855 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28856 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28857 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28858 ret_ref = (uintptr_t)ret_var.inner;
28859 if (ret_var.is_owned) {
28864 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28865 LDKFundingCreated arg_conv;
28866 arg_conv.inner = (void*)(arg & (~1));
28867 arg_conv.is_owned = false;
28868 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28869 intptr_t ret_val = FundingCreated_clone_ptr(&arg_conv);
28873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28874 LDKFundingCreated orig_conv;
28875 orig_conv.inner = (void*)(orig & (~1));
28876 orig_conv.is_owned = false;
28877 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28878 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
28879 uintptr_t ret_ref = 0;
28880 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28881 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28882 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28883 ret_ref = (uintptr_t)ret_var.inner;
28884 if (ret_var.is_owned) {
28890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28891 LDKFundingSigned this_obj_conv;
28892 this_obj_conv.inner = (void*)(this_obj & (~1));
28893 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28895 FundingSigned_free(this_obj_conv);
28898 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28899 LDKFundingSigned this_ptr_conv;
28900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28901 this_ptr_conv.is_owned = false;
28902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28903 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28904 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
28908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28909 LDKFundingSigned this_ptr_conv;
28910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28911 this_ptr_conv.is_owned = false;
28912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28913 LDKThirtyTwoBytes val_ref;
28914 CHECK((*env)->GetArrayLength(env, val) == 32);
28915 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28916 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
28919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
28920 LDKFundingSigned this_ptr_conv;
28921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28922 this_ptr_conv.is_owned = false;
28923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28924 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
28925 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
28929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28930 LDKFundingSigned this_ptr_conv;
28931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28932 this_ptr_conv.is_owned = false;
28933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28934 LDKSignature val_ref;
28935 CHECK((*env)->GetArrayLength(env, val) == 64);
28936 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
28937 FundingSigned_set_signature(&this_ptr_conv, val_ref);
28940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
28941 LDKThirtyTwoBytes channel_id_arg_ref;
28942 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28943 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28944 LDKSignature signature_arg_ref;
28945 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
28946 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
28947 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
28948 uintptr_t ret_ref = 0;
28949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28952 ret_ref = (uintptr_t)ret_var.inner;
28953 if (ret_var.is_owned) {
28959 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
28960 LDKFundingSigned ret_var = FundingSigned_clone(arg);
28961 uintptr_t ret_ref = 0;
28962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28965 ret_ref = (uintptr_t)ret_var.inner;
28966 if (ret_var.is_owned) {
28971 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28972 LDKFundingSigned arg_conv;
28973 arg_conv.inner = (void*)(arg & (~1));
28974 arg_conv.is_owned = false;
28975 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28976 intptr_t ret_val = FundingSigned_clone_ptr(&arg_conv);
28980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28981 LDKFundingSigned orig_conv;
28982 orig_conv.inner = (void*)(orig & (~1));
28983 orig_conv.is_owned = false;
28984 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28985 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
28986 uintptr_t ret_ref = 0;
28987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28990 ret_ref = (uintptr_t)ret_var.inner;
28991 if (ret_var.is_owned) {
28997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28998 LDKFundingLocked this_obj_conv;
28999 this_obj_conv.inner = (void*)(this_obj & (~1));
29000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29002 FundingLocked_free(this_obj_conv);
29005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29006 LDKFundingLocked this_ptr_conv;
29007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29008 this_ptr_conv.is_owned = false;
29009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29010 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29011 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
29015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29016 LDKFundingLocked this_ptr_conv;
29017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29018 this_ptr_conv.is_owned = false;
29019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29020 LDKThirtyTwoBytes val_ref;
29021 CHECK((*env)->GetArrayLength(env, val) == 32);
29022 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29023 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
29026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
29027 LDKFundingLocked this_ptr_conv;
29028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29029 this_ptr_conv.is_owned = false;
29030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29031 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
29036 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) {
29037 LDKFundingLocked this_ptr_conv;
29038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29039 this_ptr_conv.is_owned = false;
29040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29041 LDKPublicKey val_ref;
29042 CHECK((*env)->GetArrayLength(env, val) == 33);
29043 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
29044 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29047 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) {
29048 LDKThirtyTwoBytes channel_id_arg_ref;
29049 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29050 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29051 LDKPublicKey next_per_commitment_point_arg_ref;
29052 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
29053 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
29054 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
29055 uintptr_t ret_ref = 0;
29056 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29057 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29059 ret_ref = (uintptr_t)ret_var.inner;
29060 if (ret_var.is_owned) {
29066 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
29067 LDKFundingLocked ret_var = FundingLocked_clone(arg);
29068 uintptr_t ret_ref = 0;
29069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29072 ret_ref = (uintptr_t)ret_var.inner;
29073 if (ret_var.is_owned) {
29078 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29079 LDKFundingLocked arg_conv;
29080 arg_conv.inner = (void*)(arg & (~1));
29081 arg_conv.is_owned = false;
29082 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29083 intptr_t ret_val = FundingLocked_clone_ptr(&arg_conv);
29087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29088 LDKFundingLocked orig_conv;
29089 orig_conv.inner = (void*)(orig & (~1));
29090 orig_conv.is_owned = false;
29091 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29092 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
29093 uintptr_t ret_ref = 0;
29094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29097 ret_ref = (uintptr_t)ret_var.inner;
29098 if (ret_var.is_owned) {
29104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29105 LDKShutdown this_obj_conv;
29106 this_obj_conv.inner = (void*)(this_obj & (~1));
29107 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29109 Shutdown_free(this_obj_conv);
29112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29113 LDKShutdown this_ptr_conv;
29114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29115 this_ptr_conv.is_owned = false;
29116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29117 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29118 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
29122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29123 LDKShutdown this_ptr_conv;
29124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29125 this_ptr_conv.is_owned = false;
29126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29127 LDKThirtyTwoBytes val_ref;
29128 CHECK((*env)->GetArrayLength(env, val) == 32);
29129 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29130 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
29133 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
29134 LDKShutdown this_ptr_conv;
29135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29136 this_ptr_conv.is_owned = false;
29137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29138 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
29139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29145 LDKShutdown this_ptr_conv;
29146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29147 this_ptr_conv.is_owned = false;
29148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29149 LDKCVec_u8Z val_ref;
29150 val_ref.datalen = (*env)->GetArrayLength(env, val);
29151 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29152 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
29153 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
29156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
29157 LDKThirtyTwoBytes channel_id_arg_ref;
29158 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29159 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29160 LDKCVec_u8Z scriptpubkey_arg_ref;
29161 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
29162 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29163 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
29164 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
29165 uintptr_t ret_ref = 0;
29166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29169 ret_ref = (uintptr_t)ret_var.inner;
29170 if (ret_var.is_owned) {
29176 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
29177 LDKShutdown ret_var = Shutdown_clone(arg);
29178 uintptr_t ret_ref = 0;
29179 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29180 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29182 ret_ref = (uintptr_t)ret_var.inner;
29183 if (ret_var.is_owned) {
29188 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29189 LDKShutdown arg_conv;
29190 arg_conv.inner = (void*)(arg & (~1));
29191 arg_conv.is_owned = false;
29192 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29193 intptr_t ret_val = Shutdown_clone_ptr(&arg_conv);
29197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29198 LDKShutdown orig_conv;
29199 orig_conv.inner = (void*)(orig & (~1));
29200 orig_conv.is_owned = false;
29201 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29202 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
29203 uintptr_t ret_ref = 0;
29204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29207 ret_ref = (uintptr_t)ret_var.inner;
29208 if (ret_var.is_owned) {
29214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29215 LDKClosingSignedFeeRange this_obj_conv;
29216 this_obj_conv.inner = (void*)(this_obj & (~1));
29217 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29219 ClosingSignedFeeRange_free(this_obj_conv);
29222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29223 LDKClosingSignedFeeRange this_ptr_conv;
29224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29225 this_ptr_conv.is_owned = false;
29226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29227 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
29231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29232 LDKClosingSignedFeeRange this_ptr_conv;
29233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29234 this_ptr_conv.is_owned = false;
29235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29236 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
29239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29240 LDKClosingSignedFeeRange this_ptr_conv;
29241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29242 this_ptr_conv.is_owned = false;
29243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29244 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
29248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29249 LDKClosingSignedFeeRange this_ptr_conv;
29250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29251 this_ptr_conv.is_owned = false;
29252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29253 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
29256 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) {
29257 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
29258 uintptr_t ret_ref = 0;
29259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29262 ret_ref = (uintptr_t)ret_var.inner;
29263 if (ret_var.is_owned) {
29269 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
29270 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
29271 uintptr_t ret_ref = 0;
29272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29275 ret_ref = (uintptr_t)ret_var.inner;
29276 if (ret_var.is_owned) {
29281 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29282 LDKClosingSignedFeeRange arg_conv;
29283 arg_conv.inner = (void*)(arg & (~1));
29284 arg_conv.is_owned = false;
29285 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29286 intptr_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
29290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29291 LDKClosingSignedFeeRange orig_conv;
29292 orig_conv.inner = (void*)(orig & (~1));
29293 orig_conv.is_owned = false;
29294 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29295 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
29296 uintptr_t ret_ref = 0;
29297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29300 ret_ref = (uintptr_t)ret_var.inner;
29301 if (ret_var.is_owned) {
29307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29308 LDKClosingSigned this_obj_conv;
29309 this_obj_conv.inner = (void*)(this_obj & (~1));
29310 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29312 ClosingSigned_free(this_obj_conv);
29315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29316 LDKClosingSigned this_ptr_conv;
29317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29318 this_ptr_conv.is_owned = false;
29319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29320 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29321 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
29325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29326 LDKClosingSigned this_ptr_conv;
29327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29328 this_ptr_conv.is_owned = false;
29329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29330 LDKThirtyTwoBytes val_ref;
29331 CHECK((*env)->GetArrayLength(env, val) == 32);
29332 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29333 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
29336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29337 LDKClosingSigned this_ptr_conv;
29338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29339 this_ptr_conv.is_owned = false;
29340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29341 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
29345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29346 LDKClosingSigned this_ptr_conv;
29347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29348 this_ptr_conv.is_owned = false;
29349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29350 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
29353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
29354 LDKClosingSigned this_ptr_conv;
29355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29356 this_ptr_conv.is_owned = false;
29357 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29358 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29359 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
29363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29364 LDKClosingSigned this_ptr_conv;
29365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29366 this_ptr_conv.is_owned = false;
29367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29368 LDKSignature val_ref;
29369 CHECK((*env)->GetArrayLength(env, val) == 64);
29370 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29371 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
29374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
29375 LDKClosingSigned this_ptr_conv;
29376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29377 this_ptr_conv.is_owned = false;
29378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29379 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
29380 uintptr_t ret_ref = 0;
29381 if ((uintptr_t)ret_var.inner > 4096) {
29382 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29383 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29385 ret_ref = (uintptr_t)ret_var.inner;
29386 if (ret_var.is_owned) {
29393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29394 LDKClosingSigned this_ptr_conv;
29395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29396 this_ptr_conv.is_owned = false;
29397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29398 LDKClosingSignedFeeRange val_conv;
29399 val_conv.inner = (void*)(val & (~1));
29400 val_conv.is_owned = (val & 1) || (val == 0);
29401 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29402 val_conv = ClosingSignedFeeRange_clone(&val_conv);
29403 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
29406 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) {
29407 LDKThirtyTwoBytes channel_id_arg_ref;
29408 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29409 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29410 LDKSignature signature_arg_ref;
29411 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
29412 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
29413 LDKClosingSignedFeeRange fee_range_arg_conv;
29414 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
29415 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
29416 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
29417 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
29418 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
29419 uintptr_t ret_ref = 0;
29420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29423 ret_ref = (uintptr_t)ret_var.inner;
29424 if (ret_var.is_owned) {
29430 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
29431 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
29432 uintptr_t ret_ref = 0;
29433 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29434 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29435 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29436 ret_ref = (uintptr_t)ret_var.inner;
29437 if (ret_var.is_owned) {
29442 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29443 LDKClosingSigned arg_conv;
29444 arg_conv.inner = (void*)(arg & (~1));
29445 arg_conv.is_owned = false;
29446 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29447 intptr_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
29451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29452 LDKClosingSigned orig_conv;
29453 orig_conv.inner = (void*)(orig & (~1));
29454 orig_conv.is_owned = false;
29455 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29456 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
29457 uintptr_t ret_ref = 0;
29458 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29459 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29460 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29461 ret_ref = (uintptr_t)ret_var.inner;
29462 if (ret_var.is_owned) {
29468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29469 LDKUpdateAddHTLC this_obj_conv;
29470 this_obj_conv.inner = (void*)(this_obj & (~1));
29471 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29473 UpdateAddHTLC_free(this_obj_conv);
29476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29477 LDKUpdateAddHTLC this_ptr_conv;
29478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29479 this_ptr_conv.is_owned = false;
29480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29481 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29482 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
29486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29487 LDKUpdateAddHTLC this_ptr_conv;
29488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29489 this_ptr_conv.is_owned = false;
29490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29491 LDKThirtyTwoBytes val_ref;
29492 CHECK((*env)->GetArrayLength(env, val) == 32);
29493 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29494 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
29497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29498 LDKUpdateAddHTLC this_ptr_conv;
29499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29500 this_ptr_conv.is_owned = false;
29501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29502 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
29506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29507 LDKUpdateAddHTLC this_ptr_conv;
29508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29509 this_ptr_conv.is_owned = false;
29510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29511 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
29514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29515 LDKUpdateAddHTLC this_ptr_conv;
29516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29517 this_ptr_conv.is_owned = false;
29518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29519 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
29523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29524 LDKUpdateAddHTLC this_ptr_conv;
29525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29526 this_ptr_conv.is_owned = false;
29527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29528 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
29531 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
29532 LDKUpdateAddHTLC this_ptr_conv;
29533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29534 this_ptr_conv.is_owned = false;
29535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29536 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29537 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
29541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29542 LDKUpdateAddHTLC this_ptr_conv;
29543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29544 this_ptr_conv.is_owned = false;
29545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29546 LDKThirtyTwoBytes val_ref;
29547 CHECK((*env)->GetArrayLength(env, val) == 32);
29548 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29549 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
29552 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
29553 LDKUpdateAddHTLC this_ptr_conv;
29554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29555 this_ptr_conv.is_owned = false;
29556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29557 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
29561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
29562 LDKUpdateAddHTLC this_ptr_conv;
29563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29564 this_ptr_conv.is_owned = false;
29565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29566 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
29569 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
29570 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
29571 uintptr_t ret_ref = 0;
29572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29575 ret_ref = (uintptr_t)ret_var.inner;
29576 if (ret_var.is_owned) {
29581 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29582 LDKUpdateAddHTLC arg_conv;
29583 arg_conv.inner = (void*)(arg & (~1));
29584 arg_conv.is_owned = false;
29585 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29586 intptr_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
29590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29591 LDKUpdateAddHTLC orig_conv;
29592 orig_conv.inner = (void*)(orig & (~1));
29593 orig_conv.is_owned = false;
29594 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29595 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
29596 uintptr_t ret_ref = 0;
29597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29600 ret_ref = (uintptr_t)ret_var.inner;
29601 if (ret_var.is_owned) {
29607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29608 LDKUpdateFulfillHTLC this_obj_conv;
29609 this_obj_conv.inner = (void*)(this_obj & (~1));
29610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29612 UpdateFulfillHTLC_free(this_obj_conv);
29615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29616 LDKUpdateFulfillHTLC this_ptr_conv;
29617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29618 this_ptr_conv.is_owned = false;
29619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29620 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29621 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
29625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29626 LDKUpdateFulfillHTLC this_ptr_conv;
29627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29628 this_ptr_conv.is_owned = false;
29629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29630 LDKThirtyTwoBytes val_ref;
29631 CHECK((*env)->GetArrayLength(env, val) == 32);
29632 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29633 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
29636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29637 LDKUpdateFulfillHTLC this_ptr_conv;
29638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29639 this_ptr_conv.is_owned = false;
29640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29641 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
29645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29646 LDKUpdateFulfillHTLC this_ptr_conv;
29647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29648 this_ptr_conv.is_owned = false;
29649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29650 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
29653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
29654 LDKUpdateFulfillHTLC this_ptr_conv;
29655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29656 this_ptr_conv.is_owned = false;
29657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29658 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29659 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
29663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29664 LDKUpdateFulfillHTLC this_ptr_conv;
29665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29666 this_ptr_conv.is_owned = false;
29667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29668 LDKThirtyTwoBytes val_ref;
29669 CHECK((*env)->GetArrayLength(env, val) == 32);
29670 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29671 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
29674 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) {
29675 LDKThirtyTwoBytes channel_id_arg_ref;
29676 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29677 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29678 LDKThirtyTwoBytes payment_preimage_arg_ref;
29679 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
29680 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
29681 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
29682 uintptr_t ret_ref = 0;
29683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29686 ret_ref = (uintptr_t)ret_var.inner;
29687 if (ret_var.is_owned) {
29693 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
29694 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
29695 uintptr_t ret_ref = 0;
29696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29699 ret_ref = (uintptr_t)ret_var.inner;
29700 if (ret_var.is_owned) {
29705 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29706 LDKUpdateFulfillHTLC arg_conv;
29707 arg_conv.inner = (void*)(arg & (~1));
29708 arg_conv.is_owned = false;
29709 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29710 intptr_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
29714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29715 LDKUpdateFulfillHTLC orig_conv;
29716 orig_conv.inner = (void*)(orig & (~1));
29717 orig_conv.is_owned = false;
29718 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29719 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
29720 uintptr_t ret_ref = 0;
29721 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29722 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29723 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29724 ret_ref = (uintptr_t)ret_var.inner;
29725 if (ret_var.is_owned) {
29731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29732 LDKUpdateFailHTLC this_obj_conv;
29733 this_obj_conv.inner = (void*)(this_obj & (~1));
29734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29736 UpdateFailHTLC_free(this_obj_conv);
29739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29740 LDKUpdateFailHTLC this_ptr_conv;
29741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29742 this_ptr_conv.is_owned = false;
29743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29744 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29745 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
29749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29750 LDKUpdateFailHTLC this_ptr_conv;
29751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29752 this_ptr_conv.is_owned = false;
29753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29754 LDKThirtyTwoBytes val_ref;
29755 CHECK((*env)->GetArrayLength(env, val) == 32);
29756 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29757 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
29760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29761 LDKUpdateFailHTLC this_ptr_conv;
29762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29763 this_ptr_conv.is_owned = false;
29764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29765 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
29769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29770 LDKUpdateFailHTLC this_ptr_conv;
29771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29772 this_ptr_conv.is_owned = false;
29773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29774 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
29777 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
29778 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
29779 uintptr_t ret_ref = 0;
29780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29783 ret_ref = (uintptr_t)ret_var.inner;
29784 if (ret_var.is_owned) {
29789 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29790 LDKUpdateFailHTLC arg_conv;
29791 arg_conv.inner = (void*)(arg & (~1));
29792 arg_conv.is_owned = false;
29793 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29794 intptr_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
29798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29799 LDKUpdateFailHTLC orig_conv;
29800 orig_conv.inner = (void*)(orig & (~1));
29801 orig_conv.is_owned = false;
29802 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29803 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
29804 uintptr_t ret_ref = 0;
29805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29808 ret_ref = (uintptr_t)ret_var.inner;
29809 if (ret_var.is_owned) {
29815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29816 LDKUpdateFailMalformedHTLC this_obj_conv;
29817 this_obj_conv.inner = (void*)(this_obj & (~1));
29818 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29820 UpdateFailMalformedHTLC_free(this_obj_conv);
29823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29824 LDKUpdateFailMalformedHTLC this_ptr_conv;
29825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29826 this_ptr_conv.is_owned = false;
29827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29828 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
29833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29834 LDKUpdateFailMalformedHTLC this_ptr_conv;
29835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29836 this_ptr_conv.is_owned = false;
29837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29838 LDKThirtyTwoBytes val_ref;
29839 CHECK((*env)->GetArrayLength(env, val) == 32);
29840 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29841 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
29844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29845 LDKUpdateFailMalformedHTLC this_ptr_conv;
29846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29847 this_ptr_conv.is_owned = false;
29848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29849 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
29853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29854 LDKUpdateFailMalformedHTLC this_ptr_conv;
29855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29856 this_ptr_conv.is_owned = false;
29857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29858 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
29861 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
29862 LDKUpdateFailMalformedHTLC this_ptr_conv;
29863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29864 this_ptr_conv.is_owned = false;
29865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29866 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
29870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29871 LDKUpdateFailMalformedHTLC this_ptr_conv;
29872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29873 this_ptr_conv.is_owned = false;
29874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29875 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
29878 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
29879 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
29880 uintptr_t ret_ref = 0;
29881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29884 ret_ref = (uintptr_t)ret_var.inner;
29885 if (ret_var.is_owned) {
29890 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29891 LDKUpdateFailMalformedHTLC arg_conv;
29892 arg_conv.inner = (void*)(arg & (~1));
29893 arg_conv.is_owned = false;
29894 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29895 intptr_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
29899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29900 LDKUpdateFailMalformedHTLC orig_conv;
29901 orig_conv.inner = (void*)(orig & (~1));
29902 orig_conv.is_owned = false;
29903 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29904 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
29905 uintptr_t ret_ref = 0;
29906 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29907 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29908 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29909 ret_ref = (uintptr_t)ret_var.inner;
29910 if (ret_var.is_owned) {
29916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29917 LDKCommitmentSigned this_obj_conv;
29918 this_obj_conv.inner = (void*)(this_obj & (~1));
29919 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29921 CommitmentSigned_free(this_obj_conv);
29924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29925 LDKCommitmentSigned this_ptr_conv;
29926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29927 this_ptr_conv.is_owned = false;
29928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29929 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29930 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
29934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29935 LDKCommitmentSigned this_ptr_conv;
29936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29937 this_ptr_conv.is_owned = false;
29938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29939 LDKThirtyTwoBytes val_ref;
29940 CHECK((*env)->GetArrayLength(env, val) == 32);
29941 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29942 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
29945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
29946 LDKCommitmentSigned this_ptr_conv;
29947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29948 this_ptr_conv.is_owned = false;
29949 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29950 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
29951 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
29955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29956 LDKCommitmentSigned this_ptr_conv;
29957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29958 this_ptr_conv.is_owned = false;
29959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29960 LDKSignature val_ref;
29961 CHECK((*env)->GetArrayLength(env, val) == 64);
29962 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
29963 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
29966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
29967 LDKCommitmentSigned this_ptr_conv;
29968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29969 this_ptr_conv.is_owned = false;
29970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29971 LDKCVec_SignatureZ val_constr;
29972 val_constr.datalen = (*env)->GetArrayLength(env, val);
29973 if (val_constr.datalen > 0)
29974 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29976 val_constr.data = NULL;
29977 for (size_t i = 0; i < val_constr.datalen; i++) {
29978 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
29979 LDKSignature val_conv_8_ref;
29980 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
29981 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
29982 val_constr.data[i] = val_conv_8_ref;
29984 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
29987 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) {
29988 LDKThirtyTwoBytes channel_id_arg_ref;
29989 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29990 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29991 LDKSignature signature_arg_ref;
29992 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
29993 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
29994 LDKCVec_SignatureZ htlc_signatures_arg_constr;
29995 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
29996 if (htlc_signatures_arg_constr.datalen > 0)
29997 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
29999 htlc_signatures_arg_constr.data = NULL;
30000 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
30001 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
30002 LDKSignature htlc_signatures_arg_conv_8_ref;
30003 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
30004 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
30005 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
30007 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
30008 uintptr_t ret_ref = 0;
30009 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30010 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30012 ret_ref = (uintptr_t)ret_var.inner;
30013 if (ret_var.is_owned) {
30019 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
30020 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
30021 uintptr_t ret_ref = 0;
30022 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30023 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30024 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30025 ret_ref = (uintptr_t)ret_var.inner;
30026 if (ret_var.is_owned) {
30031 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30032 LDKCommitmentSigned arg_conv;
30033 arg_conv.inner = (void*)(arg & (~1));
30034 arg_conv.is_owned = false;
30035 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30036 intptr_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
30040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30041 LDKCommitmentSigned orig_conv;
30042 orig_conv.inner = (void*)(orig & (~1));
30043 orig_conv.is_owned = false;
30044 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30045 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
30046 uintptr_t ret_ref = 0;
30047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30050 ret_ref = (uintptr_t)ret_var.inner;
30051 if (ret_var.is_owned) {
30057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30058 LDKRevokeAndACK this_obj_conv;
30059 this_obj_conv.inner = (void*)(this_obj & (~1));
30060 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30062 RevokeAndACK_free(this_obj_conv);
30065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30066 LDKRevokeAndACK this_ptr_conv;
30067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30068 this_ptr_conv.is_owned = false;
30069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30070 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30071 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
30075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30076 LDKRevokeAndACK this_ptr_conv;
30077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30078 this_ptr_conv.is_owned = false;
30079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30080 LDKThirtyTwoBytes val_ref;
30081 CHECK((*env)->GetArrayLength(env, val) == 32);
30082 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30083 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
30086 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
30087 LDKRevokeAndACK this_ptr_conv;
30088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30089 this_ptr_conv.is_owned = false;
30090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30091 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30092 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
30096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30097 LDKRevokeAndACK this_ptr_conv;
30098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30099 this_ptr_conv.is_owned = false;
30100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30101 LDKThirtyTwoBytes val_ref;
30102 CHECK((*env)->GetArrayLength(env, val) == 32);
30103 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30104 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
30107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30108 LDKRevokeAndACK this_ptr_conv;
30109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30110 this_ptr_conv.is_owned = false;
30111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30112 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30113 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
30117 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) {
30118 LDKRevokeAndACK this_ptr_conv;
30119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30120 this_ptr_conv.is_owned = false;
30121 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30122 LDKPublicKey val_ref;
30123 CHECK((*env)->GetArrayLength(env, val) == 33);
30124 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30125 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30128 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) {
30129 LDKThirtyTwoBytes channel_id_arg_ref;
30130 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30131 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30132 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
30133 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
30134 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
30135 LDKPublicKey next_per_commitment_point_arg_ref;
30136 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
30137 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
30138 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
30139 uintptr_t ret_ref = 0;
30140 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30141 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30143 ret_ref = (uintptr_t)ret_var.inner;
30144 if (ret_var.is_owned) {
30150 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
30151 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
30152 uintptr_t ret_ref = 0;
30153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30156 ret_ref = (uintptr_t)ret_var.inner;
30157 if (ret_var.is_owned) {
30162 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30163 LDKRevokeAndACK arg_conv;
30164 arg_conv.inner = (void*)(arg & (~1));
30165 arg_conv.is_owned = false;
30166 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30167 intptr_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
30171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30172 LDKRevokeAndACK orig_conv;
30173 orig_conv.inner = (void*)(orig & (~1));
30174 orig_conv.is_owned = false;
30175 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30176 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
30177 uintptr_t ret_ref = 0;
30178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30181 ret_ref = (uintptr_t)ret_var.inner;
30182 if (ret_var.is_owned) {
30188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30189 LDKUpdateFee this_obj_conv;
30190 this_obj_conv.inner = (void*)(this_obj & (~1));
30191 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30193 UpdateFee_free(this_obj_conv);
30196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30197 LDKUpdateFee this_ptr_conv;
30198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30199 this_ptr_conv.is_owned = false;
30200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30201 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30202 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
30206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30207 LDKUpdateFee this_ptr_conv;
30208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30209 this_ptr_conv.is_owned = false;
30210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30211 LDKThirtyTwoBytes val_ref;
30212 CHECK((*env)->GetArrayLength(env, val) == 32);
30213 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30214 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
30217 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
30218 LDKUpdateFee this_ptr_conv;
30219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30220 this_ptr_conv.is_owned = false;
30221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30222 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
30226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30227 LDKUpdateFee this_ptr_conv;
30228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30229 this_ptr_conv.is_owned = false;
30230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30231 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
30234 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) {
30235 LDKThirtyTwoBytes channel_id_arg_ref;
30236 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30237 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30238 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
30239 uintptr_t ret_ref = 0;
30240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30243 ret_ref = (uintptr_t)ret_var.inner;
30244 if (ret_var.is_owned) {
30250 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
30251 LDKUpdateFee ret_var = UpdateFee_clone(arg);
30252 uintptr_t ret_ref = 0;
30253 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30254 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30255 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30256 ret_ref = (uintptr_t)ret_var.inner;
30257 if (ret_var.is_owned) {
30262 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30263 LDKUpdateFee arg_conv;
30264 arg_conv.inner = (void*)(arg & (~1));
30265 arg_conv.is_owned = false;
30266 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30267 intptr_t ret_val = UpdateFee_clone_ptr(&arg_conv);
30271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30272 LDKUpdateFee orig_conv;
30273 orig_conv.inner = (void*)(orig & (~1));
30274 orig_conv.is_owned = false;
30275 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30276 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
30277 uintptr_t ret_ref = 0;
30278 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30279 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30280 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30281 ret_ref = (uintptr_t)ret_var.inner;
30282 if (ret_var.is_owned) {
30288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30289 LDKDataLossProtect this_obj_conv;
30290 this_obj_conv.inner = (void*)(this_obj & (~1));
30291 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30293 DataLossProtect_free(this_obj_conv);
30296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
30297 LDKDataLossProtect this_ptr_conv;
30298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30299 this_ptr_conv.is_owned = false;
30300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30301 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30302 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
30306 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) {
30307 LDKDataLossProtect this_ptr_conv;
30308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30309 this_ptr_conv.is_owned = false;
30310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30311 LDKThirtyTwoBytes val_ref;
30312 CHECK((*env)->GetArrayLength(env, val) == 32);
30313 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30314 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
30317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30318 LDKDataLossProtect this_ptr_conv;
30319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30320 this_ptr_conv.is_owned = false;
30321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30322 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30323 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
30327 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) {
30328 LDKDataLossProtect this_ptr_conv;
30329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30330 this_ptr_conv.is_owned = false;
30331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30332 LDKPublicKey val_ref;
30333 CHECK((*env)->GetArrayLength(env, val) == 33);
30334 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30335 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
30338 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) {
30339 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
30340 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
30341 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
30342 LDKPublicKey my_current_per_commitment_point_arg_ref;
30343 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
30344 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
30345 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
30346 uintptr_t ret_ref = 0;
30347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30350 ret_ref = (uintptr_t)ret_var.inner;
30351 if (ret_var.is_owned) {
30357 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
30358 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
30359 uintptr_t ret_ref = 0;
30360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30363 ret_ref = (uintptr_t)ret_var.inner;
30364 if (ret_var.is_owned) {
30369 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30370 LDKDataLossProtect arg_conv;
30371 arg_conv.inner = (void*)(arg & (~1));
30372 arg_conv.is_owned = false;
30373 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30374 intptr_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
30378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30379 LDKDataLossProtect orig_conv;
30380 orig_conv.inner = (void*)(orig & (~1));
30381 orig_conv.is_owned = false;
30382 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30383 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
30384 uintptr_t ret_ref = 0;
30385 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30386 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30388 ret_ref = (uintptr_t)ret_var.inner;
30389 if (ret_var.is_owned) {
30395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30396 LDKChannelReestablish this_obj_conv;
30397 this_obj_conv.inner = (void*)(this_obj & (~1));
30398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30400 ChannelReestablish_free(this_obj_conv);
30403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30404 LDKChannelReestablish this_ptr_conv;
30405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30406 this_ptr_conv.is_owned = false;
30407 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30408 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30409 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
30413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30414 LDKChannelReestablish this_ptr_conv;
30415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30416 this_ptr_conv.is_owned = false;
30417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30418 LDKThirtyTwoBytes val_ref;
30419 CHECK((*env)->GetArrayLength(env, val) == 32);
30420 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30421 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
30424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
30425 LDKChannelReestablish this_ptr_conv;
30426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30427 this_ptr_conv.is_owned = false;
30428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30429 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
30433 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) {
30434 LDKChannelReestablish this_ptr_conv;
30435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30436 this_ptr_conv.is_owned = false;
30437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30438 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
30441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
30442 LDKChannelReestablish this_ptr_conv;
30443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30444 this_ptr_conv.is_owned = false;
30445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30446 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
30450 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) {
30451 LDKChannelReestablish this_ptr_conv;
30452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30453 this_ptr_conv.is_owned = false;
30454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30455 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
30458 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
30459 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
30460 uintptr_t ret_ref = 0;
30461 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30462 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30463 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30464 ret_ref = (uintptr_t)ret_var.inner;
30465 if (ret_var.is_owned) {
30470 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30471 LDKChannelReestablish arg_conv;
30472 arg_conv.inner = (void*)(arg & (~1));
30473 arg_conv.is_owned = false;
30474 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30475 intptr_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
30479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30480 LDKChannelReestablish orig_conv;
30481 orig_conv.inner = (void*)(orig & (~1));
30482 orig_conv.is_owned = false;
30483 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30484 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
30485 uintptr_t ret_ref = 0;
30486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30489 ret_ref = (uintptr_t)ret_var.inner;
30490 if (ret_var.is_owned) {
30496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30497 LDKAnnouncementSignatures this_obj_conv;
30498 this_obj_conv.inner = (void*)(this_obj & (~1));
30499 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30501 AnnouncementSignatures_free(this_obj_conv);
30504 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30505 LDKAnnouncementSignatures this_ptr_conv;
30506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30507 this_ptr_conv.is_owned = false;
30508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30509 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
30514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30515 LDKAnnouncementSignatures this_ptr_conv;
30516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30517 this_ptr_conv.is_owned = false;
30518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30519 LDKThirtyTwoBytes val_ref;
30520 CHECK((*env)->GetArrayLength(env, val) == 32);
30521 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30522 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
30525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30526 LDKAnnouncementSignatures this_ptr_conv;
30527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30528 this_ptr_conv.is_owned = false;
30529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30530 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
30534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30535 LDKAnnouncementSignatures this_ptr_conv;
30536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30537 this_ptr_conv.is_owned = false;
30538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30539 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
30542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30543 LDKAnnouncementSignatures this_ptr_conv;
30544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30545 this_ptr_conv.is_owned = false;
30546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30547 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30548 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
30552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30553 LDKAnnouncementSignatures this_ptr_conv;
30554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30555 this_ptr_conv.is_owned = false;
30556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30557 LDKSignature val_ref;
30558 CHECK((*env)->GetArrayLength(env, val) == 64);
30559 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30560 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
30563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30564 LDKAnnouncementSignatures this_ptr_conv;
30565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30566 this_ptr_conv.is_owned = false;
30567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30568 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30569 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
30573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30574 LDKAnnouncementSignatures this_ptr_conv;
30575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30576 this_ptr_conv.is_owned = false;
30577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30578 LDKSignature val_ref;
30579 CHECK((*env)->GetArrayLength(env, val) == 64);
30580 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30581 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
30584 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) {
30585 LDKThirtyTwoBytes channel_id_arg_ref;
30586 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30587 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30588 LDKSignature node_signature_arg_ref;
30589 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
30590 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
30591 LDKSignature bitcoin_signature_arg_ref;
30592 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
30593 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
30594 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
30595 uintptr_t ret_ref = 0;
30596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30599 ret_ref = (uintptr_t)ret_var.inner;
30600 if (ret_var.is_owned) {
30606 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
30607 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
30608 uintptr_t ret_ref = 0;
30609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30612 ret_ref = (uintptr_t)ret_var.inner;
30613 if (ret_var.is_owned) {
30618 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30619 LDKAnnouncementSignatures arg_conv;
30620 arg_conv.inner = (void*)(arg & (~1));
30621 arg_conv.is_owned = false;
30622 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30623 intptr_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
30627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30628 LDKAnnouncementSignatures orig_conv;
30629 orig_conv.inner = (void*)(orig & (~1));
30630 orig_conv.is_owned = false;
30631 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30632 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
30633 uintptr_t ret_ref = 0;
30634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30637 ret_ref = (uintptr_t)ret_var.inner;
30638 if (ret_var.is_owned) {
30644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
30645 if ((this_ptr & 1) != 0) return;
30646 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
30647 CHECK_ACCESS(this_ptr_ptr);
30648 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
30649 FREE((void*)this_ptr);
30650 NetAddress_free(this_ptr_conv);
30653 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
30654 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30655 *ret_copy = NetAddress_clone(arg);
30656 uintptr_t ret_ref = (uintptr_t)ret_copy;
30659 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30660 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
30661 intptr_t ret_val = NetAddress_clone_ptr(arg_conv);
30665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30666 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
30667 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30668 *ret_copy = NetAddress_clone(orig_conv);
30669 uintptr_t ret_ref = (uintptr_t)ret_copy;
30673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
30674 LDKFourBytes addr_ref;
30675 CHECK((*env)->GetArrayLength(env, addr) == 4);
30676 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
30677 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30678 *ret_copy = NetAddress_ipv4(addr_ref, port);
30679 uintptr_t ret_ref = (uintptr_t)ret_copy;
30683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
30684 LDKSixteenBytes addr_ref;
30685 CHECK((*env)->GetArrayLength(env, addr) == 16);
30686 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
30687 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30688 *ret_copy = NetAddress_ipv6(addr_ref, port);
30689 uintptr_t ret_ref = (uintptr_t)ret_copy;
30693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
30694 LDKTwelveBytes a_ref;
30695 CHECK((*env)->GetArrayLength(env, a) == 12);
30696 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
30697 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30698 *ret_copy = NetAddress_onion_v2(a_ref);
30699 uintptr_t ret_ref = (uintptr_t)ret_copy;
30703 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) {
30704 LDKThirtyTwoBytes ed25519_pubkey_ref;
30705 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
30706 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
30707 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
30708 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
30709 uintptr_t ret_ref = (uintptr_t)ret_copy;
30713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
30714 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
30715 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
30716 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
30717 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
30718 CVec_u8Z_free(ret_var);
30722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
30723 LDKu8slice ser_ref;
30724 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
30725 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
30726 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
30727 *ret_conv = NetAddress_read(ser_ref);
30728 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
30729 return (uintptr_t)ret_conv;
30732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30733 LDKUnsignedNodeAnnouncement this_obj_conv;
30734 this_obj_conv.inner = (void*)(this_obj & (~1));
30735 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30737 UnsignedNodeAnnouncement_free(this_obj_conv);
30740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
30741 LDKUnsignedNodeAnnouncement this_ptr_conv;
30742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30743 this_ptr_conv.is_owned = false;
30744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30745 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
30746 uintptr_t ret_ref = 0;
30747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30750 ret_ref = (uintptr_t)ret_var.inner;
30751 if (ret_var.is_owned) {
30757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30758 LDKUnsignedNodeAnnouncement this_ptr_conv;
30759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30760 this_ptr_conv.is_owned = false;
30761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30762 LDKNodeFeatures val_conv;
30763 val_conv.inner = (void*)(val & (~1));
30764 val_conv.is_owned = (val & 1) || (val == 0);
30765 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30766 val_conv = NodeFeatures_clone(&val_conv);
30767 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
30770 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
30771 LDKUnsignedNodeAnnouncement this_ptr_conv;
30772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30773 this_ptr_conv.is_owned = false;
30774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30775 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
30779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30780 LDKUnsignedNodeAnnouncement this_ptr_conv;
30781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30782 this_ptr_conv.is_owned = false;
30783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30784 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
30787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30788 LDKUnsignedNodeAnnouncement this_ptr_conv;
30789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30790 this_ptr_conv.is_owned = false;
30791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30792 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30793 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
30797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30798 LDKUnsignedNodeAnnouncement this_ptr_conv;
30799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30800 this_ptr_conv.is_owned = false;
30801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30802 LDKPublicKey val_ref;
30803 CHECK((*env)->GetArrayLength(env, val) == 33);
30804 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30805 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
30808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
30809 LDKUnsignedNodeAnnouncement this_ptr_conv;
30810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30811 this_ptr_conv.is_owned = false;
30812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30813 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
30814 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
30818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30819 LDKUnsignedNodeAnnouncement this_ptr_conv;
30820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30821 this_ptr_conv.is_owned = false;
30822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30823 LDKThreeBytes val_ref;
30824 CHECK((*env)->GetArrayLength(env, val) == 3);
30825 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
30826 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
30829 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
30830 LDKUnsignedNodeAnnouncement this_ptr_conv;
30831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30832 this_ptr_conv.is_owned = false;
30833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30834 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30835 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
30839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30840 LDKUnsignedNodeAnnouncement this_ptr_conv;
30841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30842 this_ptr_conv.is_owned = false;
30843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30844 LDKThirtyTwoBytes val_ref;
30845 CHECK((*env)->GetArrayLength(env, val) == 32);
30846 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30847 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
30850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
30851 LDKUnsignedNodeAnnouncement this_ptr_conv;
30852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30853 this_ptr_conv.is_owned = false;
30854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30855 LDKCVec_NetAddressZ val_constr;
30856 val_constr.datalen = (*env)->GetArrayLength(env, val);
30857 if (val_constr.datalen > 0)
30858 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
30860 val_constr.data = NULL;
30861 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
30862 for (size_t m = 0; m < val_constr.datalen; m++) {
30863 int64_t val_conv_12 = val_vals[m];
30864 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
30865 CHECK_ACCESS(val_conv_12_ptr);
30866 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
30867 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
30868 val_constr.data[m] = val_conv_12_conv;
30870 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
30871 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
30874 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
30875 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
30876 uintptr_t ret_ref = 0;
30877 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30878 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30879 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30880 ret_ref = (uintptr_t)ret_var.inner;
30881 if (ret_var.is_owned) {
30886 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30887 LDKUnsignedNodeAnnouncement arg_conv;
30888 arg_conv.inner = (void*)(arg & (~1));
30889 arg_conv.is_owned = false;
30890 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30891 intptr_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
30895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30896 LDKUnsignedNodeAnnouncement orig_conv;
30897 orig_conv.inner = (void*)(orig & (~1));
30898 orig_conv.is_owned = false;
30899 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30900 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
30901 uintptr_t ret_ref = 0;
30902 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30903 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30904 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30905 ret_ref = (uintptr_t)ret_var.inner;
30906 if (ret_var.is_owned) {
30912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30913 LDKNodeAnnouncement this_obj_conv;
30914 this_obj_conv.inner = (void*)(this_obj & (~1));
30915 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30917 NodeAnnouncement_free(this_obj_conv);
30920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30921 LDKNodeAnnouncement this_ptr_conv;
30922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30923 this_ptr_conv.is_owned = false;
30924 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30925 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30926 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
30930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30931 LDKNodeAnnouncement this_ptr_conv;
30932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30933 this_ptr_conv.is_owned = false;
30934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30935 LDKSignature val_ref;
30936 CHECK((*env)->GetArrayLength(env, val) == 64);
30937 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30938 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
30941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
30942 LDKNodeAnnouncement this_ptr_conv;
30943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30944 this_ptr_conv.is_owned = false;
30945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30946 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
30947 uintptr_t ret_ref = 0;
30948 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30949 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30950 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30951 ret_ref = (uintptr_t)ret_var.inner;
30952 if (ret_var.is_owned) {
30958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30959 LDKNodeAnnouncement this_ptr_conv;
30960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30961 this_ptr_conv.is_owned = false;
30962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30963 LDKUnsignedNodeAnnouncement val_conv;
30964 val_conv.inner = (void*)(val & (~1));
30965 val_conv.is_owned = (val & 1) || (val == 0);
30966 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30967 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
30968 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
30971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
30972 LDKSignature signature_arg_ref;
30973 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
30974 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
30975 LDKUnsignedNodeAnnouncement contents_arg_conv;
30976 contents_arg_conv.inner = (void*)(contents_arg & (~1));
30977 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
30978 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
30979 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
30980 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
30981 uintptr_t ret_ref = 0;
30982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30985 ret_ref = (uintptr_t)ret_var.inner;
30986 if (ret_var.is_owned) {
30992 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
30993 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
30994 uintptr_t ret_ref = 0;
30995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30998 ret_ref = (uintptr_t)ret_var.inner;
30999 if (ret_var.is_owned) {
31004 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31005 LDKNodeAnnouncement arg_conv;
31006 arg_conv.inner = (void*)(arg & (~1));
31007 arg_conv.is_owned = false;
31008 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31009 intptr_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
31013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31014 LDKNodeAnnouncement orig_conv;
31015 orig_conv.inner = (void*)(orig & (~1));
31016 orig_conv.is_owned = false;
31017 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31018 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
31019 uintptr_t ret_ref = 0;
31020 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31021 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31023 ret_ref = (uintptr_t)ret_var.inner;
31024 if (ret_var.is_owned) {
31030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31031 LDKUnsignedChannelAnnouncement this_obj_conv;
31032 this_obj_conv.inner = (void*)(this_obj & (~1));
31033 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31035 UnsignedChannelAnnouncement_free(this_obj_conv);
31038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
31039 LDKUnsignedChannelAnnouncement this_ptr_conv;
31040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31041 this_ptr_conv.is_owned = false;
31042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31043 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
31044 uintptr_t ret_ref = 0;
31045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31048 ret_ref = (uintptr_t)ret_var.inner;
31049 if (ret_var.is_owned) {
31055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31056 LDKUnsignedChannelAnnouncement this_ptr_conv;
31057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31058 this_ptr_conv.is_owned = false;
31059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31060 LDKChannelFeatures val_conv;
31061 val_conv.inner = (void*)(val & (~1));
31062 val_conv.is_owned = (val & 1) || (val == 0);
31063 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31064 val_conv = ChannelFeatures_clone(&val_conv);
31065 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
31068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31069 LDKUnsignedChannelAnnouncement this_ptr_conv;
31070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31071 this_ptr_conv.is_owned = false;
31072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31073 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31074 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
31078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31079 LDKUnsignedChannelAnnouncement this_ptr_conv;
31080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31081 this_ptr_conv.is_owned = false;
31082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31083 LDKThirtyTwoBytes val_ref;
31084 CHECK((*env)->GetArrayLength(env, val) == 32);
31085 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31086 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
31089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31090 LDKUnsignedChannelAnnouncement this_ptr_conv;
31091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31092 this_ptr_conv.is_owned = false;
31093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31094 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
31098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31099 LDKUnsignedChannelAnnouncement this_ptr_conv;
31100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31101 this_ptr_conv.is_owned = false;
31102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31103 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
31106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
31107 LDKUnsignedChannelAnnouncement this_ptr_conv;
31108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31109 this_ptr_conv.is_owned = false;
31110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31111 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31112 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
31116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31117 LDKUnsignedChannelAnnouncement this_ptr_conv;
31118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31119 this_ptr_conv.is_owned = false;
31120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31121 LDKPublicKey val_ref;
31122 CHECK((*env)->GetArrayLength(env, val) == 33);
31123 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31124 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
31127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
31128 LDKUnsignedChannelAnnouncement this_ptr_conv;
31129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31130 this_ptr_conv.is_owned = false;
31131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31132 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31133 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
31137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31138 LDKUnsignedChannelAnnouncement this_ptr_conv;
31139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31140 this_ptr_conv.is_owned = false;
31141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31142 LDKPublicKey val_ref;
31143 CHECK((*env)->GetArrayLength(env, val) == 33);
31144 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31145 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
31148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
31149 LDKUnsignedChannelAnnouncement this_ptr_conv;
31150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31151 this_ptr_conv.is_owned = false;
31152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31153 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31154 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
31158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31159 LDKUnsignedChannelAnnouncement this_ptr_conv;
31160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31161 this_ptr_conv.is_owned = false;
31162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31163 LDKPublicKey val_ref;
31164 CHECK((*env)->GetArrayLength(env, val) == 33);
31165 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31166 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
31169 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
31170 LDKUnsignedChannelAnnouncement this_ptr_conv;
31171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31172 this_ptr_conv.is_owned = false;
31173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31174 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31175 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
31179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31180 LDKUnsignedChannelAnnouncement this_ptr_conv;
31181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31182 this_ptr_conv.is_owned = false;
31183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31184 LDKPublicKey val_ref;
31185 CHECK((*env)->GetArrayLength(env, val) == 33);
31186 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31187 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
31190 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
31191 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
31192 uintptr_t ret_ref = 0;
31193 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31194 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31196 ret_ref = (uintptr_t)ret_var.inner;
31197 if (ret_var.is_owned) {
31202 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31203 LDKUnsignedChannelAnnouncement arg_conv;
31204 arg_conv.inner = (void*)(arg & (~1));
31205 arg_conv.is_owned = false;
31206 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31207 intptr_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
31211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31212 LDKUnsignedChannelAnnouncement orig_conv;
31213 orig_conv.inner = (void*)(orig & (~1));
31214 orig_conv.is_owned = false;
31215 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31216 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
31217 uintptr_t ret_ref = 0;
31218 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31219 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31221 ret_ref = (uintptr_t)ret_var.inner;
31222 if (ret_var.is_owned) {
31228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31229 LDKChannelAnnouncement this_obj_conv;
31230 this_obj_conv.inner = (void*)(this_obj & (~1));
31231 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31233 ChannelAnnouncement_free(this_obj_conv);
31236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
31237 LDKChannelAnnouncement this_ptr_conv;
31238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31239 this_ptr_conv.is_owned = false;
31240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31241 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31242 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
31246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31247 LDKChannelAnnouncement this_ptr_conv;
31248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31249 this_ptr_conv.is_owned = false;
31250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31251 LDKSignature val_ref;
31252 CHECK((*env)->GetArrayLength(env, val) == 64);
31253 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31254 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
31257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
31258 LDKChannelAnnouncement this_ptr_conv;
31259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31260 this_ptr_conv.is_owned = false;
31261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31262 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31263 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
31267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31268 LDKChannelAnnouncement this_ptr_conv;
31269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31270 this_ptr_conv.is_owned = false;
31271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31272 LDKSignature val_ref;
31273 CHECK((*env)->GetArrayLength(env, val) == 64);
31274 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31275 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
31278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
31279 LDKChannelAnnouncement this_ptr_conv;
31280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31281 this_ptr_conv.is_owned = false;
31282 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31283 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31284 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
31288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31289 LDKChannelAnnouncement this_ptr_conv;
31290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31291 this_ptr_conv.is_owned = false;
31292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31293 LDKSignature val_ref;
31294 CHECK((*env)->GetArrayLength(env, val) == 64);
31295 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31296 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
31299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
31300 LDKChannelAnnouncement this_ptr_conv;
31301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31302 this_ptr_conv.is_owned = false;
31303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31304 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31305 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
31309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31310 LDKChannelAnnouncement this_ptr_conv;
31311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31312 this_ptr_conv.is_owned = false;
31313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31314 LDKSignature val_ref;
31315 CHECK((*env)->GetArrayLength(env, val) == 64);
31316 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31317 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
31320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
31321 LDKChannelAnnouncement this_ptr_conv;
31322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31323 this_ptr_conv.is_owned = false;
31324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31325 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
31326 uintptr_t ret_ref = 0;
31327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31330 ret_ref = (uintptr_t)ret_var.inner;
31331 if (ret_var.is_owned) {
31337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31338 LDKChannelAnnouncement this_ptr_conv;
31339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31340 this_ptr_conv.is_owned = false;
31341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31342 LDKUnsignedChannelAnnouncement val_conv;
31343 val_conv.inner = (void*)(val & (~1));
31344 val_conv.is_owned = (val & 1) || (val == 0);
31345 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31346 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
31347 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
31350 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) {
31351 LDKSignature node_signature_1_arg_ref;
31352 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
31353 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
31354 LDKSignature node_signature_2_arg_ref;
31355 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
31356 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
31357 LDKSignature bitcoin_signature_1_arg_ref;
31358 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
31359 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
31360 LDKSignature bitcoin_signature_2_arg_ref;
31361 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
31362 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
31363 LDKUnsignedChannelAnnouncement contents_arg_conv;
31364 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31365 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31366 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31367 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
31368 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);
31369 uintptr_t ret_ref = 0;
31370 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31371 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31373 ret_ref = (uintptr_t)ret_var.inner;
31374 if (ret_var.is_owned) {
31380 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
31381 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
31382 uintptr_t ret_ref = 0;
31383 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31384 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31385 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31386 ret_ref = (uintptr_t)ret_var.inner;
31387 if (ret_var.is_owned) {
31392 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31393 LDKChannelAnnouncement arg_conv;
31394 arg_conv.inner = (void*)(arg & (~1));
31395 arg_conv.is_owned = false;
31396 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31397 intptr_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
31401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31402 LDKChannelAnnouncement orig_conv;
31403 orig_conv.inner = (void*)(orig & (~1));
31404 orig_conv.is_owned = false;
31405 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31406 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
31407 uintptr_t ret_ref = 0;
31408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31411 ret_ref = (uintptr_t)ret_var.inner;
31412 if (ret_var.is_owned) {
31418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31419 LDKUnsignedChannelUpdate this_obj_conv;
31420 this_obj_conv.inner = (void*)(this_obj & (~1));
31421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31423 UnsignedChannelUpdate_free(this_obj_conv);
31426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31427 LDKUnsignedChannelUpdate this_ptr_conv;
31428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31429 this_ptr_conv.is_owned = false;
31430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31431 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31432 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
31436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31437 LDKUnsignedChannelUpdate this_ptr_conv;
31438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31439 this_ptr_conv.is_owned = false;
31440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31441 LDKThirtyTwoBytes val_ref;
31442 CHECK((*env)->GetArrayLength(env, val) == 32);
31443 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31444 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
31447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31448 LDKUnsignedChannelUpdate this_ptr_conv;
31449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31450 this_ptr_conv.is_owned = false;
31451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31452 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
31456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31457 LDKUnsignedChannelUpdate this_ptr_conv;
31458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31459 this_ptr_conv.is_owned = false;
31460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31461 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
31464 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
31465 LDKUnsignedChannelUpdate this_ptr_conv;
31466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31467 this_ptr_conv.is_owned = false;
31468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31469 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
31473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31474 LDKUnsignedChannelUpdate this_ptr_conv;
31475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31476 this_ptr_conv.is_owned = false;
31477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31478 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
31481 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
31482 LDKUnsignedChannelUpdate this_ptr_conv;
31483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31484 this_ptr_conv.is_owned = false;
31485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31486 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
31490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
31491 LDKUnsignedChannelUpdate this_ptr_conv;
31492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31493 this_ptr_conv.is_owned = false;
31494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31495 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
31498 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
31499 LDKUnsignedChannelUpdate this_ptr_conv;
31500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31501 this_ptr_conv.is_owned = false;
31502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31503 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
31507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31508 LDKUnsignedChannelUpdate this_ptr_conv;
31509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31510 this_ptr_conv.is_owned = false;
31511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31512 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
31515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31516 LDKUnsignedChannelUpdate this_ptr_conv;
31517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31518 this_ptr_conv.is_owned = false;
31519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31520 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
31524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31525 LDKUnsignedChannelUpdate this_ptr_conv;
31526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31527 this_ptr_conv.is_owned = false;
31528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31529 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
31532 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31533 LDKUnsignedChannelUpdate this_ptr_conv;
31534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31535 this_ptr_conv.is_owned = false;
31536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31537 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
31541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31542 LDKUnsignedChannelUpdate this_ptr_conv;
31543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31544 this_ptr_conv.is_owned = false;
31545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31546 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
31549 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
31550 LDKUnsignedChannelUpdate this_ptr_conv;
31551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31552 this_ptr_conv.is_owned = false;
31553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31554 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
31558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31559 LDKUnsignedChannelUpdate this_ptr_conv;
31560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31561 this_ptr_conv.is_owned = false;
31562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31563 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
31566 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
31567 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
31568 uintptr_t ret_ref = 0;
31569 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31570 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31571 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31572 ret_ref = (uintptr_t)ret_var.inner;
31573 if (ret_var.is_owned) {
31578 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31579 LDKUnsignedChannelUpdate arg_conv;
31580 arg_conv.inner = (void*)(arg & (~1));
31581 arg_conv.is_owned = false;
31582 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31583 intptr_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
31587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31588 LDKUnsignedChannelUpdate orig_conv;
31589 orig_conv.inner = (void*)(orig & (~1));
31590 orig_conv.is_owned = false;
31591 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31592 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
31593 uintptr_t ret_ref = 0;
31594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31597 ret_ref = (uintptr_t)ret_var.inner;
31598 if (ret_var.is_owned) {
31604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31605 LDKChannelUpdate this_obj_conv;
31606 this_obj_conv.inner = (void*)(this_obj & (~1));
31607 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31609 ChannelUpdate_free(this_obj_conv);
31612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31613 LDKChannelUpdate this_ptr_conv;
31614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31615 this_ptr_conv.is_owned = false;
31616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31617 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31618 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
31622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31623 LDKChannelUpdate this_ptr_conv;
31624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31625 this_ptr_conv.is_owned = false;
31626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31627 LDKSignature val_ref;
31628 CHECK((*env)->GetArrayLength(env, val) == 64);
31629 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31630 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
31633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
31634 LDKChannelUpdate this_ptr_conv;
31635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31636 this_ptr_conv.is_owned = false;
31637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31638 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
31639 uintptr_t ret_ref = 0;
31640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31643 ret_ref = (uintptr_t)ret_var.inner;
31644 if (ret_var.is_owned) {
31650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31651 LDKChannelUpdate this_ptr_conv;
31652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31653 this_ptr_conv.is_owned = false;
31654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31655 LDKUnsignedChannelUpdate val_conv;
31656 val_conv.inner = (void*)(val & (~1));
31657 val_conv.is_owned = (val & 1) || (val == 0);
31658 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31659 val_conv = UnsignedChannelUpdate_clone(&val_conv);
31660 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
31663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
31664 LDKSignature signature_arg_ref;
31665 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31666 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31667 LDKUnsignedChannelUpdate contents_arg_conv;
31668 contents_arg_conv.inner = (void*)(contents_arg & (~1));
31669 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
31670 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31671 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
31672 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
31673 uintptr_t ret_ref = 0;
31674 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31675 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31676 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31677 ret_ref = (uintptr_t)ret_var.inner;
31678 if (ret_var.is_owned) {
31684 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
31685 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
31686 uintptr_t ret_ref = 0;
31687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31690 ret_ref = (uintptr_t)ret_var.inner;
31691 if (ret_var.is_owned) {
31696 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31697 LDKChannelUpdate arg_conv;
31698 arg_conv.inner = (void*)(arg & (~1));
31699 arg_conv.is_owned = false;
31700 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31701 intptr_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
31705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31706 LDKChannelUpdate orig_conv;
31707 orig_conv.inner = (void*)(orig & (~1));
31708 orig_conv.is_owned = false;
31709 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31710 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
31711 uintptr_t ret_ref = 0;
31712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31715 ret_ref = (uintptr_t)ret_var.inner;
31716 if (ret_var.is_owned) {
31722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31723 LDKQueryChannelRange this_obj_conv;
31724 this_obj_conv.inner = (void*)(this_obj & (~1));
31725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31727 QueryChannelRange_free(this_obj_conv);
31730 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31731 LDKQueryChannelRange this_ptr_conv;
31732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31733 this_ptr_conv.is_owned = false;
31734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31735 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31736 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
31740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31741 LDKQueryChannelRange this_ptr_conv;
31742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31743 this_ptr_conv.is_owned = false;
31744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31745 LDKThirtyTwoBytes val_ref;
31746 CHECK((*env)->GetArrayLength(env, val) == 32);
31747 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31748 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31751 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
31752 LDKQueryChannelRange this_ptr_conv;
31753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31754 this_ptr_conv.is_owned = false;
31755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31756 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
31760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31761 LDKQueryChannelRange this_ptr_conv;
31762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31763 this_ptr_conv.is_owned = false;
31764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31765 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
31768 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
31769 LDKQueryChannelRange this_ptr_conv;
31770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31771 this_ptr_conv.is_owned = false;
31772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31773 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
31777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31778 LDKQueryChannelRange this_ptr_conv;
31779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31780 this_ptr_conv.is_owned = false;
31781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31782 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31785 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) {
31786 LDKThirtyTwoBytes chain_hash_arg_ref;
31787 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
31788 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
31789 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
31790 uintptr_t ret_ref = 0;
31791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31794 ret_ref = (uintptr_t)ret_var.inner;
31795 if (ret_var.is_owned) {
31801 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
31802 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
31803 uintptr_t ret_ref = 0;
31804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31807 ret_ref = (uintptr_t)ret_var.inner;
31808 if (ret_var.is_owned) {
31813 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31814 LDKQueryChannelRange arg_conv;
31815 arg_conv.inner = (void*)(arg & (~1));
31816 arg_conv.is_owned = false;
31817 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31818 intptr_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
31822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31823 LDKQueryChannelRange orig_conv;
31824 orig_conv.inner = (void*)(orig & (~1));
31825 orig_conv.is_owned = false;
31826 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31827 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
31828 uintptr_t ret_ref = 0;
31829 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31830 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31831 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31832 ret_ref = (uintptr_t)ret_var.inner;
31833 if (ret_var.is_owned) {
31839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31840 LDKReplyChannelRange this_obj_conv;
31841 this_obj_conv.inner = (void*)(this_obj & (~1));
31842 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31844 ReplyChannelRange_free(this_obj_conv);
31847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31848 LDKReplyChannelRange this_ptr_conv;
31849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31850 this_ptr_conv.is_owned = false;
31851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31852 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31853 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
31857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31858 LDKReplyChannelRange this_ptr_conv;
31859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31860 this_ptr_conv.is_owned = false;
31861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31862 LDKThirtyTwoBytes val_ref;
31863 CHECK((*env)->GetArrayLength(env, val) == 32);
31864 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31865 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
31868 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
31869 LDKReplyChannelRange this_ptr_conv;
31870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31871 this_ptr_conv.is_owned = false;
31872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31873 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
31877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31878 LDKReplyChannelRange this_ptr_conv;
31879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31880 this_ptr_conv.is_owned = false;
31881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31882 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
31885 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
31886 LDKReplyChannelRange this_ptr_conv;
31887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31888 this_ptr_conv.is_owned = false;
31889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31890 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
31894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31895 LDKReplyChannelRange this_ptr_conv;
31896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31897 this_ptr_conv.is_owned = false;
31898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31899 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
31902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
31903 LDKReplyChannelRange this_ptr_conv;
31904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31905 this_ptr_conv.is_owned = false;
31906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31907 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
31911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
31912 LDKReplyChannelRange this_ptr_conv;
31913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31914 this_ptr_conv.is_owned = false;
31915 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31916 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
31919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
31920 LDKReplyChannelRange this_ptr_conv;
31921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31922 this_ptr_conv.is_owned = false;
31923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31924 LDKCVec_u64Z val_constr;
31925 val_constr.datalen = (*env)->GetArrayLength(env, val);
31926 if (val_constr.datalen > 0)
31927 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31929 val_constr.data = NULL;
31930 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
31931 for (size_t g = 0; g < val_constr.datalen; g++) {
31932 int64_t val_conv_6 = val_vals[g];
31933 val_constr.data[g] = val_conv_6;
31935 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
31936 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
31939 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) {
31940 LDKThirtyTwoBytes chain_hash_arg_ref;
31941 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
31942 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
31943 LDKCVec_u64Z short_channel_ids_arg_constr;
31944 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
31945 if (short_channel_ids_arg_constr.datalen > 0)
31946 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
31948 short_channel_ids_arg_constr.data = NULL;
31949 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
31950 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
31951 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
31952 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
31954 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
31955 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
31956 uintptr_t ret_ref = 0;
31957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31960 ret_ref = (uintptr_t)ret_var.inner;
31961 if (ret_var.is_owned) {
31967 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
31968 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
31969 uintptr_t ret_ref = 0;
31970 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31971 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31972 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31973 ret_ref = (uintptr_t)ret_var.inner;
31974 if (ret_var.is_owned) {
31979 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31980 LDKReplyChannelRange arg_conv;
31981 arg_conv.inner = (void*)(arg & (~1));
31982 arg_conv.is_owned = false;
31983 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31984 intptr_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
31988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31989 LDKReplyChannelRange orig_conv;
31990 orig_conv.inner = (void*)(orig & (~1));
31991 orig_conv.is_owned = false;
31992 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31993 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
31994 uintptr_t ret_ref = 0;
31995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31998 ret_ref = (uintptr_t)ret_var.inner;
31999 if (ret_var.is_owned) {
32005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32006 LDKQueryShortChannelIds this_obj_conv;
32007 this_obj_conv.inner = (void*)(this_obj & (~1));
32008 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32010 QueryShortChannelIds_free(this_obj_conv);
32013 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32014 LDKQueryShortChannelIds this_ptr_conv;
32015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32016 this_ptr_conv.is_owned = false;
32017 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32018 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32019 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
32023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32024 LDKQueryShortChannelIds this_ptr_conv;
32025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32026 this_ptr_conv.is_owned = false;
32027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32028 LDKThirtyTwoBytes val_ref;
32029 CHECK((*env)->GetArrayLength(env, val) == 32);
32030 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32031 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
32034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
32035 LDKQueryShortChannelIds this_ptr_conv;
32036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32037 this_ptr_conv.is_owned = false;
32038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32039 LDKCVec_u64Z val_constr;
32040 val_constr.datalen = (*env)->GetArrayLength(env, val);
32041 if (val_constr.datalen > 0)
32042 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32044 val_constr.data = NULL;
32045 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32046 for (size_t g = 0; g < val_constr.datalen; g++) {
32047 int64_t val_conv_6 = val_vals[g];
32048 val_constr.data[g] = val_conv_6;
32050 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32051 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
32054 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) {
32055 LDKThirtyTwoBytes chain_hash_arg_ref;
32056 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
32057 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
32058 LDKCVec_u64Z short_channel_ids_arg_constr;
32059 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
32060 if (short_channel_ids_arg_constr.datalen > 0)
32061 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32063 short_channel_ids_arg_constr.data = NULL;
32064 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
32065 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
32066 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
32067 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
32069 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
32070 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
32071 uintptr_t ret_ref = 0;
32072 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32073 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32074 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32075 ret_ref = (uintptr_t)ret_var.inner;
32076 if (ret_var.is_owned) {
32082 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
32083 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
32084 uintptr_t ret_ref = 0;
32085 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32086 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32087 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32088 ret_ref = (uintptr_t)ret_var.inner;
32089 if (ret_var.is_owned) {
32094 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32095 LDKQueryShortChannelIds arg_conv;
32096 arg_conv.inner = (void*)(arg & (~1));
32097 arg_conv.is_owned = false;
32098 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32099 intptr_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
32103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32104 LDKQueryShortChannelIds orig_conv;
32105 orig_conv.inner = (void*)(orig & (~1));
32106 orig_conv.is_owned = false;
32107 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32108 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
32109 uintptr_t ret_ref = 0;
32110 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32111 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32112 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32113 ret_ref = (uintptr_t)ret_var.inner;
32114 if (ret_var.is_owned) {
32120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32121 LDKReplyShortChannelIdsEnd this_obj_conv;
32122 this_obj_conv.inner = (void*)(this_obj & (~1));
32123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32125 ReplyShortChannelIdsEnd_free(this_obj_conv);
32128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32129 LDKReplyShortChannelIdsEnd this_ptr_conv;
32130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32131 this_ptr_conv.is_owned = false;
32132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32133 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32134 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
32138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32139 LDKReplyShortChannelIdsEnd this_ptr_conv;
32140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32141 this_ptr_conv.is_owned = false;
32142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32143 LDKThirtyTwoBytes val_ref;
32144 CHECK((*env)->GetArrayLength(env, val) == 32);
32145 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32146 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
32149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
32150 LDKReplyShortChannelIdsEnd this_ptr_conv;
32151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32152 this_ptr_conv.is_owned = false;
32153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32154 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
32158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
32159 LDKReplyShortChannelIdsEnd this_ptr_conv;
32160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32161 this_ptr_conv.is_owned = false;
32162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32163 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
32166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
32167 LDKThirtyTwoBytes chain_hash_arg_ref;
32168 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
32169 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
32170 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
32171 uintptr_t ret_ref = 0;
32172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32175 ret_ref = (uintptr_t)ret_var.inner;
32176 if (ret_var.is_owned) {
32182 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
32183 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
32184 uintptr_t ret_ref = 0;
32185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32188 ret_ref = (uintptr_t)ret_var.inner;
32189 if (ret_var.is_owned) {
32194 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32195 LDKReplyShortChannelIdsEnd arg_conv;
32196 arg_conv.inner = (void*)(arg & (~1));
32197 arg_conv.is_owned = false;
32198 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32199 intptr_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
32203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32204 LDKReplyShortChannelIdsEnd orig_conv;
32205 orig_conv.inner = (void*)(orig & (~1));
32206 orig_conv.is_owned = false;
32207 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32208 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
32209 uintptr_t ret_ref = 0;
32210 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32211 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32212 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32213 ret_ref = (uintptr_t)ret_var.inner;
32214 if (ret_var.is_owned) {
32220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32221 LDKGossipTimestampFilter this_obj_conv;
32222 this_obj_conv.inner = (void*)(this_obj & (~1));
32223 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32224 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32225 GossipTimestampFilter_free(this_obj_conv);
32228 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32229 LDKGossipTimestampFilter this_ptr_conv;
32230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32231 this_ptr_conv.is_owned = false;
32232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32233 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32234 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
32238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32239 LDKGossipTimestampFilter this_ptr_conv;
32240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32241 this_ptr_conv.is_owned = false;
32242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32243 LDKThirtyTwoBytes val_ref;
32244 CHECK((*env)->GetArrayLength(env, val) == 32);
32245 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32246 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
32249 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
32250 LDKGossipTimestampFilter this_ptr_conv;
32251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32252 this_ptr_conv.is_owned = false;
32253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32254 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
32258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32259 LDKGossipTimestampFilter this_ptr_conv;
32260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32261 this_ptr_conv.is_owned = false;
32262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32263 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
32266 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
32267 LDKGossipTimestampFilter this_ptr_conv;
32268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32269 this_ptr_conv.is_owned = false;
32270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32271 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
32275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32276 LDKGossipTimestampFilter this_ptr_conv;
32277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32278 this_ptr_conv.is_owned = false;
32279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32280 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
32283 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) {
32284 LDKThirtyTwoBytes chain_hash_arg_ref;
32285 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
32286 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
32287 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
32288 uintptr_t ret_ref = 0;
32289 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32290 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32292 ret_ref = (uintptr_t)ret_var.inner;
32293 if (ret_var.is_owned) {
32299 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
32300 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
32301 uintptr_t ret_ref = 0;
32302 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32303 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32304 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32305 ret_ref = (uintptr_t)ret_var.inner;
32306 if (ret_var.is_owned) {
32311 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32312 LDKGossipTimestampFilter arg_conv;
32313 arg_conv.inner = (void*)(arg & (~1));
32314 arg_conv.is_owned = false;
32315 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32316 intptr_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
32320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32321 LDKGossipTimestampFilter orig_conv;
32322 orig_conv.inner = (void*)(orig & (~1));
32323 orig_conv.is_owned = false;
32324 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32325 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
32326 uintptr_t ret_ref = 0;
32327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32330 ret_ref = (uintptr_t)ret_var.inner;
32331 if (ret_var.is_owned) {
32337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32338 if ((this_ptr & 1) != 0) return;
32339 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32340 CHECK_ACCESS(this_ptr_ptr);
32341 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
32342 FREE((void*)this_ptr);
32343 ErrorAction_free(this_ptr_conv);
32346 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
32347 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32348 *ret_copy = ErrorAction_clone(arg);
32349 uintptr_t ret_ref = (uintptr_t)ret_copy;
32352 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32353 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
32354 intptr_t ret_val = ErrorAction_clone_ptr(arg_conv);
32358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32359 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
32360 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32361 *ret_copy = ErrorAction_clone(orig_conv);
32362 uintptr_t ret_ref = (uintptr_t)ret_copy;
32366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
32367 LDKErrorMessage msg_conv;
32368 msg_conv.inner = (void*)(msg & (~1));
32369 msg_conv.is_owned = (msg & 1) || (msg == 0);
32370 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32371 msg_conv = ErrorMessage_clone(&msg_conv);
32372 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32373 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
32374 uintptr_t ret_ref = (uintptr_t)ret_copy;
32378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
32379 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32380 *ret_copy = ErrorAction_ignore_error();
32381 uintptr_t ret_ref = (uintptr_t)ret_copy;
32385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
32386 LDKLevel a_conv = LDKLevel_from_java(env, a);
32387 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32388 *ret_copy = ErrorAction_ignore_and_log(a_conv);
32389 uintptr_t ret_ref = (uintptr_t)ret_copy;
32393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
32394 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32395 *ret_copy = ErrorAction_ignore_duplicate_gossip();
32396 uintptr_t ret_ref = (uintptr_t)ret_copy;
32400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
32401 LDKErrorMessage msg_conv;
32402 msg_conv.inner = (void*)(msg & (~1));
32403 msg_conv.is_owned = (msg & 1) || (msg == 0);
32404 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
32405 msg_conv = ErrorMessage_clone(&msg_conv);
32406 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32407 *ret_copy = ErrorAction_send_error_message(msg_conv);
32408 uintptr_t ret_ref = (uintptr_t)ret_copy;
32412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32413 LDKLightningError this_obj_conv;
32414 this_obj_conv.inner = (void*)(this_obj & (~1));
32415 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32416 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32417 LightningError_free(this_obj_conv);
32420 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
32421 LDKLightningError this_ptr_conv;
32422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32423 this_ptr_conv.is_owned = false;
32424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32425 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
32426 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
32431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
32432 LDKLightningError this_ptr_conv;
32433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32434 this_ptr_conv.is_owned = false;
32435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32436 LDKStr val_conv = java_to_owned_str(env, val);
32437 LightningError_set_err(&this_ptr_conv, val_conv);
32440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
32441 LDKLightningError this_ptr_conv;
32442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32443 this_ptr_conv.is_owned = false;
32444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32445 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
32446 *ret_copy = LightningError_get_action(&this_ptr_conv);
32447 uintptr_t ret_ref = (uintptr_t)ret_copy;
32451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32452 LDKLightningError this_ptr_conv;
32453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32454 this_ptr_conv.is_owned = false;
32455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32456 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
32457 CHECK_ACCESS(val_ptr);
32458 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
32459 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
32460 LightningError_set_action(&this_ptr_conv, val_conv);
32463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
32464 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
32465 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
32466 CHECK_ACCESS(action_arg_ptr);
32467 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
32468 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
32469 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
32470 uintptr_t ret_ref = 0;
32471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32474 ret_ref = (uintptr_t)ret_var.inner;
32475 if (ret_var.is_owned) {
32481 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
32482 LDKLightningError ret_var = LightningError_clone(arg);
32483 uintptr_t ret_ref = 0;
32484 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32485 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32486 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32487 ret_ref = (uintptr_t)ret_var.inner;
32488 if (ret_var.is_owned) {
32493 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32494 LDKLightningError arg_conv;
32495 arg_conv.inner = (void*)(arg & (~1));
32496 arg_conv.is_owned = false;
32497 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32498 intptr_t ret_val = LightningError_clone_ptr(&arg_conv);
32502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32503 LDKLightningError orig_conv;
32504 orig_conv.inner = (void*)(orig & (~1));
32505 orig_conv.is_owned = false;
32506 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32507 LDKLightningError ret_var = LightningError_clone(&orig_conv);
32508 uintptr_t ret_ref = 0;
32509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32512 ret_ref = (uintptr_t)ret_var.inner;
32513 if (ret_var.is_owned) {
32519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32520 LDKCommitmentUpdate this_obj_conv;
32521 this_obj_conv.inner = (void*)(this_obj & (~1));
32522 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32524 CommitmentUpdate_free(this_obj_conv);
32527 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32528 LDKCommitmentUpdate this_ptr_conv;
32529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32530 this_ptr_conv.is_owned = false;
32531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32532 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
32533 int64_tArray ret_arr = NULL;
32534 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
32535 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
32536 for (size_t p = 0; p < ret_var.datalen; p++) {
32537 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
32538 uintptr_t ret_conv_15_ref = 0;
32539 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32540 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
32542 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
32543 if (ret_conv_15_var.is_owned) {
32544 ret_conv_15_ref |= 1;
32546 ret_arr_ptr[p] = ret_conv_15_ref;
32548 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
32549 FREE(ret_var.data);
32553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
32554 LDKCommitmentUpdate this_ptr_conv;
32555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32556 this_ptr_conv.is_owned = false;
32557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32558 LDKCVec_UpdateAddHTLCZ val_constr;
32559 val_constr.datalen = (*env)->GetArrayLength(env, val);
32560 if (val_constr.datalen > 0)
32561 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32563 val_constr.data = NULL;
32564 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32565 for (size_t p = 0; p < val_constr.datalen; p++) {
32566 int64_t val_conv_15 = val_vals[p];
32567 LDKUpdateAddHTLC val_conv_15_conv;
32568 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
32569 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
32570 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
32571 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
32572 val_constr.data[p] = val_conv_15_conv;
32574 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32575 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
32578 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32579 LDKCommitmentUpdate this_ptr_conv;
32580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32581 this_ptr_conv.is_owned = false;
32582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32583 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
32584 int64_tArray ret_arr = NULL;
32585 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
32586 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
32587 for (size_t t = 0; t < ret_var.datalen; t++) {
32588 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
32589 uintptr_t ret_conv_19_ref = 0;
32590 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32591 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
32593 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
32594 if (ret_conv_19_var.is_owned) {
32595 ret_conv_19_ref |= 1;
32597 ret_arr_ptr[t] = ret_conv_19_ref;
32599 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
32600 FREE(ret_var.data);
32604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
32605 LDKCommitmentUpdate this_ptr_conv;
32606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32607 this_ptr_conv.is_owned = false;
32608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32609 LDKCVec_UpdateFulfillHTLCZ val_constr;
32610 val_constr.datalen = (*env)->GetArrayLength(env, val);
32611 if (val_constr.datalen > 0)
32612 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32614 val_constr.data = NULL;
32615 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32616 for (size_t t = 0; t < val_constr.datalen; t++) {
32617 int64_t val_conv_19 = val_vals[t];
32618 LDKUpdateFulfillHTLC val_conv_19_conv;
32619 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
32620 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
32621 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
32622 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
32623 val_constr.data[t] = val_conv_19_conv;
32625 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32626 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
32629 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32630 LDKCommitmentUpdate this_ptr_conv;
32631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32632 this_ptr_conv.is_owned = false;
32633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32634 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
32635 int64_tArray ret_arr = NULL;
32636 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
32637 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
32638 for (size_t q = 0; q < ret_var.datalen; q++) {
32639 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
32640 uintptr_t ret_conv_16_ref = 0;
32641 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32642 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32644 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
32645 if (ret_conv_16_var.is_owned) {
32646 ret_conv_16_ref |= 1;
32648 ret_arr_ptr[q] = ret_conv_16_ref;
32650 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
32651 FREE(ret_var.data);
32655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
32656 LDKCommitmentUpdate this_ptr_conv;
32657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32658 this_ptr_conv.is_owned = false;
32659 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32660 LDKCVec_UpdateFailHTLCZ val_constr;
32661 val_constr.datalen = (*env)->GetArrayLength(env, val);
32662 if (val_constr.datalen > 0)
32663 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32665 val_constr.data = NULL;
32666 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32667 for (size_t q = 0; q < val_constr.datalen; q++) {
32668 int64_t val_conv_16 = val_vals[q];
32669 LDKUpdateFailHTLC val_conv_16_conv;
32670 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
32671 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
32672 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32673 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
32674 val_constr.data[q] = val_conv_16_conv;
32676 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32677 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
32680 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
32681 LDKCommitmentUpdate this_ptr_conv;
32682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32683 this_ptr_conv.is_owned = false;
32684 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32685 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
32686 int64_tArray ret_arr = NULL;
32687 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
32688 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
32689 for (size_t z = 0; z < ret_var.datalen; z++) {
32690 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
32691 uintptr_t ret_conv_25_ref = 0;
32692 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32693 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
32695 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
32696 if (ret_conv_25_var.is_owned) {
32697 ret_conv_25_ref |= 1;
32699 ret_arr_ptr[z] = ret_conv_25_ref;
32701 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
32702 FREE(ret_var.data);
32706 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) {
32707 LDKCommitmentUpdate this_ptr_conv;
32708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32709 this_ptr_conv.is_owned = false;
32710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32711 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
32712 val_constr.datalen = (*env)->GetArrayLength(env, val);
32713 if (val_constr.datalen > 0)
32714 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32716 val_constr.data = NULL;
32717 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32718 for (size_t z = 0; z < val_constr.datalen; z++) {
32719 int64_t val_conv_25 = val_vals[z];
32720 LDKUpdateFailMalformedHTLC val_conv_25_conv;
32721 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
32722 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
32723 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
32724 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
32725 val_constr.data[z] = val_conv_25_conv;
32727 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32728 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
32731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
32732 LDKCommitmentUpdate this_ptr_conv;
32733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32734 this_ptr_conv.is_owned = false;
32735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32736 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
32737 uintptr_t ret_ref = 0;
32738 if ((uintptr_t)ret_var.inner > 4096) {
32739 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32740 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32742 ret_ref = (uintptr_t)ret_var.inner;
32743 if (ret_var.is_owned) {
32750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32751 LDKCommitmentUpdate this_ptr_conv;
32752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32753 this_ptr_conv.is_owned = false;
32754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32755 LDKUpdateFee val_conv;
32756 val_conv.inner = (void*)(val & (~1));
32757 val_conv.is_owned = (val & 1) || (val == 0);
32758 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32759 val_conv = UpdateFee_clone(&val_conv);
32760 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
32763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
32764 LDKCommitmentUpdate this_ptr_conv;
32765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32766 this_ptr_conv.is_owned = false;
32767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32768 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
32769 uintptr_t ret_ref = 0;
32770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32773 ret_ref = (uintptr_t)ret_var.inner;
32774 if (ret_var.is_owned) {
32780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32781 LDKCommitmentUpdate this_ptr_conv;
32782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32783 this_ptr_conv.is_owned = false;
32784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32785 LDKCommitmentSigned val_conv;
32786 val_conv.inner = (void*)(val & (~1));
32787 val_conv.is_owned = (val & 1) || (val == 0);
32788 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32789 val_conv = CommitmentSigned_clone(&val_conv);
32790 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
32793 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) {
32794 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
32795 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
32796 if (update_add_htlcs_arg_constr.datalen > 0)
32797 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
32799 update_add_htlcs_arg_constr.data = NULL;
32800 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
32801 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
32802 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
32803 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
32804 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
32805 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
32806 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
32807 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
32808 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
32810 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
32811 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
32812 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
32813 if (update_fulfill_htlcs_arg_constr.datalen > 0)
32814 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
32816 update_fulfill_htlcs_arg_constr.data = NULL;
32817 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
32818 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
32819 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
32820 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
32821 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
32822 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
32823 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
32824 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
32825 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
32827 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
32828 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
32829 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
32830 if (update_fail_htlcs_arg_constr.datalen > 0)
32831 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
32833 update_fail_htlcs_arg_constr.data = NULL;
32834 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
32835 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
32836 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
32837 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
32838 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
32839 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
32840 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
32841 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
32842 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
32844 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
32845 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
32846 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
32847 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
32848 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
32850 update_fail_malformed_htlcs_arg_constr.data = NULL;
32851 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
32852 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
32853 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
32854 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
32855 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
32856 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);
32857 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
32858 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
32859 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
32861 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
32862 LDKUpdateFee update_fee_arg_conv;
32863 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
32864 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
32865 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
32866 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
32867 LDKCommitmentSigned commitment_signed_arg_conv;
32868 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
32869 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
32870 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
32871 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
32872 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);
32873 uintptr_t ret_ref = 0;
32874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32877 ret_ref = (uintptr_t)ret_var.inner;
32878 if (ret_var.is_owned) {
32884 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
32885 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
32886 uintptr_t ret_ref = 0;
32887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32890 ret_ref = (uintptr_t)ret_var.inner;
32891 if (ret_var.is_owned) {
32896 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32897 LDKCommitmentUpdate arg_conv;
32898 arg_conv.inner = (void*)(arg & (~1));
32899 arg_conv.is_owned = false;
32900 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32901 intptr_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
32905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32906 LDKCommitmentUpdate orig_conv;
32907 orig_conv.inner = (void*)(orig & (~1));
32908 orig_conv.is_owned = false;
32909 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32910 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
32911 uintptr_t ret_ref = 0;
32912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32915 ret_ref = (uintptr_t)ret_var.inner;
32916 if (ret_var.is_owned) {
32922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32923 if ((this_ptr & 1) != 0) return;
32924 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32925 CHECK_ACCESS(this_ptr_ptr);
32926 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
32927 FREE((void*)this_ptr);
32928 ChannelMessageHandler_free(this_ptr_conv);
32931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32932 if ((this_ptr & 1) != 0) return;
32933 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32934 CHECK_ACCESS(this_ptr_ptr);
32935 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
32936 FREE((void*)this_ptr);
32937 RoutingMessageHandler_free(this_ptr_conv);
32940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
32941 LDKAcceptChannel obj_conv;
32942 obj_conv.inner = (void*)(obj & (~1));
32943 obj_conv.is_owned = false;
32944 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32945 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
32946 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32947 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32948 CVec_u8Z_free(ret_var);
32952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32953 LDKu8slice ser_ref;
32954 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32955 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32956 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
32957 *ret_conv = AcceptChannel_read(ser_ref);
32958 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32959 return (uintptr_t)ret_conv;
32962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
32963 LDKAnnouncementSignatures obj_conv;
32964 obj_conv.inner = (void*)(obj & (~1));
32965 obj_conv.is_owned = false;
32966 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32967 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
32968 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32969 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32970 CVec_u8Z_free(ret_var);
32974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32975 LDKu8slice ser_ref;
32976 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32977 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32978 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
32979 *ret_conv = AnnouncementSignatures_read(ser_ref);
32980 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32981 return (uintptr_t)ret_conv;
32984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
32985 LDKChannelReestablish obj_conv;
32986 obj_conv.inner = (void*)(obj & (~1));
32987 obj_conv.is_owned = false;
32988 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
32989 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
32990 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32991 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32992 CVec_u8Z_free(ret_var);
32996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32997 LDKu8slice ser_ref;
32998 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32999 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33000 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
33001 *ret_conv = ChannelReestablish_read(ser_ref);
33002 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33003 return (uintptr_t)ret_conv;
33006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
33007 LDKClosingSigned obj_conv;
33008 obj_conv.inner = (void*)(obj & (~1));
33009 obj_conv.is_owned = false;
33010 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33011 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
33012 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33013 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33014 CVec_u8Z_free(ret_var);
33018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33019 LDKu8slice ser_ref;
33020 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33021 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33022 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
33023 *ret_conv = ClosingSigned_read(ser_ref);
33024 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33025 return (uintptr_t)ret_conv;
33028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
33029 LDKClosingSignedFeeRange obj_conv;
33030 obj_conv.inner = (void*)(obj & (~1));
33031 obj_conv.is_owned = false;
33032 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33033 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
33034 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33035 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33036 CVec_u8Z_free(ret_var);
33040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33041 LDKu8slice ser_ref;
33042 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33043 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33044 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
33045 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
33046 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33047 return (uintptr_t)ret_conv;
33050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
33051 LDKCommitmentSigned obj_conv;
33052 obj_conv.inner = (void*)(obj & (~1));
33053 obj_conv.is_owned = false;
33054 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33055 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
33056 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33057 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33058 CVec_u8Z_free(ret_var);
33062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33063 LDKu8slice ser_ref;
33064 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33065 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33066 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
33067 *ret_conv = CommitmentSigned_read(ser_ref);
33068 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33069 return (uintptr_t)ret_conv;
33072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
33073 LDKFundingCreated obj_conv;
33074 obj_conv.inner = (void*)(obj & (~1));
33075 obj_conv.is_owned = false;
33076 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33077 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
33078 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33079 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33080 CVec_u8Z_free(ret_var);
33084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33085 LDKu8slice ser_ref;
33086 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33087 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33088 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
33089 *ret_conv = FundingCreated_read(ser_ref);
33090 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33091 return (uintptr_t)ret_conv;
33094 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
33095 LDKFundingSigned obj_conv;
33096 obj_conv.inner = (void*)(obj & (~1));
33097 obj_conv.is_owned = false;
33098 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33099 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
33100 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33101 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33102 CVec_u8Z_free(ret_var);
33106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33107 LDKu8slice ser_ref;
33108 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33109 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33110 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
33111 *ret_conv = FundingSigned_read(ser_ref);
33112 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33113 return (uintptr_t)ret_conv;
33116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
33117 LDKFundingLocked obj_conv;
33118 obj_conv.inner = (void*)(obj & (~1));
33119 obj_conv.is_owned = false;
33120 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33121 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
33122 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33123 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33124 CVec_u8Z_free(ret_var);
33128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33129 LDKu8slice ser_ref;
33130 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33131 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33132 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
33133 *ret_conv = FundingLocked_read(ser_ref);
33134 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33135 return (uintptr_t)ret_conv;
33138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
33140 obj_conv.inner = (void*)(obj & (~1));
33141 obj_conv.is_owned = false;
33142 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33143 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
33144 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33145 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33146 CVec_u8Z_free(ret_var);
33150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33151 LDKu8slice ser_ref;
33152 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33153 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33154 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
33155 *ret_conv = Init_read(ser_ref);
33156 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33157 return (uintptr_t)ret_conv;
33160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
33161 LDKOpenChannel obj_conv;
33162 obj_conv.inner = (void*)(obj & (~1));
33163 obj_conv.is_owned = false;
33164 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33165 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
33166 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33167 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33168 CVec_u8Z_free(ret_var);
33172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33173 LDKu8slice ser_ref;
33174 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33175 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33176 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
33177 *ret_conv = OpenChannel_read(ser_ref);
33178 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33179 return (uintptr_t)ret_conv;
33182 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
33183 LDKRevokeAndACK obj_conv;
33184 obj_conv.inner = (void*)(obj & (~1));
33185 obj_conv.is_owned = false;
33186 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33187 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
33188 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33189 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33190 CVec_u8Z_free(ret_var);
33194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33195 LDKu8slice ser_ref;
33196 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33197 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33198 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
33199 *ret_conv = RevokeAndACK_read(ser_ref);
33200 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33201 return (uintptr_t)ret_conv;
33204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
33205 LDKShutdown obj_conv;
33206 obj_conv.inner = (void*)(obj & (~1));
33207 obj_conv.is_owned = false;
33208 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33209 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
33210 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33211 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33212 CVec_u8Z_free(ret_var);
33216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33217 LDKu8slice ser_ref;
33218 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33219 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33220 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
33221 *ret_conv = Shutdown_read(ser_ref);
33222 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33223 return (uintptr_t)ret_conv;
33226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
33227 LDKUpdateFailHTLC obj_conv;
33228 obj_conv.inner = (void*)(obj & (~1));
33229 obj_conv.is_owned = false;
33230 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33231 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
33232 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33233 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33234 CVec_u8Z_free(ret_var);
33238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33239 LDKu8slice ser_ref;
33240 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33241 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33242 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
33243 *ret_conv = UpdateFailHTLC_read(ser_ref);
33244 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33245 return (uintptr_t)ret_conv;
33248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
33249 LDKUpdateFailMalformedHTLC obj_conv;
33250 obj_conv.inner = (void*)(obj & (~1));
33251 obj_conv.is_owned = false;
33252 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33253 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
33254 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33255 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33256 CVec_u8Z_free(ret_var);
33260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33261 LDKu8slice ser_ref;
33262 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33263 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33264 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
33265 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
33266 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33267 return (uintptr_t)ret_conv;
33270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
33271 LDKUpdateFee obj_conv;
33272 obj_conv.inner = (void*)(obj & (~1));
33273 obj_conv.is_owned = false;
33274 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33275 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
33276 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33277 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33278 CVec_u8Z_free(ret_var);
33282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33283 LDKu8slice ser_ref;
33284 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33285 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33286 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
33287 *ret_conv = UpdateFee_read(ser_ref);
33288 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33289 return (uintptr_t)ret_conv;
33292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
33293 LDKUpdateFulfillHTLC obj_conv;
33294 obj_conv.inner = (void*)(obj & (~1));
33295 obj_conv.is_owned = false;
33296 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33297 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
33298 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33299 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33300 CVec_u8Z_free(ret_var);
33304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33305 LDKu8slice ser_ref;
33306 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33307 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33308 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
33309 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
33310 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33311 return (uintptr_t)ret_conv;
33314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
33315 LDKUpdateAddHTLC obj_conv;
33316 obj_conv.inner = (void*)(obj & (~1));
33317 obj_conv.is_owned = false;
33318 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33319 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
33320 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33321 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33322 CVec_u8Z_free(ret_var);
33326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33327 LDKu8slice ser_ref;
33328 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33329 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33330 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
33331 *ret_conv = UpdateAddHTLC_read(ser_ref);
33332 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33333 return (uintptr_t)ret_conv;
33336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
33338 obj_conv.inner = (void*)(obj & (~1));
33339 obj_conv.is_owned = false;
33340 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33341 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
33342 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33343 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33344 CVec_u8Z_free(ret_var);
33348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33349 LDKu8slice ser_ref;
33350 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33351 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33352 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
33353 *ret_conv = Ping_read(ser_ref);
33354 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33355 return (uintptr_t)ret_conv;
33358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
33360 obj_conv.inner = (void*)(obj & (~1));
33361 obj_conv.is_owned = false;
33362 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33363 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
33364 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33365 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33366 CVec_u8Z_free(ret_var);
33370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33371 LDKu8slice ser_ref;
33372 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33373 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33374 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
33375 *ret_conv = Pong_read(ser_ref);
33376 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33377 return (uintptr_t)ret_conv;
33380 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
33381 LDKUnsignedChannelAnnouncement obj_conv;
33382 obj_conv.inner = (void*)(obj & (~1));
33383 obj_conv.is_owned = false;
33384 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33385 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
33386 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33387 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33388 CVec_u8Z_free(ret_var);
33392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33393 LDKu8slice ser_ref;
33394 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33395 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33396 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
33397 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
33398 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33399 return (uintptr_t)ret_conv;
33402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
33403 LDKChannelAnnouncement obj_conv;
33404 obj_conv.inner = (void*)(obj & (~1));
33405 obj_conv.is_owned = false;
33406 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33407 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
33408 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33409 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33410 CVec_u8Z_free(ret_var);
33414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33415 LDKu8slice ser_ref;
33416 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33417 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33418 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
33419 *ret_conv = ChannelAnnouncement_read(ser_ref);
33420 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33421 return (uintptr_t)ret_conv;
33424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
33425 LDKUnsignedChannelUpdate obj_conv;
33426 obj_conv.inner = (void*)(obj & (~1));
33427 obj_conv.is_owned = false;
33428 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33429 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
33430 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33431 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33432 CVec_u8Z_free(ret_var);
33436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33437 LDKu8slice ser_ref;
33438 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33439 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33440 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
33441 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
33442 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33443 return (uintptr_t)ret_conv;
33446 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
33447 LDKChannelUpdate obj_conv;
33448 obj_conv.inner = (void*)(obj & (~1));
33449 obj_conv.is_owned = false;
33450 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33451 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
33452 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33453 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33454 CVec_u8Z_free(ret_var);
33458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33459 LDKu8slice ser_ref;
33460 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33461 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33462 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
33463 *ret_conv = ChannelUpdate_read(ser_ref);
33464 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33465 return (uintptr_t)ret_conv;
33468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
33469 LDKErrorMessage obj_conv;
33470 obj_conv.inner = (void*)(obj & (~1));
33471 obj_conv.is_owned = false;
33472 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33473 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
33474 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33475 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33476 CVec_u8Z_free(ret_var);
33480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33481 LDKu8slice ser_ref;
33482 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33483 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33484 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
33485 *ret_conv = ErrorMessage_read(ser_ref);
33486 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33487 return (uintptr_t)ret_conv;
33490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
33491 LDKUnsignedNodeAnnouncement obj_conv;
33492 obj_conv.inner = (void*)(obj & (~1));
33493 obj_conv.is_owned = false;
33494 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33495 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
33496 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33497 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33498 CVec_u8Z_free(ret_var);
33502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33503 LDKu8slice ser_ref;
33504 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33505 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33506 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
33507 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
33508 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33509 return (uintptr_t)ret_conv;
33512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
33513 LDKNodeAnnouncement obj_conv;
33514 obj_conv.inner = (void*)(obj & (~1));
33515 obj_conv.is_owned = false;
33516 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33517 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
33518 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33519 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33520 CVec_u8Z_free(ret_var);
33524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33525 LDKu8slice ser_ref;
33526 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33527 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33528 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
33529 *ret_conv = NodeAnnouncement_read(ser_ref);
33530 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33531 return (uintptr_t)ret_conv;
33534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33535 LDKu8slice ser_ref;
33536 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33537 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33538 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
33539 *ret_conv = QueryShortChannelIds_read(ser_ref);
33540 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33541 return (uintptr_t)ret_conv;
33544 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
33545 LDKQueryShortChannelIds obj_conv;
33546 obj_conv.inner = (void*)(obj & (~1));
33547 obj_conv.is_owned = false;
33548 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33549 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
33550 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33551 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33552 CVec_u8Z_free(ret_var);
33556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
33557 LDKReplyShortChannelIdsEnd obj_conv;
33558 obj_conv.inner = (void*)(obj & (~1));
33559 obj_conv.is_owned = false;
33560 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33561 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
33562 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33563 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33564 CVec_u8Z_free(ret_var);
33568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33569 LDKu8slice ser_ref;
33570 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33571 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33572 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
33573 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
33574 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33575 return (uintptr_t)ret_conv;
33578 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
33579 LDKQueryChannelRange this_arg_conv;
33580 this_arg_conv.inner = (void*)(this_arg & (~1));
33581 this_arg_conv.is_owned = false;
33582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33583 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
33587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
33588 LDKQueryChannelRange obj_conv;
33589 obj_conv.inner = (void*)(obj & (~1));
33590 obj_conv.is_owned = false;
33591 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33592 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
33593 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33594 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33595 CVec_u8Z_free(ret_var);
33599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33600 LDKu8slice ser_ref;
33601 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33602 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33603 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
33604 *ret_conv = QueryChannelRange_read(ser_ref);
33605 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33606 return (uintptr_t)ret_conv;
33609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33610 LDKu8slice ser_ref;
33611 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33612 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33613 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
33614 *ret_conv = ReplyChannelRange_read(ser_ref);
33615 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33616 return (uintptr_t)ret_conv;
33619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
33620 LDKReplyChannelRange obj_conv;
33621 obj_conv.inner = (void*)(obj & (~1));
33622 obj_conv.is_owned = false;
33623 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33624 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
33625 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33626 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33627 CVec_u8Z_free(ret_var);
33631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
33632 LDKGossipTimestampFilter obj_conv;
33633 obj_conv.inner = (void*)(obj & (~1));
33634 obj_conv.is_owned = false;
33635 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33636 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
33637 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33638 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33639 CVec_u8Z_free(ret_var);
33643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33644 LDKu8slice ser_ref;
33645 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33646 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33647 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
33648 *ret_conv = GossipTimestampFilter_read(ser_ref);
33649 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33650 return (uintptr_t)ret_conv;
33653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33654 if ((this_ptr & 1) != 0) return;
33655 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33656 CHECK_ACCESS(this_ptr_ptr);
33657 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
33658 FREE((void*)this_ptr);
33659 CustomMessageHandler_free(this_ptr_conv);
33662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33663 LDKIgnoringMessageHandler this_obj_conv;
33664 this_obj_conv.inner = (void*)(this_obj & (~1));
33665 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33667 IgnoringMessageHandler_free(this_obj_conv);
33670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
33671 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
33672 uintptr_t ret_ref = 0;
33673 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33674 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33675 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33676 ret_ref = (uintptr_t)ret_var.inner;
33677 if (ret_var.is_owned) {
33683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
33684 LDKIgnoringMessageHandler this_arg_conv;
33685 this_arg_conv.inner = (void*)(this_arg & (~1));
33686 this_arg_conv.is_owned = false;
33687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33688 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33689 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33690 return (uintptr_t)ret_ret;
33693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
33694 LDKIgnoringMessageHandler this_arg_conv;
33695 this_arg_conv.inner = (void*)(this_arg & (~1));
33696 this_arg_conv.is_owned = false;
33697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33698 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
33699 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
33700 return (uintptr_t)ret_ret;
33703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
33704 LDKIgnoringMessageHandler this_arg_conv;
33705 this_arg_conv.inner = (void*)(this_arg & (~1));
33706 this_arg_conv.is_owned = false;
33707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33708 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
33709 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
33710 return (uintptr_t)ret_ret;
33713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
33714 LDKIgnoringMessageHandler this_arg_conv;
33715 this_arg_conv.inner = (void*)(this_arg & (~1));
33716 this_arg_conv.is_owned = false;
33717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33718 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
33719 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
33720 return (uintptr_t)ret_ret;
33723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33724 LDKErroringMessageHandler this_obj_conv;
33725 this_obj_conv.inner = (void*)(this_obj & (~1));
33726 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33728 ErroringMessageHandler_free(this_obj_conv);
33731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
33732 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
33733 uintptr_t ret_ref = 0;
33734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33737 ret_ref = (uintptr_t)ret_var.inner;
33738 if (ret_var.is_owned) {
33744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
33745 LDKErroringMessageHandler this_arg_conv;
33746 this_arg_conv.inner = (void*)(this_arg & (~1));
33747 this_arg_conv.is_owned = false;
33748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33749 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33750 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
33751 return (uintptr_t)ret_ret;
33754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
33755 LDKErroringMessageHandler this_arg_conv;
33756 this_arg_conv.inner = (void*)(this_arg & (~1));
33757 this_arg_conv.is_owned = false;
33758 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33759 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33760 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
33761 return (uintptr_t)ret_ret;
33764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33765 LDKMessageHandler this_obj_conv;
33766 this_obj_conv.inner = (void*)(this_obj & (~1));
33767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33769 MessageHandler_free(this_obj_conv);
33772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
33773 LDKMessageHandler this_ptr_conv;
33774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33775 this_ptr_conv.is_owned = false;
33776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33777 // WARNING: This object doesn't live past this scope, needs clone!
33778 uintptr_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
33782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33783 LDKMessageHandler this_ptr_conv;
33784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33785 this_ptr_conv.is_owned = false;
33786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33787 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33788 CHECK_ACCESS(val_ptr);
33789 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
33790 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
33791 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33792 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
33794 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
33797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
33798 LDKMessageHandler this_ptr_conv;
33799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33800 this_ptr_conv.is_owned = false;
33801 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33802 // WARNING: This object doesn't live past this scope, needs clone!
33803 uintptr_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
33807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33808 LDKMessageHandler this_ptr_conv;
33809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33810 this_ptr_conv.is_owned = false;
33811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33812 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
33813 CHECK_ACCESS(val_ptr);
33814 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
33815 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33816 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33817 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
33819 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
33822 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) {
33823 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
33824 CHECK_ACCESS(chan_handler_arg_ptr);
33825 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
33826 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
33827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33828 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
33830 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
33831 CHECK_ACCESS(route_handler_arg_ptr);
33832 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
33833 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
33834 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33835 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
33837 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
33838 uintptr_t ret_ref = 0;
33839 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33840 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33841 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33842 ret_ref = (uintptr_t)ret_var.inner;
33843 if (ret_var.is_owned) {
33849 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
33850 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33851 *ret_ret = SocketDescriptor_clone(arg);
33852 return (uintptr_t)ret_ret;
33854 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33855 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
33856 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
33857 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
33858 intptr_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
33862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33863 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
33864 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
33865 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
33866 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
33867 *ret_ret = SocketDescriptor_clone(orig_conv);
33868 return (uintptr_t)ret_ret;
33871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33872 if ((this_ptr & 1) != 0) return;
33873 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33874 CHECK_ACCESS(this_ptr_ptr);
33875 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
33876 FREE((void*)this_ptr);
33877 SocketDescriptor_free(this_ptr_conv);
33880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33881 LDKPeerHandleError this_obj_conv;
33882 this_obj_conv.inner = (void*)(this_obj & (~1));
33883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33885 PeerHandleError_free(this_obj_conv);
33888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
33889 LDKPeerHandleError this_ptr_conv;
33890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33891 this_ptr_conv.is_owned = false;
33892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33893 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
33897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33898 LDKPeerHandleError this_ptr_conv;
33899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33900 this_ptr_conv.is_owned = false;
33901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33902 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
33905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
33906 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
33907 uintptr_t ret_ref = 0;
33908 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33909 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33910 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33911 ret_ref = (uintptr_t)ret_var.inner;
33912 if (ret_var.is_owned) {
33918 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
33919 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
33920 uintptr_t ret_ref = 0;
33921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33924 ret_ref = (uintptr_t)ret_var.inner;
33925 if (ret_var.is_owned) {
33930 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33931 LDKPeerHandleError arg_conv;
33932 arg_conv.inner = (void*)(arg & (~1));
33933 arg_conv.is_owned = false;
33934 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33935 intptr_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
33939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33940 LDKPeerHandleError orig_conv;
33941 orig_conv.inner = (void*)(orig & (~1));
33942 orig_conv.is_owned = false;
33943 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33944 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
33945 uintptr_t ret_ref = 0;
33946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33949 ret_ref = (uintptr_t)ret_var.inner;
33950 if (ret_var.is_owned) {
33956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33957 LDKPeerManager this_obj_conv;
33958 this_obj_conv.inner = (void*)(this_obj & (~1));
33959 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33961 PeerManager_free(this_obj_conv);
33964 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) {
33965 LDKMessageHandler message_handler_conv;
33966 message_handler_conv.inner = (void*)(message_handler & (~1));
33967 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
33968 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
33969 // Warning: we need a move here but no clone is available for LDKMessageHandler
33970 LDKSecretKey our_node_secret_ref;
33971 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
33972 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
33973 unsigned char ephemeral_random_data_arr[32];
33974 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
33975 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
33976 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
33977 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
33978 CHECK_ACCESS(logger_ptr);
33979 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
33980 if (logger_conv.free == LDKLogger_JCalls_free) {
33981 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33982 LDKLogger_JCalls_cloned(&logger_conv);
33984 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
33985 CHECK_ACCESS(custom_message_handler_ptr);
33986 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
33987 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
33988 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33989 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
33991 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
33992 uintptr_t ret_ref = 0;
33993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33996 ret_ref = (uintptr_t)ret_var.inner;
33997 if (ret_var.is_owned) {
34003 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
34004 LDKPeerManager this_arg_conv;
34005 this_arg_conv.inner = (void*)(this_arg & (~1));
34006 this_arg_conv.is_owned = false;
34007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34008 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
34009 jobjectArray ret_arr = NULL;
34010 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
34012 for (size_t i = 0; i < ret_var.datalen; i++) {
34013 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
34014 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
34015 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
34018 FREE(ret_var.data);
34022 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) {
34023 LDKPeerManager this_arg_conv;
34024 this_arg_conv.inner = (void*)(this_arg & (~1));
34025 this_arg_conv.is_owned = false;
34026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34027 LDKPublicKey their_node_id_ref;
34028 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
34029 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
34030 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34031 CHECK_ACCESS(descriptor_ptr);
34032 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34033 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34034 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34035 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34037 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
34038 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
34039 return (uintptr_t)ret_conv;
34042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
34043 LDKPeerManager this_arg_conv;
34044 this_arg_conv.inner = (void*)(this_arg & (~1));
34045 this_arg_conv.is_owned = false;
34046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34047 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34048 CHECK_ACCESS(descriptor_ptr);
34049 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34050 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34051 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34052 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34054 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34055 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
34056 return (uintptr_t)ret_conv;
34059 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) {
34060 LDKPeerManager this_arg_conv;
34061 this_arg_conv.inner = (void*)(this_arg & (~1));
34062 this_arg_conv.is_owned = false;
34063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34064 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34065 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
34066 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
34067 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34068 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
34069 return (uintptr_t)ret_conv;
34072 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) {
34073 LDKPeerManager this_arg_conv;
34074 this_arg_conv.inner = (void*)(this_arg & (~1));
34075 this_arg_conv.is_owned = false;
34076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34077 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
34078 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
34079 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
34080 LDKu8slice data_ref;
34081 data_ref.datalen = (*env)->GetArrayLength(env, data);
34082 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
34083 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
34084 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
34085 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
34086 return (uintptr_t)ret_conv;
34089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
34090 LDKPeerManager this_arg_conv;
34091 this_arg_conv.inner = (void*)(this_arg & (~1));
34092 this_arg_conv.is_owned = false;
34093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34094 PeerManager_process_events(&this_arg_conv);
34097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
34098 LDKPeerManager this_arg_conv;
34099 this_arg_conv.inner = (void*)(this_arg & (~1));
34100 this_arg_conv.is_owned = false;
34101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34102 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
34103 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
34104 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
34105 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
34108 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) {
34109 LDKPeerManager this_arg_conv;
34110 this_arg_conv.inner = (void*)(this_arg & (~1));
34111 this_arg_conv.is_owned = false;
34112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34113 LDKPublicKey node_id_ref;
34114 CHECK((*env)->GetArrayLength(env, node_id) == 33);
34115 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
34116 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
34119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
34120 LDKPeerManager this_arg_conv;
34121 this_arg_conv.inner = (void*)(this_arg & (~1));
34122 this_arg_conv.is_owned = false;
34123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34124 PeerManager_disconnect_all_peers(&this_arg_conv);
34127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
34128 LDKPeerManager this_arg_conv;
34129 this_arg_conv.inner = (void*)(this_arg & (~1));
34130 this_arg_conv.is_owned = false;
34131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34132 PeerManager_timer_tick_occurred(&this_arg_conv);
34135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
34136 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
34140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
34141 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
34145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
34146 unsigned char commitment_seed_arr[32];
34147 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
34148 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
34149 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
34150 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34151 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
34155 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) {
34156 LDKCVec_u8Z to_holder_script_ref;
34157 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
34158 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
34159 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
34160 LDKCVec_u8Z to_counterparty_script_ref;
34161 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
34162 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
34163 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
34164 LDKOutPoint funding_outpoint_conv;
34165 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
34166 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
34167 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
34168 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
34169 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);
34170 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34171 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34172 Transaction_free(ret_var);
34176 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) {
34177 LDKPublicKey per_commitment_point_ref;
34178 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
34179 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
34180 unsigned char base_secret_arr[32];
34181 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
34182 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
34183 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
34184 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
34185 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
34186 return (uintptr_t)ret_conv;
34189 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) {
34190 LDKPublicKey per_commitment_point_ref;
34191 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
34192 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
34193 LDKPublicKey base_point_ref;
34194 CHECK((*env)->GetArrayLength(env, base_point) == 33);
34195 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
34196 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
34197 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
34198 return (uintptr_t)ret_conv;
34201 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) {
34202 unsigned char per_commitment_secret_arr[32];
34203 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
34204 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
34205 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
34206 unsigned char countersignatory_revocation_base_secret_arr[32];
34207 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
34208 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
34209 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
34210 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
34211 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
34212 return (uintptr_t)ret_conv;
34215 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) {
34216 LDKPublicKey per_commitment_point_ref;
34217 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
34218 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
34219 LDKPublicKey countersignatory_revocation_base_point_ref;
34220 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
34221 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
34222 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
34223 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
34224 return (uintptr_t)ret_conv;
34227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34228 LDKTxCreationKeys this_obj_conv;
34229 this_obj_conv.inner = (void*)(this_obj & (~1));
34230 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34232 TxCreationKeys_free(this_obj_conv);
34235 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34236 LDKTxCreationKeys this_ptr_conv;
34237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34238 this_ptr_conv.is_owned = false;
34239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34240 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34241 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
34245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34246 LDKTxCreationKeys this_ptr_conv;
34247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34248 this_ptr_conv.is_owned = false;
34249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34250 LDKPublicKey val_ref;
34251 CHECK((*env)->GetArrayLength(env, val) == 33);
34252 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34253 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
34256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
34257 LDKTxCreationKeys this_ptr_conv;
34258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34259 this_ptr_conv.is_owned = false;
34260 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34261 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34262 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
34266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34267 LDKTxCreationKeys this_ptr_conv;
34268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34269 this_ptr_conv.is_owned = false;
34270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34271 LDKPublicKey val_ref;
34272 CHECK((*env)->GetArrayLength(env, val) == 33);
34273 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34274 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
34277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
34278 LDKTxCreationKeys this_ptr_conv;
34279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34280 this_ptr_conv.is_owned = false;
34281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34282 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34283 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
34287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34288 LDKTxCreationKeys this_ptr_conv;
34289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34290 this_ptr_conv.is_owned = false;
34291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34292 LDKPublicKey val_ref;
34293 CHECK((*env)->GetArrayLength(env, val) == 33);
34294 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34295 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
34298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
34299 LDKTxCreationKeys this_ptr_conv;
34300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34301 this_ptr_conv.is_owned = false;
34302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34303 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
34308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34309 LDKTxCreationKeys this_ptr_conv;
34310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34311 this_ptr_conv.is_owned = false;
34312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34313 LDKPublicKey val_ref;
34314 CHECK((*env)->GetArrayLength(env, val) == 33);
34315 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34316 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
34319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
34320 LDKTxCreationKeys this_ptr_conv;
34321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34322 this_ptr_conv.is_owned = false;
34323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34324 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
34329 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) {
34330 LDKTxCreationKeys this_ptr_conv;
34331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34332 this_ptr_conv.is_owned = false;
34333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34334 LDKPublicKey val_ref;
34335 CHECK((*env)->GetArrayLength(env, val) == 33);
34336 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34337 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
34340 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) {
34341 LDKPublicKey per_commitment_point_arg_ref;
34342 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
34343 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
34344 LDKPublicKey revocation_key_arg_ref;
34345 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
34346 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
34347 LDKPublicKey broadcaster_htlc_key_arg_ref;
34348 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
34349 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
34350 LDKPublicKey countersignatory_htlc_key_arg_ref;
34351 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
34352 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
34353 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
34354 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
34355 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
34356 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);
34357 uintptr_t ret_ref = 0;
34358 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34359 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34360 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34361 ret_ref = (uintptr_t)ret_var.inner;
34362 if (ret_var.is_owned) {
34368 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
34369 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
34370 uintptr_t ret_ref = 0;
34371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34374 ret_ref = (uintptr_t)ret_var.inner;
34375 if (ret_var.is_owned) {
34380 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34381 LDKTxCreationKeys arg_conv;
34382 arg_conv.inner = (void*)(arg & (~1));
34383 arg_conv.is_owned = false;
34384 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34385 intptr_t ret_val = TxCreationKeys_clone_ptr(&arg_conv);
34389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34390 LDKTxCreationKeys orig_conv;
34391 orig_conv.inner = (void*)(orig & (~1));
34392 orig_conv.is_owned = false;
34393 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34394 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
34395 uintptr_t ret_ref = 0;
34396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34399 ret_ref = (uintptr_t)ret_var.inner;
34400 if (ret_var.is_owned) {
34406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
34407 LDKTxCreationKeys obj_conv;
34408 obj_conv.inner = (void*)(obj & (~1));
34409 obj_conv.is_owned = false;
34410 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34411 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
34412 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34413 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34414 CVec_u8Z_free(ret_var);
34418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34419 LDKu8slice ser_ref;
34420 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34421 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34422 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
34423 *ret_conv = TxCreationKeys_read(ser_ref);
34424 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34425 return (uintptr_t)ret_conv;
34428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34429 LDKChannelPublicKeys this_obj_conv;
34430 this_obj_conv.inner = (void*)(this_obj & (~1));
34431 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34433 ChannelPublicKeys_free(this_obj_conv);
34436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
34437 LDKChannelPublicKeys this_ptr_conv;
34438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34439 this_ptr_conv.is_owned = false;
34440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34441 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34442 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
34446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34447 LDKChannelPublicKeys this_ptr_conv;
34448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34449 this_ptr_conv.is_owned = false;
34450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34451 LDKPublicKey val_ref;
34452 CHECK((*env)->GetArrayLength(env, val) == 33);
34453 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34454 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
34457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
34458 LDKChannelPublicKeys this_ptr_conv;
34459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34460 this_ptr_conv.is_owned = false;
34461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34462 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34463 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
34467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34468 LDKChannelPublicKeys this_ptr_conv;
34469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34470 this_ptr_conv.is_owned = false;
34471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34472 LDKPublicKey val_ref;
34473 CHECK((*env)->GetArrayLength(env, val) == 33);
34474 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34475 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
34478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
34479 LDKChannelPublicKeys this_ptr_conv;
34480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34481 this_ptr_conv.is_owned = false;
34482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34483 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34484 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
34488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34489 LDKChannelPublicKeys this_ptr_conv;
34490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34491 this_ptr_conv.is_owned = false;
34492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34493 LDKPublicKey val_ref;
34494 CHECK((*env)->GetArrayLength(env, val) == 33);
34495 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34496 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
34499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
34500 LDKChannelPublicKeys this_ptr_conv;
34501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34502 this_ptr_conv.is_owned = false;
34503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34504 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34505 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
34509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34510 LDKChannelPublicKeys this_ptr_conv;
34511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34512 this_ptr_conv.is_owned = false;
34513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34514 LDKPublicKey val_ref;
34515 CHECK((*env)->GetArrayLength(env, val) == 33);
34516 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34517 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
34520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
34521 LDKChannelPublicKeys this_ptr_conv;
34522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34523 this_ptr_conv.is_owned = false;
34524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34525 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
34526 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
34530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34531 LDKChannelPublicKeys this_ptr_conv;
34532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34533 this_ptr_conv.is_owned = false;
34534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34535 LDKPublicKey val_ref;
34536 CHECK((*env)->GetArrayLength(env, val) == 33);
34537 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
34538 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
34541 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) {
34542 LDKPublicKey funding_pubkey_arg_ref;
34543 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
34544 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
34545 LDKPublicKey revocation_basepoint_arg_ref;
34546 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
34547 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
34548 LDKPublicKey payment_point_arg_ref;
34549 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
34550 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
34551 LDKPublicKey delayed_payment_basepoint_arg_ref;
34552 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
34553 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
34554 LDKPublicKey htlc_basepoint_arg_ref;
34555 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
34556 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
34557 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);
34558 uintptr_t ret_ref = 0;
34559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34562 ret_ref = (uintptr_t)ret_var.inner;
34563 if (ret_var.is_owned) {
34569 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
34570 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
34571 uintptr_t ret_ref = 0;
34572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34575 ret_ref = (uintptr_t)ret_var.inner;
34576 if (ret_var.is_owned) {
34581 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34582 LDKChannelPublicKeys arg_conv;
34583 arg_conv.inner = (void*)(arg & (~1));
34584 arg_conv.is_owned = false;
34585 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34586 intptr_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
34590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34591 LDKChannelPublicKeys orig_conv;
34592 orig_conv.inner = (void*)(orig & (~1));
34593 orig_conv.is_owned = false;
34594 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34595 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
34596 uintptr_t ret_ref = 0;
34597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34600 ret_ref = (uintptr_t)ret_var.inner;
34601 if (ret_var.is_owned) {
34607 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
34608 LDKChannelPublicKeys obj_conv;
34609 obj_conv.inner = (void*)(obj & (~1));
34610 obj_conv.is_owned = false;
34611 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34612 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
34613 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34614 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34615 CVec_u8Z_free(ret_var);
34619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34620 LDKu8slice ser_ref;
34621 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34622 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34623 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
34624 *ret_conv = ChannelPublicKeys_read(ser_ref);
34625 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34626 return (uintptr_t)ret_conv;
34629 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) {
34630 LDKPublicKey per_commitment_point_ref;
34631 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
34632 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
34633 LDKPublicKey broadcaster_delayed_payment_base_ref;
34634 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
34635 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
34636 LDKPublicKey broadcaster_htlc_base_ref;
34637 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
34638 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
34639 LDKPublicKey countersignatory_revocation_base_ref;
34640 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
34641 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
34642 LDKPublicKey countersignatory_htlc_base_ref;
34643 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
34644 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
34645 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34646 *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);
34647 return (uintptr_t)ret_conv;
34650 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) {
34651 LDKPublicKey per_commitment_point_ref;
34652 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
34653 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
34654 LDKChannelPublicKeys broadcaster_keys_conv;
34655 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
34656 broadcaster_keys_conv.is_owned = false;
34657 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
34658 LDKChannelPublicKeys countersignatory_keys_conv;
34659 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
34660 countersignatory_keys_conv.is_owned = false;
34661 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
34662 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
34663 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
34664 return (uintptr_t)ret_conv;
34667 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) {
34668 LDKPublicKey revocation_key_ref;
34669 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
34670 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
34671 LDKPublicKey broadcaster_delayed_payment_key_ref;
34672 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
34673 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
34674 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
34675 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34676 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34677 CVec_u8Z_free(ret_var);
34681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34682 LDKHTLCOutputInCommitment this_obj_conv;
34683 this_obj_conv.inner = (void*)(this_obj & (~1));
34684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34686 HTLCOutputInCommitment_free(this_obj_conv);
34689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
34690 LDKHTLCOutputInCommitment this_ptr_conv;
34691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34692 this_ptr_conv.is_owned = false;
34693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34694 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
34698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34699 LDKHTLCOutputInCommitment this_ptr_conv;
34700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34701 this_ptr_conv.is_owned = false;
34702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34703 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
34706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
34707 LDKHTLCOutputInCommitment this_ptr_conv;
34708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34709 this_ptr_conv.is_owned = false;
34710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34711 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
34715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34716 LDKHTLCOutputInCommitment this_ptr_conv;
34717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34718 this_ptr_conv.is_owned = false;
34719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34720 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
34723 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
34724 LDKHTLCOutputInCommitment this_ptr_conv;
34725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34726 this_ptr_conv.is_owned = false;
34727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34728 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
34732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34733 LDKHTLCOutputInCommitment this_ptr_conv;
34734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34735 this_ptr_conv.is_owned = false;
34736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34737 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
34740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34741 LDKHTLCOutputInCommitment this_ptr_conv;
34742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34743 this_ptr_conv.is_owned = false;
34744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34745 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34746 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
34750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34751 LDKHTLCOutputInCommitment this_ptr_conv;
34752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34753 this_ptr_conv.is_owned = false;
34754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34755 LDKThirtyTwoBytes val_ref;
34756 CHECK((*env)->GetArrayLength(env, val) == 32);
34757 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34758 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
34761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
34762 LDKHTLCOutputInCommitment this_ptr_conv;
34763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34764 this_ptr_conv.is_owned = false;
34765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34766 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
34767 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
34768 uintptr_t ret_ref = (uintptr_t)ret_copy;
34772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34773 LDKHTLCOutputInCommitment this_ptr_conv;
34774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34775 this_ptr_conv.is_owned = false;
34776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34777 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34778 CHECK_ACCESS(val_ptr);
34779 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
34780 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
34781 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
34784 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) {
34785 LDKThirtyTwoBytes payment_hash_arg_ref;
34786 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
34787 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
34788 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
34789 CHECK_ACCESS(transaction_output_index_arg_ptr);
34790 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
34791 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
34792 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
34793 uintptr_t ret_ref = 0;
34794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34795 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34797 ret_ref = (uintptr_t)ret_var.inner;
34798 if (ret_var.is_owned) {
34804 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
34805 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
34806 uintptr_t ret_ref = 0;
34807 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34808 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34809 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34810 ret_ref = (uintptr_t)ret_var.inner;
34811 if (ret_var.is_owned) {
34816 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34817 LDKHTLCOutputInCommitment arg_conv;
34818 arg_conv.inner = (void*)(arg & (~1));
34819 arg_conv.is_owned = false;
34820 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34821 intptr_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
34825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34826 LDKHTLCOutputInCommitment orig_conv;
34827 orig_conv.inner = (void*)(orig & (~1));
34828 orig_conv.is_owned = false;
34829 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34830 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
34831 uintptr_t ret_ref = 0;
34832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34835 ret_ref = (uintptr_t)ret_var.inner;
34836 if (ret_var.is_owned) {
34842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
34843 LDKHTLCOutputInCommitment obj_conv;
34844 obj_conv.inner = (void*)(obj & (~1));
34845 obj_conv.is_owned = false;
34846 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34847 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
34848 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34849 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34850 CVec_u8Z_free(ret_var);
34854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34855 LDKu8slice ser_ref;
34856 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34857 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34858 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
34859 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
34860 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34861 return (uintptr_t)ret_conv;
34864 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, jboolean opt_anchors, int64_t keys) {
34865 LDKHTLCOutputInCommitment htlc_conv;
34866 htlc_conv.inner = (void*)(htlc & (~1));
34867 htlc_conv.is_owned = false;
34868 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34869 LDKTxCreationKeys keys_conv;
34870 keys_conv.inner = (void*)(keys & (~1));
34871 keys_conv.is_owned = false;
34872 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34873 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
34874 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34875 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34876 CVec_u8Z_free(ret_var);
34880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
34881 LDKPublicKey broadcaster_ref;
34882 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
34883 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
34884 LDKPublicKey countersignatory_ref;
34885 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
34886 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
34887 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
34888 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34889 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34890 CVec_u8Z_free(ret_var);
34894 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, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
34895 unsigned char commitment_txid_arr[32];
34896 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
34897 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
34898 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
34899 LDKHTLCOutputInCommitment htlc_conv;
34900 htlc_conv.inner = (void*)(htlc & (~1));
34901 htlc_conv.is_owned = false;
34902 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
34903 LDKPublicKey broadcaster_delayed_payment_key_ref;
34904 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
34905 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
34906 LDKPublicKey revocation_key_ref;
34907 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
34908 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
34909 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
34910 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34911 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34912 Transaction_free(ret_var);
34916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
34917 LDKPublicKey funding_pubkey_ref;
34918 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
34919 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
34920 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
34921 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34922 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34923 CVec_u8Z_free(ret_var);
34927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34928 LDKChannelTransactionParameters this_obj_conv;
34929 this_obj_conv.inner = (void*)(this_obj & (~1));
34930 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34932 ChannelTransactionParameters_free(this_obj_conv);
34935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
34936 LDKChannelTransactionParameters this_ptr_conv;
34937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34938 this_ptr_conv.is_owned = false;
34939 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34940 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
34941 uintptr_t ret_ref = 0;
34942 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34943 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34944 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34945 ret_ref = (uintptr_t)ret_var.inner;
34946 if (ret_var.is_owned) {
34952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34953 LDKChannelTransactionParameters this_ptr_conv;
34954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34955 this_ptr_conv.is_owned = false;
34956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34957 LDKChannelPublicKeys val_conv;
34958 val_conv.inner = (void*)(val & (~1));
34959 val_conv.is_owned = (val & 1) || (val == 0);
34960 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34961 val_conv = ChannelPublicKeys_clone(&val_conv);
34962 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
34965 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
34966 LDKChannelTransactionParameters this_ptr_conv;
34967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34968 this_ptr_conv.is_owned = false;
34969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34970 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
34974 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) {
34975 LDKChannelTransactionParameters this_ptr_conv;
34976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34977 this_ptr_conv.is_owned = false;
34978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34979 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
34982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
34983 LDKChannelTransactionParameters this_ptr_conv;
34984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34985 this_ptr_conv.is_owned = false;
34986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34987 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
34991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34992 LDKChannelTransactionParameters this_ptr_conv;
34993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34994 this_ptr_conv.is_owned = false;
34995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34996 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
34999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
35000 LDKChannelTransactionParameters this_ptr_conv;
35001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35002 this_ptr_conv.is_owned = false;
35003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35004 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
35005 uintptr_t ret_ref = 0;
35006 if ((uintptr_t)ret_var.inner > 4096) {
35007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35010 ret_ref = (uintptr_t)ret_var.inner;
35011 if (ret_var.is_owned) {
35018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35019 LDKChannelTransactionParameters this_ptr_conv;
35020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35021 this_ptr_conv.is_owned = false;
35022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35023 LDKCounterpartyChannelTransactionParameters val_conv;
35024 val_conv.inner = (void*)(val & (~1));
35025 val_conv.is_owned = (val & 1) || (val == 0);
35026 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35027 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
35028 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
35031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
35032 LDKChannelTransactionParameters this_ptr_conv;
35033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35034 this_ptr_conv.is_owned = false;
35035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35036 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
35037 uintptr_t ret_ref = 0;
35038 if ((uintptr_t)ret_var.inner > 4096) {
35039 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35040 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35041 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35042 ret_ref = (uintptr_t)ret_var.inner;
35043 if (ret_var.is_owned) {
35050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35051 LDKChannelTransactionParameters this_ptr_conv;
35052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35053 this_ptr_conv.is_owned = false;
35054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35055 LDKOutPoint val_conv;
35056 val_conv.inner = (void*)(val & (~1));
35057 val_conv.is_owned = (val & 1) || (val == 0);
35058 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35059 val_conv = OutPoint_clone(&val_conv);
35060 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
35063 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
35064 LDKChannelTransactionParameters this_ptr_conv;
35065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35066 this_ptr_conv.is_owned = false;
35067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35068 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
35072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
35073 LDKChannelTransactionParameters this_ptr_conv;
35074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35075 this_ptr_conv.is_owned = false;
35076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35077 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
35078 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
35081 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, jclass opt_anchors_arg) {
35082 LDKChannelPublicKeys holder_pubkeys_arg_conv;
35083 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
35084 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
35085 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
35086 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
35087 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
35088 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
35089 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
35090 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
35091 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
35092 LDKOutPoint funding_outpoint_arg_conv;
35093 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
35094 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
35095 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
35096 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
35097 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
35098 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, opt_anchors_arg_conv);
35099 uintptr_t ret_ref = 0;
35100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35103 ret_ref = (uintptr_t)ret_var.inner;
35104 if (ret_var.is_owned) {
35110 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
35111 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
35112 uintptr_t ret_ref = 0;
35113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35116 ret_ref = (uintptr_t)ret_var.inner;
35117 if (ret_var.is_owned) {
35122 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35123 LDKChannelTransactionParameters arg_conv;
35124 arg_conv.inner = (void*)(arg & (~1));
35125 arg_conv.is_owned = false;
35126 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35127 intptr_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
35131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35132 LDKChannelTransactionParameters orig_conv;
35133 orig_conv.inner = (void*)(orig & (~1));
35134 orig_conv.is_owned = false;
35135 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35136 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
35137 uintptr_t ret_ref = 0;
35138 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35139 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35140 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35141 ret_ref = (uintptr_t)ret_var.inner;
35142 if (ret_var.is_owned) {
35148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35149 LDKCounterpartyChannelTransactionParameters this_obj_conv;
35150 this_obj_conv.inner = (void*)(this_obj & (~1));
35151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35153 CounterpartyChannelTransactionParameters_free(this_obj_conv);
35156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
35157 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35159 this_ptr_conv.is_owned = false;
35160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35161 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
35162 uintptr_t ret_ref = 0;
35163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35166 ret_ref = (uintptr_t)ret_var.inner;
35167 if (ret_var.is_owned) {
35173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35174 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35176 this_ptr_conv.is_owned = false;
35177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35178 LDKChannelPublicKeys val_conv;
35179 val_conv.inner = (void*)(val & (~1));
35180 val_conv.is_owned = (val & 1) || (val == 0);
35181 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35182 val_conv = ChannelPublicKeys_clone(&val_conv);
35183 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
35186 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
35187 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35189 this_ptr_conv.is_owned = false;
35190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35191 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
35195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
35196 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
35197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35198 this_ptr_conv.is_owned = false;
35199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35200 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
35203 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) {
35204 LDKChannelPublicKeys pubkeys_arg_conv;
35205 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
35206 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
35207 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
35208 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
35209 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
35210 uintptr_t ret_ref = 0;
35211 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35212 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35213 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35214 ret_ref = (uintptr_t)ret_var.inner;
35215 if (ret_var.is_owned) {
35221 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
35222 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
35223 uintptr_t ret_ref = 0;
35224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35227 ret_ref = (uintptr_t)ret_var.inner;
35228 if (ret_var.is_owned) {
35233 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35234 LDKCounterpartyChannelTransactionParameters arg_conv;
35235 arg_conv.inner = (void*)(arg & (~1));
35236 arg_conv.is_owned = false;
35237 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35238 intptr_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
35242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35243 LDKCounterpartyChannelTransactionParameters orig_conv;
35244 orig_conv.inner = (void*)(orig & (~1));
35245 orig_conv.is_owned = false;
35246 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35247 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
35248 uintptr_t ret_ref = 0;
35249 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35250 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35252 ret_ref = (uintptr_t)ret_var.inner;
35253 if (ret_var.is_owned) {
35259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
35260 LDKChannelTransactionParameters this_arg_conv;
35261 this_arg_conv.inner = (void*)(this_arg & (~1));
35262 this_arg_conv.is_owned = false;
35263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35264 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
35268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
35269 LDKChannelTransactionParameters this_arg_conv;
35270 this_arg_conv.inner = (void*)(this_arg & (~1));
35271 this_arg_conv.is_owned = false;
35272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35273 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
35274 uintptr_t ret_ref = 0;
35275 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35276 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35277 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35278 ret_ref = (uintptr_t)ret_var.inner;
35279 if (ret_var.is_owned) {
35285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
35286 LDKChannelTransactionParameters this_arg_conv;
35287 this_arg_conv.inner = (void*)(this_arg & (~1));
35288 this_arg_conv.is_owned = false;
35289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35290 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
35291 uintptr_t ret_ref = 0;
35292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35295 ret_ref = (uintptr_t)ret_var.inner;
35296 if (ret_var.is_owned) {
35302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
35303 LDKCounterpartyChannelTransactionParameters obj_conv;
35304 obj_conv.inner = (void*)(obj & (~1));
35305 obj_conv.is_owned = false;
35306 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35307 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
35308 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35309 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35310 CVec_u8Z_free(ret_var);
35314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35315 LDKu8slice ser_ref;
35316 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35317 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35318 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
35319 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
35320 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35321 return (uintptr_t)ret_conv;
35324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
35325 LDKChannelTransactionParameters obj_conv;
35326 obj_conv.inner = (void*)(obj & (~1));
35327 obj_conv.is_owned = false;
35328 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35329 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
35330 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35331 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35332 CVec_u8Z_free(ret_var);
35336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35337 LDKu8slice ser_ref;
35338 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35339 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35340 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
35341 *ret_conv = ChannelTransactionParameters_read(ser_ref);
35342 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35343 return (uintptr_t)ret_conv;
35346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35347 LDKDirectedChannelTransactionParameters this_obj_conv;
35348 this_obj_conv.inner = (void*)(this_obj & (~1));
35349 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35351 DirectedChannelTransactionParameters_free(this_obj_conv);
35354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
35355 LDKDirectedChannelTransactionParameters this_arg_conv;
35356 this_arg_conv.inner = (void*)(this_arg & (~1));
35357 this_arg_conv.is_owned = false;
35358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35359 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
35360 uintptr_t ret_ref = 0;
35361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35364 ret_ref = (uintptr_t)ret_var.inner;
35365 if (ret_var.is_owned) {
35371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
35372 LDKDirectedChannelTransactionParameters this_arg_conv;
35373 this_arg_conv.inner = (void*)(this_arg & (~1));
35374 this_arg_conv.is_owned = false;
35375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35376 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
35377 uintptr_t ret_ref = 0;
35378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35381 ret_ref = (uintptr_t)ret_var.inner;
35382 if (ret_var.is_owned) {
35388 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
35389 LDKDirectedChannelTransactionParameters this_arg_conv;
35390 this_arg_conv.inner = (void*)(this_arg & (~1));
35391 this_arg_conv.is_owned = false;
35392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35393 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
35397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
35398 LDKDirectedChannelTransactionParameters this_arg_conv;
35399 this_arg_conv.inner = (void*)(this_arg & (~1));
35400 this_arg_conv.is_owned = false;
35401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35402 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
35406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
35407 LDKDirectedChannelTransactionParameters this_arg_conv;
35408 this_arg_conv.inner = (void*)(this_arg & (~1));
35409 this_arg_conv.is_owned = false;
35410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35411 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
35412 uintptr_t ret_ref = 0;
35413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35416 ret_ref = (uintptr_t)ret_var.inner;
35417 if (ret_var.is_owned) {
35423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
35424 LDKDirectedChannelTransactionParameters this_arg_conv;
35425 this_arg_conv.inner = (void*)(this_arg & (~1));
35426 this_arg_conv.is_owned = false;
35427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35428 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
35432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35433 LDKHolderCommitmentTransaction this_obj_conv;
35434 this_obj_conv.inner = (void*)(this_obj & (~1));
35435 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35437 HolderCommitmentTransaction_free(this_obj_conv);
35440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
35441 LDKHolderCommitmentTransaction this_ptr_conv;
35442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35443 this_ptr_conv.is_owned = false;
35444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35445 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35446 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
35450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35451 LDKHolderCommitmentTransaction this_ptr_conv;
35452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35453 this_ptr_conv.is_owned = false;
35454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35455 LDKSignature val_ref;
35456 CHECK((*env)->GetArrayLength(env, val) == 64);
35457 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
35458 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
35461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
35462 LDKHolderCommitmentTransaction this_ptr_conv;
35463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35464 this_ptr_conv.is_owned = false;
35465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35466 LDKCVec_SignatureZ val_constr;
35467 val_constr.datalen = (*env)->GetArrayLength(env, val);
35468 if (val_constr.datalen > 0)
35469 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35471 val_constr.data = NULL;
35472 for (size_t i = 0; i < val_constr.datalen; i++) {
35473 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
35474 LDKSignature val_conv_8_ref;
35475 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
35476 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
35477 val_constr.data[i] = val_conv_8_ref;
35479 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
35482 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
35483 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
35484 uintptr_t ret_ref = 0;
35485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35488 ret_ref = (uintptr_t)ret_var.inner;
35489 if (ret_var.is_owned) {
35494 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35495 LDKHolderCommitmentTransaction arg_conv;
35496 arg_conv.inner = (void*)(arg & (~1));
35497 arg_conv.is_owned = false;
35498 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35499 intptr_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
35503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35504 LDKHolderCommitmentTransaction orig_conv;
35505 orig_conv.inner = (void*)(orig & (~1));
35506 orig_conv.is_owned = false;
35507 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35508 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
35509 uintptr_t ret_ref = 0;
35510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35513 ret_ref = (uintptr_t)ret_var.inner;
35514 if (ret_var.is_owned) {
35520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
35521 LDKHolderCommitmentTransaction obj_conv;
35522 obj_conv.inner = (void*)(obj & (~1));
35523 obj_conv.is_owned = false;
35524 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35525 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
35526 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35527 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35528 CVec_u8Z_free(ret_var);
35532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35533 LDKu8slice ser_ref;
35534 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35535 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35536 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
35537 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
35538 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35539 return (uintptr_t)ret_conv;
35542 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) {
35543 LDKCommitmentTransaction commitment_tx_conv;
35544 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
35545 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
35546 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
35547 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
35548 LDKSignature counterparty_sig_ref;
35549 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
35550 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
35551 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
35552 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
35553 if (counterparty_htlc_sigs_constr.datalen > 0)
35554 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
35556 counterparty_htlc_sigs_constr.data = NULL;
35557 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
35558 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
35559 LDKSignature counterparty_htlc_sigs_conv_8_ref;
35560 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
35561 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
35562 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
35564 LDKPublicKey holder_funding_key_ref;
35565 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
35566 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
35567 LDKPublicKey counterparty_funding_key_ref;
35568 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
35569 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
35570 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
35571 uintptr_t ret_ref = 0;
35572 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35573 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35574 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35575 ret_ref = (uintptr_t)ret_var.inner;
35576 if (ret_var.is_owned) {
35582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35583 LDKBuiltCommitmentTransaction this_obj_conv;
35584 this_obj_conv.inner = (void*)(this_obj & (~1));
35585 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35587 BuiltCommitmentTransaction_free(this_obj_conv);
35590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
35591 LDKBuiltCommitmentTransaction this_ptr_conv;
35592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35593 this_ptr_conv.is_owned = false;
35594 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35595 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
35596 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35597 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35598 Transaction_free(ret_var);
35602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35603 LDKBuiltCommitmentTransaction this_ptr_conv;
35604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35605 this_ptr_conv.is_owned = false;
35606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35607 LDKTransaction val_ref;
35608 val_ref.datalen = (*env)->GetArrayLength(env, val);
35609 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
35610 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
35611 val_ref.data_is_owned = true;
35612 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
35615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
35616 LDKBuiltCommitmentTransaction this_ptr_conv;
35617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35618 this_ptr_conv.is_owned = false;
35619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35620 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35621 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
35625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
35626 LDKBuiltCommitmentTransaction this_ptr_conv;
35627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35628 this_ptr_conv.is_owned = false;
35629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35630 LDKThirtyTwoBytes val_ref;
35631 CHECK((*env)->GetArrayLength(env, val) == 32);
35632 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
35633 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
35636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
35637 LDKTransaction transaction_arg_ref;
35638 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
35639 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
35640 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
35641 transaction_arg_ref.data_is_owned = true;
35642 LDKThirtyTwoBytes txid_arg_ref;
35643 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
35644 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
35645 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
35646 uintptr_t ret_ref = 0;
35647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35650 ret_ref = (uintptr_t)ret_var.inner;
35651 if (ret_var.is_owned) {
35657 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
35658 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
35659 uintptr_t ret_ref = 0;
35660 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35661 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35663 ret_ref = (uintptr_t)ret_var.inner;
35664 if (ret_var.is_owned) {
35669 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35670 LDKBuiltCommitmentTransaction arg_conv;
35671 arg_conv.inner = (void*)(arg & (~1));
35672 arg_conv.is_owned = false;
35673 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35674 intptr_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
35678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35679 LDKBuiltCommitmentTransaction orig_conv;
35680 orig_conv.inner = (void*)(orig & (~1));
35681 orig_conv.is_owned = false;
35682 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35683 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
35684 uintptr_t ret_ref = 0;
35685 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35686 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35688 ret_ref = (uintptr_t)ret_var.inner;
35689 if (ret_var.is_owned) {
35695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
35696 LDKBuiltCommitmentTransaction obj_conv;
35697 obj_conv.inner = (void*)(obj & (~1));
35698 obj_conv.is_owned = false;
35699 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35700 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
35701 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35702 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35703 CVec_u8Z_free(ret_var);
35707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35708 LDKu8slice ser_ref;
35709 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35710 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35711 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
35712 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
35713 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35714 return (uintptr_t)ret_conv;
35717 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) {
35718 LDKBuiltCommitmentTransaction this_arg_conv;
35719 this_arg_conv.inner = (void*)(this_arg & (~1));
35720 this_arg_conv.is_owned = false;
35721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35722 LDKu8slice funding_redeemscript_ref;
35723 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
35724 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
35725 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35726 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
35727 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
35731 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) {
35732 LDKBuiltCommitmentTransaction this_arg_conv;
35733 this_arg_conv.inner = (void*)(this_arg & (~1));
35734 this_arg_conv.is_owned = false;
35735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35736 unsigned char funding_key_arr[32];
35737 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
35738 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
35739 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35740 LDKu8slice funding_redeemscript_ref;
35741 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
35742 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
35743 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35744 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
35745 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
35749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35750 LDKClosingTransaction this_obj_conv;
35751 this_obj_conv.inner = (void*)(this_obj & (~1));
35752 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35754 ClosingTransaction_free(this_obj_conv);
35757 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
35758 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
35759 uintptr_t ret_ref = 0;
35760 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35761 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35763 ret_ref = (uintptr_t)ret_var.inner;
35764 if (ret_var.is_owned) {
35769 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35770 LDKClosingTransaction arg_conv;
35771 arg_conv.inner = (void*)(arg & (~1));
35772 arg_conv.is_owned = false;
35773 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35774 intptr_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
35778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35779 LDKClosingTransaction orig_conv;
35780 orig_conv.inner = (void*)(orig & (~1));
35781 orig_conv.is_owned = false;
35782 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35783 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
35784 uintptr_t ret_ref = 0;
35785 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35786 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35787 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35788 ret_ref = (uintptr_t)ret_var.inner;
35789 if (ret_var.is_owned) {
35795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
35796 LDKClosingTransaction o_conv;
35797 o_conv.inner = (void*)(o & (~1));
35798 o_conv.is_owned = false;
35799 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35800 int64_t ret_val = ClosingTransaction_hash(&o_conv);
35804 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) {
35805 LDKCVec_u8Z to_holder_script_ref;
35806 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
35807 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35808 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
35809 LDKCVec_u8Z to_counterparty_script_ref;
35810 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
35811 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35812 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
35813 LDKOutPoint funding_outpoint_conv;
35814 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35815 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35816 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35817 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35818 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
35819 uintptr_t ret_ref = 0;
35820 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35821 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35822 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35823 ret_ref = (uintptr_t)ret_var.inner;
35824 if (ret_var.is_owned) {
35830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
35831 LDKClosingTransaction this_arg_conv;
35832 this_arg_conv.inner = (void*)(this_arg & (~1));
35833 this_arg_conv.is_owned = false;
35834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35835 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
35836 uintptr_t ret_ref = 0;
35837 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35838 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35839 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35840 ret_ref = (uintptr_t)ret_var.inner;
35841 if (ret_var.is_owned) {
35847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
35848 LDKClosingTransaction this_arg_conv;
35849 this_arg_conv.inner = (void*)(this_arg & (~1));
35850 this_arg_conv.is_owned = false;
35851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35852 LDKOutPoint funding_outpoint_conv;
35853 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
35854 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
35855 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35856 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35857 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
35858 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
35859 return (uintptr_t)ret_conv;
35862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
35863 LDKClosingTransaction this_arg_conv;
35864 this_arg_conv.inner = (void*)(this_arg & (~1));
35865 this_arg_conv.is_owned = false;
35866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35867 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
35871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
35872 LDKClosingTransaction this_arg_conv;
35873 this_arg_conv.inner = (void*)(this_arg & (~1));
35874 this_arg_conv.is_owned = false;
35875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35876 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
35880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
35881 LDKClosingTransaction this_arg_conv;
35882 this_arg_conv.inner = (void*)(this_arg & (~1));
35883 this_arg_conv.is_owned = false;
35884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35885 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
35886 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35887 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
35892 LDKClosingTransaction this_arg_conv;
35893 this_arg_conv.inner = (void*)(this_arg & (~1));
35894 this_arg_conv.is_owned = false;
35895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35896 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
35897 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35898 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35903 LDKTrustedClosingTransaction this_obj_conv;
35904 this_obj_conv.inner = (void*)(this_obj & (~1));
35905 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35907 TrustedClosingTransaction_free(this_obj_conv);
35910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
35911 LDKTrustedClosingTransaction this_arg_conv;
35912 this_arg_conv.inner = (void*)(this_arg & (~1));
35913 this_arg_conv.is_owned = false;
35914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35915 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
35916 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35917 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35918 Transaction_free(ret_var);
35922 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) {
35923 LDKTrustedClosingTransaction this_arg_conv;
35924 this_arg_conv.inner = (void*)(this_arg & (~1));
35925 this_arg_conv.is_owned = false;
35926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35927 LDKu8slice funding_redeemscript_ref;
35928 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
35929 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
35930 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
35931 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
35932 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
35936 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) {
35937 LDKTrustedClosingTransaction this_arg_conv;
35938 this_arg_conv.inner = (void*)(this_arg & (~1));
35939 this_arg_conv.is_owned = false;
35940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35941 unsigned char funding_key_arr[32];
35942 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
35943 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
35944 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
35945 LDKu8slice funding_redeemscript_ref;
35946 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
35947 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
35948 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
35949 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
35950 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
35954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35955 LDKCommitmentTransaction this_obj_conv;
35956 this_obj_conv.inner = (void*)(this_obj & (~1));
35957 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35959 CommitmentTransaction_free(this_obj_conv);
35962 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
35963 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
35964 uintptr_t ret_ref = 0;
35965 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35966 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35967 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35968 ret_ref = (uintptr_t)ret_var.inner;
35969 if (ret_var.is_owned) {
35974 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35975 LDKCommitmentTransaction arg_conv;
35976 arg_conv.inner = (void*)(arg & (~1));
35977 arg_conv.is_owned = false;
35978 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35979 intptr_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
35983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35984 LDKCommitmentTransaction orig_conv;
35985 orig_conv.inner = (void*)(orig & (~1));
35986 orig_conv.is_owned = false;
35987 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35988 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
35989 uintptr_t ret_ref = 0;
35990 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35991 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35993 ret_ref = (uintptr_t)ret_var.inner;
35994 if (ret_var.is_owned) {
36000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
36001 LDKCommitmentTransaction obj_conv;
36002 obj_conv.inner = (void*)(obj & (~1));
36003 obj_conv.is_owned = false;
36004 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36005 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
36006 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36007 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36008 CVec_u8Z_free(ret_var);
36012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36013 LDKu8slice ser_ref;
36014 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36015 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36016 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36017 *ret_conv = CommitmentTransaction_read(ser_ref);
36018 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36019 return (uintptr_t)ret_conv;
36022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
36023 LDKCommitmentTransaction this_arg_conv;
36024 this_arg_conv.inner = (void*)(this_arg & (~1));
36025 this_arg_conv.is_owned = false;
36026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36027 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
36031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
36032 LDKCommitmentTransaction this_arg_conv;
36033 this_arg_conv.inner = (void*)(this_arg & (~1));
36034 this_arg_conv.is_owned = false;
36035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36036 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
36040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
36041 LDKCommitmentTransaction this_arg_conv;
36042 this_arg_conv.inner = (void*)(this_arg & (~1));
36043 this_arg_conv.is_owned = false;
36044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36045 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
36049 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
36050 LDKCommitmentTransaction this_arg_conv;
36051 this_arg_conv.inner = (void*)(this_arg & (~1));
36052 this_arg_conv.is_owned = false;
36053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36054 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
36058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
36059 LDKCommitmentTransaction this_arg_conv;
36060 this_arg_conv.inner = (void*)(this_arg & (~1));
36061 this_arg_conv.is_owned = false;
36062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36063 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
36064 uintptr_t ret_ref = 0;
36065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36068 ret_ref = (uintptr_t)ret_var.inner;
36069 if (ret_var.is_owned) {
36075 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) {
36076 LDKCommitmentTransaction this_arg_conv;
36077 this_arg_conv.inner = (void*)(this_arg & (~1));
36078 this_arg_conv.is_owned = false;
36079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36080 LDKDirectedChannelTransactionParameters channel_parameters_conv;
36081 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
36082 channel_parameters_conv.is_owned = false;
36083 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
36084 LDKChannelPublicKeys broadcaster_keys_conv;
36085 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
36086 broadcaster_keys_conv.is_owned = false;
36087 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
36088 LDKChannelPublicKeys countersignatory_keys_conv;
36089 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
36090 countersignatory_keys_conv.is_owned = false;
36091 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
36092 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
36093 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
36094 return (uintptr_t)ret_conv;
36097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36098 LDKTrustedCommitmentTransaction this_obj_conv;
36099 this_obj_conv.inner = (void*)(this_obj & (~1));
36100 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36102 TrustedCommitmentTransaction_free(this_obj_conv);
36105 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
36106 LDKTrustedCommitmentTransaction this_arg_conv;
36107 this_arg_conv.inner = (void*)(this_arg & (~1));
36108 this_arg_conv.is_owned = false;
36109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36110 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36111 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
36115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
36116 LDKTrustedCommitmentTransaction this_arg_conv;
36117 this_arg_conv.inner = (void*)(this_arg & (~1));
36118 this_arg_conv.is_owned = false;
36119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36120 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
36121 uintptr_t ret_ref = 0;
36122 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36123 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36124 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36125 ret_ref = (uintptr_t)ret_var.inner;
36126 if (ret_var.is_owned) {
36132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
36133 LDKTrustedCommitmentTransaction this_arg_conv;
36134 this_arg_conv.inner = (void*)(this_arg & (~1));
36135 this_arg_conv.is_owned = false;
36136 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36137 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
36138 uintptr_t ret_ref = 0;
36139 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36140 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36142 ret_ref = (uintptr_t)ret_var.inner;
36143 if (ret_var.is_owned) {
36149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
36150 LDKTrustedCommitmentTransaction this_arg_conv;
36151 this_arg_conv.inner = (void*)(this_arg & (~1));
36152 this_arg_conv.is_owned = false;
36153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36154 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
36158 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) {
36159 LDKTrustedCommitmentTransaction this_arg_conv;
36160 this_arg_conv.inner = (void*)(this_arg & (~1));
36161 this_arg_conv.is_owned = false;
36162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36163 unsigned char htlc_base_key_arr[32];
36164 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
36165 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
36166 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
36167 LDKDirectedChannelTransactionParameters channel_parameters_conv;
36168 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
36169 channel_parameters_conv.is_owned = false;
36170 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
36171 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
36172 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
36173 return (uintptr_t)ret_conv;
36176 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) {
36177 LDKPublicKey broadcaster_payment_basepoint_ref;
36178 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
36179 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
36180 LDKPublicKey countersignatory_payment_basepoint_ref;
36181 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
36182 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
36183 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
36187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36188 LDKInitFeatures a_conv;
36189 a_conv.inner = (void*)(a & (~1));
36190 a_conv.is_owned = false;
36191 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36192 LDKInitFeatures b_conv;
36193 b_conv.inner = (void*)(b & (~1));
36194 b_conv.is_owned = false;
36195 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36196 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
36200 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36201 LDKNodeFeatures a_conv;
36202 a_conv.inner = (void*)(a & (~1));
36203 a_conv.is_owned = false;
36204 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36205 LDKNodeFeatures b_conv;
36206 b_conv.inner = (void*)(b & (~1));
36207 b_conv.is_owned = false;
36208 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36209 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
36213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36214 LDKChannelFeatures a_conv;
36215 a_conv.inner = (void*)(a & (~1));
36216 a_conv.is_owned = false;
36217 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36218 LDKChannelFeatures b_conv;
36219 b_conv.inner = (void*)(b & (~1));
36220 b_conv.is_owned = false;
36221 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36222 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
36226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36227 LDKInvoiceFeatures a_conv;
36228 a_conv.inner = (void*)(a & (~1));
36229 a_conv.is_owned = false;
36230 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36231 LDKInvoiceFeatures b_conv;
36232 b_conv.inner = (void*)(b & (~1));
36233 b_conv.is_owned = false;
36234 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36235 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
36239 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
36240 LDKChannelTypeFeatures a_conv;
36241 a_conv.inner = (void*)(a & (~1));
36242 a_conv.is_owned = false;
36243 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36244 LDKChannelTypeFeatures b_conv;
36245 b_conv.inner = (void*)(b & (~1));
36246 b_conv.is_owned = false;
36247 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36248 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
36252 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
36253 LDKInitFeatures ret_var = InitFeatures_clone(arg);
36254 uintptr_t ret_ref = 0;
36255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36258 ret_ref = (uintptr_t)ret_var.inner;
36259 if (ret_var.is_owned) {
36264 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36265 LDKInitFeatures arg_conv;
36266 arg_conv.inner = (void*)(arg & (~1));
36267 arg_conv.is_owned = false;
36268 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36269 intptr_t ret_val = InitFeatures_clone_ptr(&arg_conv);
36273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36274 LDKInitFeatures orig_conv;
36275 orig_conv.inner = (void*)(orig & (~1));
36276 orig_conv.is_owned = false;
36277 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36278 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
36279 uintptr_t ret_ref = 0;
36280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36283 ret_ref = (uintptr_t)ret_var.inner;
36284 if (ret_var.is_owned) {
36290 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
36291 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
36292 uintptr_t ret_ref = 0;
36293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36296 ret_ref = (uintptr_t)ret_var.inner;
36297 if (ret_var.is_owned) {
36302 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36303 LDKNodeFeatures arg_conv;
36304 arg_conv.inner = (void*)(arg & (~1));
36305 arg_conv.is_owned = false;
36306 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36307 intptr_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
36311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36312 LDKNodeFeatures orig_conv;
36313 orig_conv.inner = (void*)(orig & (~1));
36314 orig_conv.is_owned = false;
36315 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36316 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
36317 uintptr_t ret_ref = 0;
36318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36321 ret_ref = (uintptr_t)ret_var.inner;
36322 if (ret_var.is_owned) {
36328 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
36329 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
36330 uintptr_t ret_ref = 0;
36331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36334 ret_ref = (uintptr_t)ret_var.inner;
36335 if (ret_var.is_owned) {
36340 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36341 LDKChannelFeatures arg_conv;
36342 arg_conv.inner = (void*)(arg & (~1));
36343 arg_conv.is_owned = false;
36344 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36345 intptr_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
36349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36350 LDKChannelFeatures orig_conv;
36351 orig_conv.inner = (void*)(orig & (~1));
36352 orig_conv.is_owned = false;
36353 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36354 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
36355 uintptr_t ret_ref = 0;
36356 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36357 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36358 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36359 ret_ref = (uintptr_t)ret_var.inner;
36360 if (ret_var.is_owned) {
36366 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
36367 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
36368 uintptr_t ret_ref = 0;
36369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36372 ret_ref = (uintptr_t)ret_var.inner;
36373 if (ret_var.is_owned) {
36378 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36379 LDKInvoiceFeatures arg_conv;
36380 arg_conv.inner = (void*)(arg & (~1));
36381 arg_conv.is_owned = false;
36382 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36383 intptr_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
36387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36388 LDKInvoiceFeatures orig_conv;
36389 orig_conv.inner = (void*)(orig & (~1));
36390 orig_conv.is_owned = false;
36391 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36392 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
36393 uintptr_t ret_ref = 0;
36394 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36395 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36396 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36397 ret_ref = (uintptr_t)ret_var.inner;
36398 if (ret_var.is_owned) {
36404 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
36405 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
36406 uintptr_t ret_ref = 0;
36407 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36408 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36409 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36410 ret_ref = (uintptr_t)ret_var.inner;
36411 if (ret_var.is_owned) {
36416 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36417 LDKChannelTypeFeatures arg_conv;
36418 arg_conv.inner = (void*)(arg & (~1));
36419 arg_conv.is_owned = false;
36420 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36421 intptr_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
36425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36426 LDKChannelTypeFeatures orig_conv;
36427 orig_conv.inner = (void*)(orig & (~1));
36428 orig_conv.is_owned = false;
36429 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36430 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
36431 uintptr_t ret_ref = 0;
36432 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36433 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36435 ret_ref = (uintptr_t)ret_var.inner;
36436 if (ret_var.is_owned) {
36442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36443 LDKInitFeatures this_obj_conv;
36444 this_obj_conv.inner = (void*)(this_obj & (~1));
36445 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36447 InitFeatures_free(this_obj_conv);
36450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36451 LDKNodeFeatures this_obj_conv;
36452 this_obj_conv.inner = (void*)(this_obj & (~1));
36453 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36455 NodeFeatures_free(this_obj_conv);
36458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36459 LDKChannelFeatures this_obj_conv;
36460 this_obj_conv.inner = (void*)(this_obj & (~1));
36461 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36463 ChannelFeatures_free(this_obj_conv);
36466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36467 LDKInvoiceFeatures this_obj_conv;
36468 this_obj_conv.inner = (void*)(this_obj & (~1));
36469 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36471 InvoiceFeatures_free(this_obj_conv);
36474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36475 LDKChannelTypeFeatures this_obj_conv;
36476 this_obj_conv.inner = (void*)(this_obj & (~1));
36477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36479 ChannelTypeFeatures_free(this_obj_conv);
36482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
36483 LDKInitFeatures ret_var = InitFeatures_empty();
36484 uintptr_t ret_ref = 0;
36485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36488 ret_ref = (uintptr_t)ret_var.inner;
36489 if (ret_var.is_owned) {
36495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
36496 LDKInitFeatures ret_var = InitFeatures_known();
36497 uintptr_t ret_ref = 0;
36498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36501 ret_ref = (uintptr_t)ret_var.inner;
36502 if (ret_var.is_owned) {
36508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
36509 LDKInitFeatures this_arg_conv;
36510 this_arg_conv.inner = (void*)(this_arg & (~1));
36511 this_arg_conv.is_owned = false;
36512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36513 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
36517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
36518 LDKNodeFeatures ret_var = NodeFeatures_empty();
36519 uintptr_t ret_ref = 0;
36520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36523 ret_ref = (uintptr_t)ret_var.inner;
36524 if (ret_var.is_owned) {
36530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
36531 LDKNodeFeatures ret_var = NodeFeatures_known();
36532 uintptr_t ret_ref = 0;
36533 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36534 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36536 ret_ref = (uintptr_t)ret_var.inner;
36537 if (ret_var.is_owned) {
36543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
36544 LDKNodeFeatures this_arg_conv;
36545 this_arg_conv.inner = (void*)(this_arg & (~1));
36546 this_arg_conv.is_owned = false;
36547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36548 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
36552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
36553 LDKChannelFeatures ret_var = ChannelFeatures_empty();
36554 uintptr_t ret_ref = 0;
36555 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36556 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36558 ret_ref = (uintptr_t)ret_var.inner;
36559 if (ret_var.is_owned) {
36565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
36566 LDKChannelFeatures ret_var = ChannelFeatures_known();
36567 uintptr_t ret_ref = 0;
36568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36571 ret_ref = (uintptr_t)ret_var.inner;
36572 if (ret_var.is_owned) {
36578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
36579 LDKChannelFeatures this_arg_conv;
36580 this_arg_conv.inner = (void*)(this_arg & (~1));
36581 this_arg_conv.is_owned = false;
36582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36583 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
36587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
36588 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
36589 uintptr_t ret_ref = 0;
36590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36593 ret_ref = (uintptr_t)ret_var.inner;
36594 if (ret_var.is_owned) {
36600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
36601 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
36602 uintptr_t ret_ref = 0;
36603 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36604 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36605 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36606 ret_ref = (uintptr_t)ret_var.inner;
36607 if (ret_var.is_owned) {
36613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
36614 LDKInvoiceFeatures this_arg_conv;
36615 this_arg_conv.inner = (void*)(this_arg & (~1));
36616 this_arg_conv.is_owned = false;
36617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36618 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
36622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
36623 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
36624 uintptr_t ret_ref = 0;
36625 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36626 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36627 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36628 ret_ref = (uintptr_t)ret_var.inner;
36629 if (ret_var.is_owned) {
36635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
36636 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
36637 uintptr_t ret_ref = 0;
36638 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36639 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36640 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36641 ret_ref = (uintptr_t)ret_var.inner;
36642 if (ret_var.is_owned) {
36648 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
36649 LDKChannelTypeFeatures this_arg_conv;
36650 this_arg_conv.inner = (void*)(this_arg & (~1));
36651 this_arg_conv.is_owned = false;
36652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36653 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
36657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36658 LDKInitFeatures obj_conv;
36659 obj_conv.inner = (void*)(obj & (~1));
36660 obj_conv.is_owned = false;
36661 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36662 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
36663 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36664 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36665 CVec_u8Z_free(ret_var);
36669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36670 LDKu8slice ser_ref;
36671 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36672 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36673 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
36674 *ret_conv = InitFeatures_read(ser_ref);
36675 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36676 return (uintptr_t)ret_conv;
36679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36680 LDKChannelFeatures obj_conv;
36681 obj_conv.inner = (void*)(obj & (~1));
36682 obj_conv.is_owned = false;
36683 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36684 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
36685 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36686 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36687 CVec_u8Z_free(ret_var);
36691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36692 LDKu8slice ser_ref;
36693 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36694 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36695 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
36696 *ret_conv = ChannelFeatures_read(ser_ref);
36697 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36698 return (uintptr_t)ret_conv;
36701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36702 LDKNodeFeatures obj_conv;
36703 obj_conv.inner = (void*)(obj & (~1));
36704 obj_conv.is_owned = false;
36705 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36706 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
36707 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36708 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36709 CVec_u8Z_free(ret_var);
36713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36714 LDKu8slice ser_ref;
36715 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36716 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36717 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
36718 *ret_conv = NodeFeatures_read(ser_ref);
36719 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36720 return (uintptr_t)ret_conv;
36723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36724 LDKInvoiceFeatures obj_conv;
36725 obj_conv.inner = (void*)(obj & (~1));
36726 obj_conv.is_owned = false;
36727 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36728 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
36729 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36730 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36731 CVec_u8Z_free(ret_var);
36735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36736 LDKu8slice ser_ref;
36737 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36738 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36739 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
36740 *ret_conv = InvoiceFeatures_read(ser_ref);
36741 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36742 return (uintptr_t)ret_conv;
36745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
36746 LDKChannelTypeFeatures obj_conv;
36747 obj_conv.inner = (void*)(obj & (~1));
36748 obj_conv.is_owned = false;
36749 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36750 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
36751 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36752 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36753 CVec_u8Z_free(ret_var);
36757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36758 LDKu8slice ser_ref;
36759 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36760 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36761 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
36762 *ret_conv = ChannelTypeFeatures_read(ser_ref);
36763 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36764 return (uintptr_t)ret_conv;
36767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36768 LDKShutdownScript this_obj_conv;
36769 this_obj_conv.inner = (void*)(this_obj & (~1));
36770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36772 ShutdownScript_free(this_obj_conv);
36775 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
36776 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
36777 uintptr_t ret_ref = 0;
36778 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36779 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36780 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36781 ret_ref = (uintptr_t)ret_var.inner;
36782 if (ret_var.is_owned) {
36787 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36788 LDKShutdownScript arg_conv;
36789 arg_conv.inner = (void*)(arg & (~1));
36790 arg_conv.is_owned = false;
36791 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36792 intptr_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
36796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36797 LDKShutdownScript orig_conv;
36798 orig_conv.inner = (void*)(orig & (~1));
36799 orig_conv.is_owned = false;
36800 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36801 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
36802 uintptr_t ret_ref = 0;
36803 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36804 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36806 ret_ref = (uintptr_t)ret_var.inner;
36807 if (ret_var.is_owned) {
36813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36814 LDKInvalidShutdownScript this_obj_conv;
36815 this_obj_conv.inner = (void*)(this_obj & (~1));
36816 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36818 InvalidShutdownScript_free(this_obj_conv);
36821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
36822 LDKInvalidShutdownScript this_ptr_conv;
36823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36824 this_ptr_conv.is_owned = false;
36825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36826 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
36827 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36828 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36833 LDKInvalidShutdownScript this_ptr_conv;
36834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36835 this_ptr_conv.is_owned = false;
36836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36837 LDKCVec_u8Z val_ref;
36838 val_ref.datalen = (*env)->GetArrayLength(env, val);
36839 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
36840 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
36841 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
36844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
36845 LDKCVec_u8Z script_arg_ref;
36846 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
36847 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
36848 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
36849 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
36850 uintptr_t ret_ref = 0;
36851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36854 ret_ref = (uintptr_t)ret_var.inner;
36855 if (ret_var.is_owned) {
36861 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
36862 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
36863 uintptr_t ret_ref = 0;
36864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36867 ret_ref = (uintptr_t)ret_var.inner;
36868 if (ret_var.is_owned) {
36873 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36874 LDKInvalidShutdownScript arg_conv;
36875 arg_conv.inner = (void*)(arg & (~1));
36876 arg_conv.is_owned = false;
36877 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36878 intptr_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
36882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36883 LDKInvalidShutdownScript orig_conv;
36884 orig_conv.inner = (void*)(orig & (~1));
36885 orig_conv.is_owned = false;
36886 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36887 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
36888 uintptr_t ret_ref = 0;
36889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36892 ret_ref = (uintptr_t)ret_var.inner;
36893 if (ret_var.is_owned) {
36899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
36900 LDKShutdownScript obj_conv;
36901 obj_conv.inner = (void*)(obj & (~1));
36902 obj_conv.is_owned = false;
36903 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36904 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
36905 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36906 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36907 CVec_u8Z_free(ret_var);
36911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36912 LDKu8slice ser_ref;
36913 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36914 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36915 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
36916 *ret_conv = ShutdownScript_read(ser_ref);
36917 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36918 return (uintptr_t)ret_conv;
36921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
36922 unsigned char pubkey_hash_arr[20];
36923 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
36924 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
36925 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
36926 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
36927 uintptr_t ret_ref = 0;
36928 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36929 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36930 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36931 ret_ref = (uintptr_t)ret_var.inner;
36932 if (ret_var.is_owned) {
36938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
36939 unsigned char script_hash_arr[32];
36940 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
36941 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
36942 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
36943 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
36944 uintptr_t ret_ref = 0;
36945 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36946 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36947 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36948 ret_ref = (uintptr_t)ret_var.inner;
36949 if (ret_var.is_owned) {
36955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
36956 LDKu8slice program_ref;
36957 program_ref.datalen = (*env)->GetArrayLength(env, program);
36958 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
36959 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
36960 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
36961 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
36962 return (uintptr_t)ret_conv;
36965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
36966 LDKShutdownScript this_arg_conv;
36967 this_arg_conv.inner = (void*)(this_arg & (~1));
36968 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
36969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36970 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
36971 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
36972 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36973 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36974 CVec_u8Z_free(ret_var);
36978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
36979 LDKShutdownScript this_arg_conv;
36980 this_arg_conv.inner = (void*)(this_arg & (~1));
36981 this_arg_conv.is_owned = false;
36982 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36983 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36984 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
36988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
36989 LDKShutdownScript this_arg_conv;
36990 this_arg_conv.inner = (void*)(this_arg & (~1));
36991 this_arg_conv.is_owned = false;
36992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36993 LDKInitFeatures features_conv;
36994 features_conv.inner = (void*)(features & (~1));
36995 features_conv.is_owned = false;
36996 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
36997 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
37001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37002 if ((this_ptr & 1) != 0) return;
37003 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37004 CHECK_ACCESS(this_ptr_ptr);
37005 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
37006 FREE((void*)this_ptr);
37007 CustomMessageReader_free(this_ptr_conv);
37010 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
37011 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37012 *ret_ret = Type_clone(arg);
37013 return (uintptr_t)ret_ret;
37015 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37016 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
37017 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
37018 LDKType* arg_conv = (LDKType*)arg_ptr;
37019 intptr_t ret_val = Type_clone_ptr(arg_conv);
37023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37024 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
37025 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
37026 LDKType* orig_conv = (LDKType*)orig_ptr;
37027 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
37028 *ret_ret = Type_clone(orig_conv);
37029 return (uintptr_t)ret_ret;
37032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37033 if ((this_ptr & 1) != 0) return;
37034 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37035 CHECK_ACCESS(this_ptr_ptr);
37036 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
37037 FREE((void*)this_ptr);
37038 Type_free(this_ptr_conv);
37041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37042 LDKNodeId this_obj_conv;
37043 this_obj_conv.inner = (void*)(this_obj & (~1));
37044 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37046 NodeId_free(this_obj_conv);
37049 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
37050 LDKNodeId ret_var = NodeId_clone(arg);
37051 uintptr_t ret_ref = 0;
37052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37055 ret_ref = (uintptr_t)ret_var.inner;
37056 if (ret_var.is_owned) {
37061 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37062 LDKNodeId arg_conv;
37063 arg_conv.inner = (void*)(arg & (~1));
37064 arg_conv.is_owned = false;
37065 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37066 intptr_t ret_val = NodeId_clone_ptr(&arg_conv);
37070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37071 LDKNodeId orig_conv;
37072 orig_conv.inner = (void*)(orig & (~1));
37073 orig_conv.is_owned = false;
37074 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37075 LDKNodeId ret_var = NodeId_clone(&orig_conv);
37076 uintptr_t ret_ref = 0;
37077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37080 ret_ref = (uintptr_t)ret_var.inner;
37081 if (ret_var.is_owned) {
37087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
37088 LDKPublicKey pubkey_ref;
37089 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
37090 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
37091 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
37092 uintptr_t ret_ref = 0;
37093 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37094 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37096 ret_ref = (uintptr_t)ret_var.inner;
37097 if (ret_var.is_owned) {
37103 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
37104 LDKNodeId this_arg_conv;
37105 this_arg_conv.inner = (void*)(this_arg & (~1));
37106 this_arg_conv.is_owned = false;
37107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37108 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
37109 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37110 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
37116 o_conv.inner = (void*)(o & (~1));
37117 o_conv.is_owned = false;
37118 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37119 int64_t ret_val = NodeId_hash(&o_conv);
37123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
37124 LDKNodeId obj_conv;
37125 obj_conv.inner = (void*)(obj & (~1));
37126 obj_conv.is_owned = false;
37127 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37128 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
37129 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37130 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37131 CVec_u8Z_free(ret_var);
37135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37136 LDKu8slice ser_ref;
37137 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37138 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37139 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
37140 *ret_conv = NodeId_read(ser_ref);
37141 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37142 return (uintptr_t)ret_conv;
37145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37146 LDKNetworkGraph this_obj_conv;
37147 this_obj_conv.inner = (void*)(this_obj & (~1));
37148 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37150 NetworkGraph_free(this_obj_conv);
37153 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
37154 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
37155 uintptr_t ret_ref = 0;
37156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37159 ret_ref = (uintptr_t)ret_var.inner;
37160 if (ret_var.is_owned) {
37165 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37166 LDKNetworkGraph arg_conv;
37167 arg_conv.inner = (void*)(arg & (~1));
37168 arg_conv.is_owned = false;
37169 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37170 intptr_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
37174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37175 LDKNetworkGraph orig_conv;
37176 orig_conv.inner = (void*)(orig & (~1));
37177 orig_conv.is_owned = false;
37178 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37179 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
37180 uintptr_t ret_ref = 0;
37181 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37182 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37183 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37184 ret_ref = (uintptr_t)ret_var.inner;
37185 if (ret_var.is_owned) {
37191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37192 LDKReadOnlyNetworkGraph this_obj_conv;
37193 this_obj_conv.inner = (void*)(this_obj & (~1));
37194 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37195 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37196 ReadOnlyNetworkGraph_free(this_obj_conv);
37199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
37200 if ((this_ptr & 1) != 0) return;
37201 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
37202 CHECK_ACCESS(this_ptr_ptr);
37203 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
37204 FREE((void*)this_ptr);
37205 NetworkUpdate_free(this_ptr_conv);
37208 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
37209 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37210 *ret_copy = NetworkUpdate_clone(arg);
37211 uintptr_t ret_ref = (uintptr_t)ret_copy;
37214 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37215 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
37216 intptr_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
37220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37221 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
37222 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37223 *ret_copy = NetworkUpdate_clone(orig_conv);
37224 uintptr_t ret_ref = (uintptr_t)ret_copy;
37228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
37229 LDKChannelUpdate msg_conv;
37230 msg_conv.inner = (void*)(msg & (~1));
37231 msg_conv.is_owned = (msg & 1) || (msg == 0);
37232 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
37233 msg_conv = ChannelUpdate_clone(&msg_conv);
37234 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37235 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
37236 uintptr_t ret_ref = (uintptr_t)ret_copy;
37240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
37241 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37242 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
37243 uintptr_t ret_ref = (uintptr_t)ret_copy;
37247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
37248 LDKPublicKey node_id_ref;
37249 CHECK((*env)->GetArrayLength(env, node_id) == 33);
37250 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
37251 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
37252 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
37253 uintptr_t ret_ref = (uintptr_t)ret_copy;
37257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
37258 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
37259 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
37260 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37261 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37262 CVec_u8Z_free(ret_var);
37266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37267 LDKu8slice ser_ref;
37268 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37269 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37270 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
37271 *ret_conv = NetworkUpdate_read(ser_ref);
37272 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37273 return (uintptr_t)ret_conv;
37276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37277 LDKNetGraphMsgHandler this_arg_conv;
37278 this_arg_conv.inner = (void*)(this_arg & (~1));
37279 this_arg_conv.is_owned = false;
37280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37281 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
37282 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
37283 return (uintptr_t)ret_ret;
37286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37287 LDKNetGraphMsgHandler this_obj_conv;
37288 this_obj_conv.inner = (void*)(this_obj & (~1));
37289 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37291 NetGraphMsgHandler_free(this_obj_conv);
37294 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) {
37295 LDKNetworkGraph network_graph_conv;
37296 network_graph_conv.inner = (void*)(network_graph & (~1));
37297 network_graph_conv.is_owned = false;
37298 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
37299 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
37300 CHECK_ACCESS(chain_access_ptr);
37301 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37302 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
37303 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37304 // Manually implement clone for Java trait instances
37305 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37306 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37307 LDKAccess_JCalls_cloned(&chain_access_conv.some);
37310 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
37311 CHECK_ACCESS(logger_ptr);
37312 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
37313 if (logger_conv.free == LDKLogger_JCalls_free) {
37314 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37315 LDKLogger_JCalls_cloned(&logger_conv);
37317 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
37318 uintptr_t ret_ref = 0;
37319 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37320 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37321 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37322 ret_ref = (uintptr_t)ret_var.inner;
37323 if (ret_var.is_owned) {
37329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
37330 LDKNetGraphMsgHandler this_arg_conv;
37331 this_arg_conv.inner = (void*)(this_arg & (~1));
37332 this_arg_conv.is_owned = false;
37333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37334 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
37335 CHECK_ACCESS(chain_access_ptr);
37336 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
37337 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
37338 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
37339 // Manually implement clone for Java trait instances
37340 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
37341 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
37342 LDKAccess_JCalls_cloned(&chain_access_conv.some);
37345 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
37348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
37349 LDKNetGraphMsgHandler this_arg_conv;
37350 this_arg_conv.inner = (void*)(this_arg & (~1));
37351 this_arg_conv.is_owned = false;
37352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37353 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
37354 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
37355 return (uintptr_t)ret_ret;
37358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
37359 LDKNetGraphMsgHandler this_arg_conv;
37360 this_arg_conv.inner = (void*)(this_arg & (~1));
37361 this_arg_conv.is_owned = false;
37362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37363 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
37364 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
37365 return (uintptr_t)ret_ret;
37368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37369 LDKDirectionalChannelInfo this_obj_conv;
37370 this_obj_conv.inner = (void*)(this_obj & (~1));
37371 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37373 DirectionalChannelInfo_free(this_obj_conv);
37376 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
37377 LDKDirectionalChannelInfo this_ptr_conv;
37378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37379 this_ptr_conv.is_owned = false;
37380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37381 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
37385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37386 LDKDirectionalChannelInfo this_ptr_conv;
37387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37388 this_ptr_conv.is_owned = false;
37389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37390 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
37393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
37394 LDKDirectionalChannelInfo this_ptr_conv;
37395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37396 this_ptr_conv.is_owned = false;
37397 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37398 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
37402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37403 LDKDirectionalChannelInfo this_ptr_conv;
37404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37405 this_ptr_conv.is_owned = false;
37406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37407 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
37410 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
37411 LDKDirectionalChannelInfo this_ptr_conv;
37412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37413 this_ptr_conv.is_owned = false;
37414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37415 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
37419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
37420 LDKDirectionalChannelInfo this_ptr_conv;
37421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37422 this_ptr_conv.is_owned = false;
37423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37424 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
37427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37428 LDKDirectionalChannelInfo this_ptr_conv;
37429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37430 this_ptr_conv.is_owned = false;
37431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37432 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
37436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37437 LDKDirectionalChannelInfo this_ptr_conv;
37438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37439 this_ptr_conv.is_owned = false;
37440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37441 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
37444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37445 LDKDirectionalChannelInfo this_ptr_conv;
37446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37447 this_ptr_conv.is_owned = false;
37448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37449 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37450 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
37451 uintptr_t ret_ref = (uintptr_t)ret_copy;
37455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37456 LDKDirectionalChannelInfo this_ptr_conv;
37457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37458 this_ptr_conv.is_owned = false;
37459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37460 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37461 CHECK_ACCESS(val_ptr);
37462 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37463 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
37464 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
37467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
37468 LDKDirectionalChannelInfo this_ptr_conv;
37469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37470 this_ptr_conv.is_owned = false;
37471 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37472 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
37473 uintptr_t ret_ref = 0;
37474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37477 ret_ref = (uintptr_t)ret_var.inner;
37478 if (ret_var.is_owned) {
37484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37485 LDKDirectionalChannelInfo this_ptr_conv;
37486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37487 this_ptr_conv.is_owned = false;
37488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37489 LDKRoutingFees val_conv;
37490 val_conv.inner = (void*)(val & (~1));
37491 val_conv.is_owned = (val & 1) || (val == 0);
37492 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37493 val_conv = RoutingFees_clone(&val_conv);
37494 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
37497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
37498 LDKDirectionalChannelInfo this_ptr_conv;
37499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37500 this_ptr_conv.is_owned = false;
37501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37502 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
37503 uintptr_t ret_ref = 0;
37504 if ((uintptr_t)ret_var.inner > 4096) {
37505 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37506 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37508 ret_ref = (uintptr_t)ret_var.inner;
37509 if (ret_var.is_owned) {
37516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37517 LDKDirectionalChannelInfo this_ptr_conv;
37518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37519 this_ptr_conv.is_owned = false;
37520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37521 LDKChannelUpdate val_conv;
37522 val_conv.inner = (void*)(val & (~1));
37523 val_conv.is_owned = (val & 1) || (val == 0);
37524 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37525 val_conv = ChannelUpdate_clone(&val_conv);
37526 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
37529 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) {
37530 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
37531 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
37532 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
37533 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
37534 LDKRoutingFees fees_arg_conv;
37535 fees_arg_conv.inner = (void*)(fees_arg & (~1));
37536 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
37537 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
37538 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
37539 LDKChannelUpdate last_update_message_arg_conv;
37540 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
37541 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
37542 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
37543 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
37544 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);
37545 uintptr_t ret_ref = 0;
37546 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37547 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37548 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37549 ret_ref = (uintptr_t)ret_var.inner;
37550 if (ret_var.is_owned) {
37556 static inline uintptr_t DirectionalChannelInfo_clone_ptr(LDKDirectionalChannelInfo *NONNULL_PTR arg) {
37557 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(arg);
37558 uintptr_t ret_ref = 0;
37559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37562 ret_ref = (uintptr_t)ret_var.inner;
37563 if (ret_var.is_owned) {
37568 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37569 LDKDirectionalChannelInfo arg_conv;
37570 arg_conv.inner = (void*)(arg & (~1));
37571 arg_conv.is_owned = false;
37572 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37573 intptr_t ret_val = DirectionalChannelInfo_clone_ptr(&arg_conv);
37577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37578 LDKDirectionalChannelInfo orig_conv;
37579 orig_conv.inner = (void*)(orig & (~1));
37580 orig_conv.is_owned = false;
37581 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37582 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
37583 uintptr_t ret_ref = 0;
37584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37587 ret_ref = (uintptr_t)ret_var.inner;
37588 if (ret_var.is_owned) {
37594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
37595 LDKDirectionalChannelInfo obj_conv;
37596 obj_conv.inner = (void*)(obj & (~1));
37597 obj_conv.is_owned = false;
37598 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37599 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
37600 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37601 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37602 CVec_u8Z_free(ret_var);
37606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37607 LDKu8slice ser_ref;
37608 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37609 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37610 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
37611 *ret_conv = DirectionalChannelInfo_read(ser_ref);
37612 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37613 return (uintptr_t)ret_conv;
37616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37617 LDKChannelInfo this_obj_conv;
37618 this_obj_conv.inner = (void*)(this_obj & (~1));
37619 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37621 ChannelInfo_free(this_obj_conv);
37624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
37625 LDKChannelInfo this_ptr_conv;
37626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37627 this_ptr_conv.is_owned = false;
37628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37629 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
37630 uintptr_t ret_ref = 0;
37631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37634 ret_ref = (uintptr_t)ret_var.inner;
37635 if (ret_var.is_owned) {
37641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37642 LDKChannelInfo this_ptr_conv;
37643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37644 this_ptr_conv.is_owned = false;
37645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37646 LDKChannelFeatures val_conv;
37647 val_conv.inner = (void*)(val & (~1));
37648 val_conv.is_owned = (val & 1) || (val == 0);
37649 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37650 val_conv = ChannelFeatures_clone(&val_conv);
37651 ChannelInfo_set_features(&this_ptr_conv, val_conv);
37654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
37655 LDKChannelInfo this_ptr_conv;
37656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37657 this_ptr_conv.is_owned = false;
37658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37659 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
37660 uintptr_t ret_ref = 0;
37661 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37662 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37663 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37664 ret_ref = (uintptr_t)ret_var.inner;
37665 if (ret_var.is_owned) {
37671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37672 LDKChannelInfo this_ptr_conv;
37673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37674 this_ptr_conv.is_owned = false;
37675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37676 LDKNodeId val_conv;
37677 val_conv.inner = (void*)(val & (~1));
37678 val_conv.is_owned = (val & 1) || (val == 0);
37679 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37680 val_conv = NodeId_clone(&val_conv);
37681 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
37684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
37685 LDKChannelInfo this_ptr_conv;
37686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37687 this_ptr_conv.is_owned = false;
37688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37689 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
37690 uintptr_t ret_ref = 0;
37691 if ((uintptr_t)ret_var.inner > 4096) {
37692 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37693 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37694 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37695 ret_ref = (uintptr_t)ret_var.inner;
37696 if (ret_var.is_owned) {
37703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37704 LDKChannelInfo this_ptr_conv;
37705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37706 this_ptr_conv.is_owned = false;
37707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37708 LDKDirectionalChannelInfo val_conv;
37709 val_conv.inner = (void*)(val & (~1));
37710 val_conv.is_owned = (val & 1) || (val == 0);
37711 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37712 val_conv = DirectionalChannelInfo_clone(&val_conv);
37713 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
37716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
37717 LDKChannelInfo this_ptr_conv;
37718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37719 this_ptr_conv.is_owned = false;
37720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37721 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
37722 uintptr_t ret_ref = 0;
37723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37726 ret_ref = (uintptr_t)ret_var.inner;
37727 if (ret_var.is_owned) {
37733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37734 LDKChannelInfo this_ptr_conv;
37735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37736 this_ptr_conv.is_owned = false;
37737 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37738 LDKNodeId val_conv;
37739 val_conv.inner = (void*)(val & (~1));
37740 val_conv.is_owned = (val & 1) || (val == 0);
37741 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37742 val_conv = NodeId_clone(&val_conv);
37743 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
37746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
37747 LDKChannelInfo this_ptr_conv;
37748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37749 this_ptr_conv.is_owned = false;
37750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37751 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
37752 uintptr_t ret_ref = 0;
37753 if ((uintptr_t)ret_var.inner > 4096) {
37754 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37755 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37757 ret_ref = (uintptr_t)ret_var.inner;
37758 if (ret_var.is_owned) {
37765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37766 LDKChannelInfo this_ptr_conv;
37767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37768 this_ptr_conv.is_owned = false;
37769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37770 LDKDirectionalChannelInfo val_conv;
37771 val_conv.inner = (void*)(val & (~1));
37772 val_conv.is_owned = (val & 1) || (val == 0);
37773 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37774 val_conv = DirectionalChannelInfo_clone(&val_conv);
37775 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
37778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
37779 LDKChannelInfo this_ptr_conv;
37780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37781 this_ptr_conv.is_owned = false;
37782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37783 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37784 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
37785 uintptr_t ret_ref = (uintptr_t)ret_copy;
37789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37790 LDKChannelInfo this_ptr_conv;
37791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37792 this_ptr_conv.is_owned = false;
37793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37794 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37795 CHECK_ACCESS(val_ptr);
37796 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37797 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
37798 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
37801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
37802 LDKChannelInfo this_ptr_conv;
37803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37804 this_ptr_conv.is_owned = false;
37805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37806 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
37807 uintptr_t ret_ref = 0;
37808 if ((uintptr_t)ret_var.inner > 4096) {
37809 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37810 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37812 ret_ref = (uintptr_t)ret_var.inner;
37813 if (ret_var.is_owned) {
37820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37821 LDKChannelInfo this_ptr_conv;
37822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37823 this_ptr_conv.is_owned = false;
37824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37825 LDKChannelAnnouncement val_conv;
37826 val_conv.inner = (void*)(val & (~1));
37827 val_conv.is_owned = (val & 1) || (val == 0);
37828 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37829 val_conv = ChannelAnnouncement_clone(&val_conv);
37830 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
37833 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
37834 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
37835 uintptr_t ret_ref = 0;
37836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37839 ret_ref = (uintptr_t)ret_var.inner;
37840 if (ret_var.is_owned) {
37845 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37846 LDKChannelInfo arg_conv;
37847 arg_conv.inner = (void*)(arg & (~1));
37848 arg_conv.is_owned = false;
37849 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37850 intptr_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
37854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37855 LDKChannelInfo orig_conv;
37856 orig_conv.inner = (void*)(orig & (~1));
37857 orig_conv.is_owned = false;
37858 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37859 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
37860 uintptr_t ret_ref = 0;
37861 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37862 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37863 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37864 ret_ref = (uintptr_t)ret_var.inner;
37865 if (ret_var.is_owned) {
37871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
37872 LDKChannelInfo obj_conv;
37873 obj_conv.inner = (void*)(obj & (~1));
37874 obj_conv.is_owned = false;
37875 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37876 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
37877 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37878 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37879 CVec_u8Z_free(ret_var);
37883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37884 LDKu8slice ser_ref;
37885 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37886 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37887 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
37888 *ret_conv = ChannelInfo_read(ser_ref);
37889 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37890 return (uintptr_t)ret_conv;
37893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37894 LDKRoutingFees this_obj_conv;
37895 this_obj_conv.inner = (void*)(this_obj & (~1));
37896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37898 RoutingFees_free(this_obj_conv);
37901 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37902 LDKRoutingFees this_ptr_conv;
37903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37904 this_ptr_conv.is_owned = false;
37905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37906 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
37910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37911 LDKRoutingFees this_ptr_conv;
37912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37913 this_ptr_conv.is_owned = false;
37914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37915 RoutingFees_set_base_msat(&this_ptr_conv, val);
37918 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
37919 LDKRoutingFees this_ptr_conv;
37920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37921 this_ptr_conv.is_owned = false;
37922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37923 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
37927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37928 LDKRoutingFees this_ptr_conv;
37929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37930 this_ptr_conv.is_owned = false;
37931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37932 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
37935 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) {
37936 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
37937 uintptr_t ret_ref = 0;
37938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37941 ret_ref = (uintptr_t)ret_var.inner;
37942 if (ret_var.is_owned) {
37948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
37949 LDKRoutingFees a_conv;
37950 a_conv.inner = (void*)(a & (~1));
37951 a_conv.is_owned = false;
37952 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37953 LDKRoutingFees b_conv;
37954 b_conv.inner = (void*)(b & (~1));
37955 b_conv.is_owned = false;
37956 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37957 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
37961 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
37962 LDKRoutingFees ret_var = RoutingFees_clone(arg);
37963 uintptr_t ret_ref = 0;
37964 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37965 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37966 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37967 ret_ref = (uintptr_t)ret_var.inner;
37968 if (ret_var.is_owned) {
37973 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37974 LDKRoutingFees arg_conv;
37975 arg_conv.inner = (void*)(arg & (~1));
37976 arg_conv.is_owned = false;
37977 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37978 intptr_t ret_val = RoutingFees_clone_ptr(&arg_conv);
37982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37983 LDKRoutingFees orig_conv;
37984 orig_conv.inner = (void*)(orig & (~1));
37985 orig_conv.is_owned = false;
37986 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37987 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
37988 uintptr_t ret_ref = 0;
37989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37992 ret_ref = (uintptr_t)ret_var.inner;
37993 if (ret_var.is_owned) {
37999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
38000 LDKRoutingFees o_conv;
38001 o_conv.inner = (void*)(o & (~1));
38002 o_conv.is_owned = false;
38003 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38004 int64_t ret_val = RoutingFees_hash(&o_conv);
38008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
38009 LDKRoutingFees obj_conv;
38010 obj_conv.inner = (void*)(obj & (~1));
38011 obj_conv.is_owned = false;
38012 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38013 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
38014 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38015 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38016 CVec_u8Z_free(ret_var);
38020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38021 LDKu8slice ser_ref;
38022 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38023 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38024 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
38025 *ret_conv = RoutingFees_read(ser_ref);
38026 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38027 return (uintptr_t)ret_conv;
38030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38031 LDKNodeAnnouncementInfo this_obj_conv;
38032 this_obj_conv.inner = (void*)(this_obj & (~1));
38033 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38035 NodeAnnouncementInfo_free(this_obj_conv);
38038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
38039 LDKNodeAnnouncementInfo this_ptr_conv;
38040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38041 this_ptr_conv.is_owned = false;
38042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38043 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
38044 uintptr_t ret_ref = 0;
38045 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38046 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38047 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38048 ret_ref = (uintptr_t)ret_var.inner;
38049 if (ret_var.is_owned) {
38055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38056 LDKNodeAnnouncementInfo this_ptr_conv;
38057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38058 this_ptr_conv.is_owned = false;
38059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38060 LDKNodeFeatures val_conv;
38061 val_conv.inner = (void*)(val & (~1));
38062 val_conv.is_owned = (val & 1) || (val == 0);
38063 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38064 val_conv = NodeFeatures_clone(&val_conv);
38065 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
38068 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
38069 LDKNodeAnnouncementInfo this_ptr_conv;
38070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38071 this_ptr_conv.is_owned = false;
38072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38073 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
38077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38078 LDKNodeAnnouncementInfo this_ptr_conv;
38079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38080 this_ptr_conv.is_owned = false;
38081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38082 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
38085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
38086 LDKNodeAnnouncementInfo this_ptr_conv;
38087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38088 this_ptr_conv.is_owned = false;
38089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38090 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
38091 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
38095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38096 LDKNodeAnnouncementInfo this_ptr_conv;
38097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38098 this_ptr_conv.is_owned = false;
38099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38100 LDKThreeBytes val_ref;
38101 CHECK((*env)->GetArrayLength(env, val) == 3);
38102 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
38103 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
38106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
38107 LDKNodeAnnouncementInfo this_ptr_conv;
38108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38109 this_ptr_conv.is_owned = false;
38110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38111 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38112 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
38116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38117 LDKNodeAnnouncementInfo this_ptr_conv;
38118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38119 this_ptr_conv.is_owned = false;
38120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38121 LDKThirtyTwoBytes val_ref;
38122 CHECK((*env)->GetArrayLength(env, val) == 32);
38123 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38124 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
38127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
38128 LDKNodeAnnouncementInfo this_ptr_conv;
38129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38130 this_ptr_conv.is_owned = false;
38131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38132 LDKCVec_NetAddressZ val_constr;
38133 val_constr.datalen = (*env)->GetArrayLength(env, val);
38134 if (val_constr.datalen > 0)
38135 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
38137 val_constr.data = NULL;
38138 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
38139 for (size_t m = 0; m < val_constr.datalen; m++) {
38140 int64_t val_conv_12 = val_vals[m];
38141 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
38142 CHECK_ACCESS(val_conv_12_ptr);
38143 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
38144 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
38145 val_constr.data[m] = val_conv_12_conv;
38147 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
38148 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
38151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
38152 LDKNodeAnnouncementInfo this_ptr_conv;
38153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38154 this_ptr_conv.is_owned = false;
38155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38156 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
38157 uintptr_t ret_ref = 0;
38158 if ((uintptr_t)ret_var.inner > 4096) {
38159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38162 ret_ref = (uintptr_t)ret_var.inner;
38163 if (ret_var.is_owned) {
38170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38171 LDKNodeAnnouncementInfo this_ptr_conv;
38172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38173 this_ptr_conv.is_owned = false;
38174 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38175 LDKNodeAnnouncement val_conv;
38176 val_conv.inner = (void*)(val & (~1));
38177 val_conv.is_owned = (val & 1) || (val == 0);
38178 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38179 val_conv = NodeAnnouncement_clone(&val_conv);
38180 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
38183 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) {
38184 LDKNodeFeatures features_arg_conv;
38185 features_arg_conv.inner = (void*)(features_arg & (~1));
38186 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
38187 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
38188 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
38189 LDKThreeBytes rgb_arg_ref;
38190 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
38191 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
38192 LDKThirtyTwoBytes alias_arg_ref;
38193 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
38194 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
38195 LDKCVec_NetAddressZ addresses_arg_constr;
38196 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
38197 if (addresses_arg_constr.datalen > 0)
38198 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
38200 addresses_arg_constr.data = NULL;
38201 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
38202 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
38203 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
38204 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
38205 CHECK_ACCESS(addresses_arg_conv_12_ptr);
38206 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
38207 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
38209 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
38210 LDKNodeAnnouncement announcement_message_arg_conv;
38211 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
38212 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
38213 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
38214 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
38215 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
38216 uintptr_t ret_ref = 0;
38217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38220 ret_ref = (uintptr_t)ret_var.inner;
38221 if (ret_var.is_owned) {
38227 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
38228 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
38229 uintptr_t ret_ref = 0;
38230 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38231 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38232 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38233 ret_ref = (uintptr_t)ret_var.inner;
38234 if (ret_var.is_owned) {
38239 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38240 LDKNodeAnnouncementInfo arg_conv;
38241 arg_conv.inner = (void*)(arg & (~1));
38242 arg_conv.is_owned = false;
38243 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38244 intptr_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
38248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38249 LDKNodeAnnouncementInfo orig_conv;
38250 orig_conv.inner = (void*)(orig & (~1));
38251 orig_conv.is_owned = false;
38252 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38253 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
38254 uintptr_t ret_ref = 0;
38255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38258 ret_ref = (uintptr_t)ret_var.inner;
38259 if (ret_var.is_owned) {
38265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
38266 LDKNodeAnnouncementInfo obj_conv;
38267 obj_conv.inner = (void*)(obj & (~1));
38268 obj_conv.is_owned = false;
38269 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38270 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
38271 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38272 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38273 CVec_u8Z_free(ret_var);
38277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38278 LDKu8slice ser_ref;
38279 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38280 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38281 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
38282 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
38283 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38284 return (uintptr_t)ret_conv;
38287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38288 LDKNodeInfo this_obj_conv;
38289 this_obj_conv.inner = (void*)(this_obj & (~1));
38290 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38292 NodeInfo_free(this_obj_conv);
38295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
38296 LDKNodeInfo this_ptr_conv;
38297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38298 this_ptr_conv.is_owned = false;
38299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38300 LDKCVec_u64Z val_constr;
38301 val_constr.datalen = (*env)->GetArrayLength(env, val);
38302 if (val_constr.datalen > 0)
38303 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
38305 val_constr.data = NULL;
38306 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
38307 for (size_t g = 0; g < val_constr.datalen; g++) {
38308 int64_t val_conv_6 = val_vals[g];
38309 val_constr.data[g] = val_conv_6;
38311 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
38312 NodeInfo_set_channels(&this_ptr_conv, val_constr);
38315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
38316 LDKNodeInfo this_ptr_conv;
38317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38318 this_ptr_conv.is_owned = false;
38319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38320 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
38321 uintptr_t ret_ref = 0;
38322 if ((uintptr_t)ret_var.inner > 4096) {
38323 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38324 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38325 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38326 ret_ref = (uintptr_t)ret_var.inner;
38327 if (ret_var.is_owned) {
38334 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) {
38335 LDKNodeInfo this_ptr_conv;
38336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38337 this_ptr_conv.is_owned = false;
38338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38339 LDKRoutingFees val_conv;
38340 val_conv.inner = (void*)(val & (~1));
38341 val_conv.is_owned = (val & 1) || (val == 0);
38342 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38343 val_conv = RoutingFees_clone(&val_conv);
38344 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
38347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
38348 LDKNodeInfo this_ptr_conv;
38349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38350 this_ptr_conv.is_owned = false;
38351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38352 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
38353 uintptr_t ret_ref = 0;
38354 if ((uintptr_t)ret_var.inner > 4096) {
38355 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38356 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38358 ret_ref = (uintptr_t)ret_var.inner;
38359 if (ret_var.is_owned) {
38366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38367 LDKNodeInfo this_ptr_conv;
38368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38369 this_ptr_conv.is_owned = false;
38370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38371 LDKNodeAnnouncementInfo val_conv;
38372 val_conv.inner = (void*)(val & (~1));
38373 val_conv.is_owned = (val & 1) || (val == 0);
38374 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38375 val_conv = NodeAnnouncementInfo_clone(&val_conv);
38376 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
38379 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) {
38380 LDKCVec_u64Z channels_arg_constr;
38381 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
38382 if (channels_arg_constr.datalen > 0)
38383 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
38385 channels_arg_constr.data = NULL;
38386 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
38387 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
38388 int64_t channels_arg_conv_6 = channels_arg_vals[g];
38389 channels_arg_constr.data[g] = channels_arg_conv_6;
38391 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
38392 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
38393 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
38394 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
38395 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
38396 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
38397 LDKNodeAnnouncementInfo announcement_info_arg_conv;
38398 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
38399 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
38400 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
38401 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
38402 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
38403 uintptr_t ret_ref = 0;
38404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38407 ret_ref = (uintptr_t)ret_var.inner;
38408 if (ret_var.is_owned) {
38414 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
38415 LDKNodeInfo ret_var = NodeInfo_clone(arg);
38416 uintptr_t ret_ref = 0;
38417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38420 ret_ref = (uintptr_t)ret_var.inner;
38421 if (ret_var.is_owned) {
38426 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38427 LDKNodeInfo arg_conv;
38428 arg_conv.inner = (void*)(arg & (~1));
38429 arg_conv.is_owned = false;
38430 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38431 intptr_t ret_val = NodeInfo_clone_ptr(&arg_conv);
38435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38436 LDKNodeInfo orig_conv;
38437 orig_conv.inner = (void*)(orig & (~1));
38438 orig_conv.is_owned = false;
38439 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38440 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
38441 uintptr_t ret_ref = 0;
38442 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38443 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38444 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38445 ret_ref = (uintptr_t)ret_var.inner;
38446 if (ret_var.is_owned) {
38452 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
38453 LDKNodeInfo obj_conv;
38454 obj_conv.inner = (void*)(obj & (~1));
38455 obj_conv.is_owned = false;
38456 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38457 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
38458 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38459 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38460 CVec_u8Z_free(ret_var);
38464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38465 LDKu8slice ser_ref;
38466 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38467 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38468 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
38469 *ret_conv = NodeInfo_read(ser_ref);
38470 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38471 return (uintptr_t)ret_conv;
38474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
38475 LDKNetworkGraph obj_conv;
38476 obj_conv.inner = (void*)(obj & (~1));
38477 obj_conv.is_owned = false;
38478 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38479 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
38480 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38481 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38482 CVec_u8Z_free(ret_var);
38486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38487 LDKu8slice ser_ref;
38488 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38489 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38490 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
38491 *ret_conv = NetworkGraph_read(ser_ref);
38492 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38493 return (uintptr_t)ret_conv;
38496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
38497 LDKThirtyTwoBytes genesis_hash_ref;
38498 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
38499 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
38500 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
38501 uintptr_t ret_ref = 0;
38502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38505 ret_ref = (uintptr_t)ret_var.inner;
38506 if (ret_var.is_owned) {
38512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
38513 LDKNetworkGraph this_arg_conv;
38514 this_arg_conv.inner = (void*)(this_arg & (~1));
38515 this_arg_conv.is_owned = false;
38516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38517 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
38518 uintptr_t ret_ref = 0;
38519 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38520 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38522 ret_ref = (uintptr_t)ret_var.inner;
38523 if (ret_var.is_owned) {
38529 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) {
38530 LDKNetworkGraph this_arg_conv;
38531 this_arg_conv.inner = (void*)(this_arg & (~1));
38532 this_arg_conv.is_owned = false;
38533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38534 LDKNodeAnnouncement msg_conv;
38535 msg_conv.inner = (void*)(msg & (~1));
38536 msg_conv.is_owned = false;
38537 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38538 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
38539 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
38540 return (uintptr_t)ret_conv;
38543 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) {
38544 LDKNetworkGraph this_arg_conv;
38545 this_arg_conv.inner = (void*)(this_arg & (~1));
38546 this_arg_conv.is_owned = false;
38547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38548 LDKUnsignedNodeAnnouncement msg_conv;
38549 msg_conv.inner = (void*)(msg & (~1));
38550 msg_conv.is_owned = false;
38551 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38552 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
38553 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
38554 return (uintptr_t)ret_conv;
38557 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) {
38558 LDKNetworkGraph this_arg_conv;
38559 this_arg_conv.inner = (void*)(this_arg & (~1));
38560 this_arg_conv.is_owned = false;
38561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38562 LDKChannelAnnouncement msg_conv;
38563 msg_conv.inner = (void*)(msg & (~1));
38564 msg_conv.is_owned = false;
38565 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38566 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38567 CHECK_ACCESS(chain_access_ptr);
38568 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38569 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
38570 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38571 // Manually implement clone for Java trait instances
38572 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38573 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38574 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38577 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
38578 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
38579 return (uintptr_t)ret_conv;
38582 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) {
38583 LDKNetworkGraph this_arg_conv;
38584 this_arg_conv.inner = (void*)(this_arg & (~1));
38585 this_arg_conv.is_owned = false;
38586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38587 LDKUnsignedChannelAnnouncement msg_conv;
38588 msg_conv.inner = (void*)(msg & (~1));
38589 msg_conv.is_owned = false;
38590 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38591 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
38592 CHECK_ACCESS(chain_access_ptr);
38593 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
38594 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
38595 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
38596 // Manually implement clone for Java trait instances
38597 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
38598 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
38599 LDKAccess_JCalls_cloned(&chain_access_conv.some);
38602 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
38603 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
38604 return (uintptr_t)ret_conv;
38607 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) {
38608 LDKNetworkGraph this_arg_conv;
38609 this_arg_conv.inner = (void*)(this_arg & (~1));
38610 this_arg_conv.is_owned = false;
38611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38612 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
38615 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) {
38616 LDKNetworkGraph this_arg_conv;
38617 this_arg_conv.inner = (void*)(this_arg & (~1));
38618 this_arg_conv.is_owned = false;
38619 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38620 LDKPublicKey _node_id_ref;
38621 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
38622 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
38623 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
38626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) {
38627 LDKNetworkGraph this_arg_conv;
38628 this_arg_conv.inner = (void*)(this_arg & (~1));
38629 this_arg_conv.is_owned = false;
38630 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38631 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
38634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
38635 LDKNetworkGraph this_arg_conv;
38636 this_arg_conv.inner = (void*)(this_arg & (~1));
38637 this_arg_conv.is_owned = false;
38638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38639 LDKChannelUpdate msg_conv;
38640 msg_conv.inner = (void*)(msg & (~1));
38641 msg_conv.is_owned = false;
38642 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38643 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
38644 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
38645 return (uintptr_t)ret_conv;
38648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
38649 LDKNetworkGraph this_arg_conv;
38650 this_arg_conv.inner = (void*)(this_arg & (~1));
38651 this_arg_conv.is_owned = false;
38652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38653 LDKUnsignedChannelUpdate msg_conv;
38654 msg_conv.inner = (void*)(msg & (~1));
38655 msg_conv.is_owned = false;
38656 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
38657 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
38658 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
38659 return (uintptr_t)ret_conv;
38662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
38663 LDKReadOnlyNetworkGraph this_arg_conv;
38664 this_arg_conv.inner = (void*)(this_arg & (~1));
38665 this_arg_conv.is_owned = false;
38666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38667 LDKPublicKey pubkey_ref;
38668 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
38669 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
38670 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
38671 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
38672 uintptr_t ret_ref = (uintptr_t)ret_copy;
38676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38677 LDKRouteHop this_obj_conv;
38678 this_obj_conv.inner = (void*)(this_obj & (~1));
38679 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38681 RouteHop_free(this_obj_conv);
38684 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
38685 LDKRouteHop this_ptr_conv;
38686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38687 this_ptr_conv.is_owned = false;
38688 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38689 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
38690 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
38694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38695 LDKRouteHop this_ptr_conv;
38696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38697 this_ptr_conv.is_owned = false;
38698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38699 LDKPublicKey val_ref;
38700 CHECK((*env)->GetArrayLength(env, val) == 33);
38701 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
38702 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
38705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
38706 LDKRouteHop this_ptr_conv;
38707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38708 this_ptr_conv.is_owned = false;
38709 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38710 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
38711 uintptr_t ret_ref = 0;
38712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38715 ret_ref = (uintptr_t)ret_var.inner;
38716 if (ret_var.is_owned) {
38722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38723 LDKRouteHop this_ptr_conv;
38724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38725 this_ptr_conv.is_owned = false;
38726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38727 LDKNodeFeatures val_conv;
38728 val_conv.inner = (void*)(val & (~1));
38729 val_conv.is_owned = (val & 1) || (val == 0);
38730 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38731 val_conv = NodeFeatures_clone(&val_conv);
38732 RouteHop_set_node_features(&this_ptr_conv, val_conv);
38735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
38736 LDKRouteHop this_ptr_conv;
38737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38738 this_ptr_conv.is_owned = false;
38739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38740 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
38744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38745 LDKRouteHop this_ptr_conv;
38746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38747 this_ptr_conv.is_owned = false;
38748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38749 RouteHop_set_short_channel_id(&this_ptr_conv, val);
38752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
38753 LDKRouteHop this_ptr_conv;
38754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38755 this_ptr_conv.is_owned = false;
38756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38757 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
38758 uintptr_t ret_ref = 0;
38759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38762 ret_ref = (uintptr_t)ret_var.inner;
38763 if (ret_var.is_owned) {
38769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38770 LDKRouteHop this_ptr_conv;
38771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38772 this_ptr_conv.is_owned = false;
38773 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38774 LDKChannelFeatures val_conv;
38775 val_conv.inner = (void*)(val & (~1));
38776 val_conv.is_owned = (val & 1) || (val == 0);
38777 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38778 val_conv = ChannelFeatures_clone(&val_conv);
38779 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
38782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
38783 LDKRouteHop this_ptr_conv;
38784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38785 this_ptr_conv.is_owned = false;
38786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38787 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
38791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
38792 LDKRouteHop this_ptr_conv;
38793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38794 this_ptr_conv.is_owned = false;
38795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38796 RouteHop_set_fee_msat(&this_ptr_conv, val);
38799 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
38800 LDKRouteHop this_ptr_conv;
38801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38802 this_ptr_conv.is_owned = false;
38803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38804 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
38808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
38809 LDKRouteHop this_ptr_conv;
38810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38811 this_ptr_conv.is_owned = false;
38812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38813 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
38816 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) {
38817 LDKPublicKey pubkey_arg_ref;
38818 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
38819 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
38820 LDKNodeFeatures node_features_arg_conv;
38821 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
38822 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
38823 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
38824 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
38825 LDKChannelFeatures channel_features_arg_conv;
38826 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
38827 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
38828 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
38829 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
38830 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);
38831 uintptr_t ret_ref = 0;
38832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38835 ret_ref = (uintptr_t)ret_var.inner;
38836 if (ret_var.is_owned) {
38842 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
38843 LDKRouteHop ret_var = RouteHop_clone(arg);
38844 uintptr_t ret_ref = 0;
38845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38848 ret_ref = (uintptr_t)ret_var.inner;
38849 if (ret_var.is_owned) {
38854 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38855 LDKRouteHop arg_conv;
38856 arg_conv.inner = (void*)(arg & (~1));
38857 arg_conv.is_owned = false;
38858 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38859 intptr_t ret_val = RouteHop_clone_ptr(&arg_conv);
38863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38864 LDKRouteHop orig_conv;
38865 orig_conv.inner = (void*)(orig & (~1));
38866 orig_conv.is_owned = false;
38867 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38868 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
38869 uintptr_t ret_ref = 0;
38870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38873 ret_ref = (uintptr_t)ret_var.inner;
38874 if (ret_var.is_owned) {
38880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
38881 LDKRouteHop o_conv;
38882 o_conv.inner = (void*)(o & (~1));
38883 o_conv.is_owned = false;
38884 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38885 int64_t ret_val = RouteHop_hash(&o_conv);
38889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38890 LDKRouteHop a_conv;
38891 a_conv.inner = (void*)(a & (~1));
38892 a_conv.is_owned = false;
38893 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38894 LDKRouteHop b_conv;
38895 b_conv.inner = (void*)(b & (~1));
38896 b_conv.is_owned = false;
38897 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38898 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
38902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
38903 LDKRouteHop obj_conv;
38904 obj_conv.inner = (void*)(obj & (~1));
38905 obj_conv.is_owned = false;
38906 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38907 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
38908 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38909 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38910 CVec_u8Z_free(ret_var);
38914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38915 LDKu8slice ser_ref;
38916 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38917 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38918 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
38919 *ret_conv = RouteHop_read(ser_ref);
38920 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38921 return (uintptr_t)ret_conv;
38924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38925 LDKRoute this_obj_conv;
38926 this_obj_conv.inner = (void*)(this_obj & (~1));
38927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38929 Route_free(this_obj_conv);
38932 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
38933 LDKRoute this_ptr_conv;
38934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38935 this_ptr_conv.is_owned = false;
38936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38937 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
38938 jobjectArray ret_arr = NULL;
38939 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
38941 for (size_t m = 0; m < ret_var.datalen; m++) {
38942 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
38943 int64_tArray ret_conv_12_arr = NULL;
38944 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
38945 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
38946 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
38947 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
38948 uintptr_t ret_conv_12_conv_10_ref = 0;
38949 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38950 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
38952 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
38953 if (ret_conv_12_conv_10_var.is_owned) {
38954 ret_conv_12_conv_10_ref |= 1;
38956 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
38958 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
38959 FREE(ret_conv_12_var.data);
38960 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
38963 FREE(ret_var.data);
38967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
38968 LDKRoute this_ptr_conv;
38969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38970 this_ptr_conv.is_owned = false;
38971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38972 LDKCVec_CVec_RouteHopZZ val_constr;
38973 val_constr.datalen = (*env)->GetArrayLength(env, val);
38974 if (val_constr.datalen > 0)
38975 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
38977 val_constr.data = NULL;
38978 for (size_t m = 0; m < val_constr.datalen; m++) {
38979 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
38980 LDKCVec_RouteHopZ val_conv_12_constr;
38981 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
38982 if (val_conv_12_constr.datalen > 0)
38983 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
38985 val_conv_12_constr.data = NULL;
38986 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
38987 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
38988 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
38989 LDKRouteHop val_conv_12_conv_10_conv;
38990 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
38991 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
38992 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
38993 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
38994 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
38996 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
38997 val_constr.data[m] = val_conv_12_constr;
38999 Route_set_paths(&this_ptr_conv, val_constr);
39002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
39003 LDKRoute this_ptr_conv;
39004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39005 this_ptr_conv.is_owned = false;
39006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39007 LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
39008 uintptr_t ret_ref = 0;
39009 if ((uintptr_t)ret_var.inner > 4096) {
39010 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39011 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39012 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39013 ret_ref = (uintptr_t)ret_var.inner;
39014 if (ret_var.is_owned) {
39021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39022 LDKRoute this_ptr_conv;
39023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39024 this_ptr_conv.is_owned = false;
39025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39027 val_conv.inner = (void*)(val & (~1));
39028 val_conv.is_owned = (val & 1) || (val == 0);
39029 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39030 val_conv = Payee_clone(&val_conv);
39031 Route_set_payee(&this_ptr_conv, val_conv);
39034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payee_arg) {
39035 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
39036 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
39037 if (paths_arg_constr.datalen > 0)
39038 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
39040 paths_arg_constr.data = NULL;
39041 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
39042 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
39043 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
39044 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
39045 if (paths_arg_conv_12_constr.datalen > 0)
39046 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
39048 paths_arg_conv_12_constr.data = NULL;
39049 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
39050 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
39051 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
39052 LDKRouteHop paths_arg_conv_12_conv_10_conv;
39053 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
39054 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
39055 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
39056 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
39057 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
39059 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
39060 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
39062 LDKPayee payee_arg_conv;
39063 payee_arg_conv.inner = (void*)(payee_arg & (~1));
39064 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
39065 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
39066 payee_arg_conv = Payee_clone(&payee_arg_conv);
39067 LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
39068 uintptr_t ret_ref = 0;
39069 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39070 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39071 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39072 ret_ref = (uintptr_t)ret_var.inner;
39073 if (ret_var.is_owned) {
39079 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
39080 LDKRoute ret_var = Route_clone(arg);
39081 uintptr_t ret_ref = 0;
39082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39085 ret_ref = (uintptr_t)ret_var.inner;
39086 if (ret_var.is_owned) {
39091 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39093 arg_conv.inner = (void*)(arg & (~1));
39094 arg_conv.is_owned = false;
39095 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39096 intptr_t ret_val = Route_clone_ptr(&arg_conv);
39100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39101 LDKRoute orig_conv;
39102 orig_conv.inner = (void*)(orig & (~1));
39103 orig_conv.is_owned = false;
39104 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39105 LDKRoute ret_var = Route_clone(&orig_conv);
39106 uintptr_t ret_ref = 0;
39107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39110 ret_ref = (uintptr_t)ret_var.inner;
39111 if (ret_var.is_owned) {
39117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
39119 o_conv.inner = (void*)(o & (~1));
39120 o_conv.is_owned = false;
39121 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39122 int64_t ret_val = Route_hash(&o_conv);
39126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39128 a_conv.inner = (void*)(a & (~1));
39129 a_conv.is_owned = false;
39130 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39132 b_conv.inner = (void*)(b & (~1));
39133 b_conv.is_owned = false;
39134 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39135 jboolean ret_val = Route_eq(&a_conv, &b_conv);
39139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
39140 LDKRoute this_arg_conv;
39141 this_arg_conv.inner = (void*)(this_arg & (~1));
39142 this_arg_conv.is_owned = false;
39143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39144 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
39148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
39149 LDKRoute this_arg_conv;
39150 this_arg_conv.inner = (void*)(this_arg & (~1));
39151 this_arg_conv.is_owned = false;
39152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39153 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
39157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
39159 obj_conv.inner = (void*)(obj & (~1));
39160 obj_conv.is_owned = false;
39161 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39162 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
39163 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39164 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39165 CVec_u8Z_free(ret_var);
39169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39170 LDKu8slice ser_ref;
39171 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39172 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39173 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
39174 *ret_conv = Route_read(ser_ref);
39175 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39176 return (uintptr_t)ret_conv;
39179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39180 LDKRouteParameters this_obj_conv;
39181 this_obj_conv.inner = (void*)(this_obj & (~1));
39182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39184 RouteParameters_free(this_obj_conv);
39187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
39188 LDKRouteParameters this_ptr_conv;
39189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39190 this_ptr_conv.is_owned = false;
39191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39192 LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
39193 uintptr_t ret_ref = 0;
39194 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39195 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39196 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39197 ret_ref = (uintptr_t)ret_var.inner;
39198 if (ret_var.is_owned) {
39204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39205 LDKRouteParameters this_ptr_conv;
39206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39207 this_ptr_conv.is_owned = false;
39208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39210 val_conv.inner = (void*)(val & (~1));
39211 val_conv.is_owned = (val & 1) || (val == 0);
39212 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39213 val_conv = Payee_clone(&val_conv);
39214 RouteParameters_set_payee(&this_ptr_conv, val_conv);
39217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39218 LDKRouteParameters this_ptr_conv;
39219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39220 this_ptr_conv.is_owned = false;
39221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39222 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
39226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39227 LDKRouteParameters this_ptr_conv;
39228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39229 this_ptr_conv.is_owned = false;
39230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39231 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
39234 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39235 LDKRouteParameters this_ptr_conv;
39236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39237 this_ptr_conv.is_owned = false;
39238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39239 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
39243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39244 LDKRouteParameters this_ptr_conv;
39245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39246 this_ptr_conv.is_owned = false;
39247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39248 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
39251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
39252 LDKPayee payee_arg_conv;
39253 payee_arg_conv.inner = (void*)(payee_arg & (~1));
39254 payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
39255 CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_arg_conv);
39256 payee_arg_conv = Payee_clone(&payee_arg_conv);
39257 LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
39258 uintptr_t ret_ref = 0;
39259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39262 ret_ref = (uintptr_t)ret_var.inner;
39263 if (ret_var.is_owned) {
39269 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
39270 LDKRouteParameters ret_var = RouteParameters_clone(arg);
39271 uintptr_t ret_ref = 0;
39272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39275 ret_ref = (uintptr_t)ret_var.inner;
39276 if (ret_var.is_owned) {
39281 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39282 LDKRouteParameters arg_conv;
39283 arg_conv.inner = (void*)(arg & (~1));
39284 arg_conv.is_owned = false;
39285 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39286 intptr_t ret_val = RouteParameters_clone_ptr(&arg_conv);
39290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39291 LDKRouteParameters orig_conv;
39292 orig_conv.inner = (void*)(orig & (~1));
39293 orig_conv.is_owned = false;
39294 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39295 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
39296 uintptr_t ret_ref = 0;
39297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39300 ret_ref = (uintptr_t)ret_var.inner;
39301 if (ret_var.is_owned) {
39307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
39308 LDKRouteParameters obj_conv;
39309 obj_conv.inner = (void*)(obj & (~1));
39310 obj_conv.is_owned = false;
39311 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39312 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
39313 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39314 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39315 CVec_u8Z_free(ret_var);
39319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39320 LDKu8slice ser_ref;
39321 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39322 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39323 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
39324 *ret_conv = RouteParameters_read(ser_ref);
39325 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39326 return (uintptr_t)ret_conv;
39329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39330 LDKPayee this_obj_conv;
39331 this_obj_conv.inner = (void*)(this_obj & (~1));
39332 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39334 Payee_free(this_obj_conv);
39337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
39338 LDKPayee this_ptr_conv;
39339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39340 this_ptr_conv.is_owned = false;
39341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39342 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39343 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Payee_get_pubkey(&this_ptr_conv).compressed_form);
39347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39348 LDKPayee this_ptr_conv;
39349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39350 this_ptr_conv.is_owned = false;
39351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39352 LDKPublicKey val_ref;
39353 CHECK((*env)->GetArrayLength(env, val) == 33);
39354 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39355 Payee_set_pubkey(&this_ptr_conv, val_ref);
39358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
39359 LDKPayee this_ptr_conv;
39360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39361 this_ptr_conv.is_owned = false;
39362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39363 LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
39364 uintptr_t ret_ref = 0;
39365 if ((uintptr_t)ret_var.inner > 4096) {
39366 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39367 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39369 ret_ref = (uintptr_t)ret_var.inner;
39370 if (ret_var.is_owned) {
39377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39378 LDKPayee this_ptr_conv;
39379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39380 this_ptr_conv.is_owned = false;
39381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39382 LDKInvoiceFeatures val_conv;
39383 val_conv.inner = (void*)(val & (~1));
39384 val_conv.is_owned = (val & 1) || (val == 0);
39385 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39386 val_conv = InvoiceFeatures_clone(&val_conv);
39387 Payee_set_features(&this_ptr_conv, val_conv);
39390 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
39391 LDKPayee this_ptr_conv;
39392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39393 this_ptr_conv.is_owned = false;
39394 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39395 LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
39396 int64_tArray ret_arr = NULL;
39397 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
39398 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
39399 for (size_t l = 0; l < ret_var.datalen; l++) {
39400 LDKRouteHint ret_conv_11_var = ret_var.data[l];
39401 uintptr_t ret_conv_11_ref = 0;
39402 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39403 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
39405 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
39406 if (ret_conv_11_var.is_owned) {
39407 ret_conv_11_ref |= 1;
39409 ret_arr_ptr[l] = ret_conv_11_ref;
39411 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
39412 FREE(ret_var.data);
39416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
39417 LDKPayee this_ptr_conv;
39418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39419 this_ptr_conv.is_owned = false;
39420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39421 LDKCVec_RouteHintZ val_constr;
39422 val_constr.datalen = (*env)->GetArrayLength(env, val);
39423 if (val_constr.datalen > 0)
39424 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
39426 val_constr.data = NULL;
39427 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
39428 for (size_t l = 0; l < val_constr.datalen; l++) {
39429 int64_t val_conv_11 = val_vals[l];
39430 LDKRouteHint val_conv_11_conv;
39431 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
39432 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
39433 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
39434 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
39435 val_constr.data[l] = val_conv_11_conv;
39437 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
39438 Payee_set_route_hints(&this_ptr_conv, val_constr);
39441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
39442 LDKPayee this_ptr_conv;
39443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39444 this_ptr_conv.is_owned = false;
39445 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39446 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39447 *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
39448 uintptr_t ret_ref = (uintptr_t)ret_copy;
39452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39453 LDKPayee this_ptr_conv;
39454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39455 this_ptr_conv.is_owned = false;
39456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39457 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39458 CHECK_ACCESS(val_ptr);
39459 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39460 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39461 Payee_set_expiry_time(&this_ptr_conv, val_conv);
39464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg) {
39465 LDKPublicKey pubkey_arg_ref;
39466 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
39467 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
39468 LDKInvoiceFeatures features_arg_conv;
39469 features_arg_conv.inner = (void*)(features_arg & (~1));
39470 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
39471 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
39472 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
39473 LDKCVec_RouteHintZ route_hints_arg_constr;
39474 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
39475 if (route_hints_arg_constr.datalen > 0)
39476 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
39478 route_hints_arg_constr.data = NULL;
39479 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
39480 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
39481 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
39482 LDKRouteHint route_hints_arg_conv_11_conv;
39483 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
39484 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
39485 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
39486 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
39487 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
39489 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
39490 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
39491 CHECK_ACCESS(expiry_time_arg_ptr);
39492 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
39493 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
39494 LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
39495 uintptr_t ret_ref = 0;
39496 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39497 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39499 ret_ref = (uintptr_t)ret_var.inner;
39500 if (ret_var.is_owned) {
39506 static inline uintptr_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
39507 LDKPayee ret_var = Payee_clone(arg);
39508 uintptr_t ret_ref = 0;
39509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39512 ret_ref = (uintptr_t)ret_var.inner;
39513 if (ret_var.is_owned) {
39518 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39520 arg_conv.inner = (void*)(arg & (~1));
39521 arg_conv.is_owned = false;
39522 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39523 intptr_t ret_val = Payee_clone_ptr(&arg_conv);
39527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39528 LDKPayee orig_conv;
39529 orig_conv.inner = (void*)(orig & (~1));
39530 orig_conv.is_owned = false;
39531 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39532 LDKPayee ret_var = Payee_clone(&orig_conv);
39533 uintptr_t ret_ref = 0;
39534 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39535 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39537 ret_ref = (uintptr_t)ret_var.inner;
39538 if (ret_var.is_owned) {
39544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
39546 o_conv.inner = (void*)(o & (~1));
39547 o_conv.is_owned = false;
39548 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39549 int64_t ret_val = Payee_hash(&o_conv);
39553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39555 a_conv.inner = (void*)(a & (~1));
39556 a_conv.is_owned = false;
39557 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39559 b_conv.inner = (void*)(b & (~1));
39560 b_conv.is_owned = false;
39561 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39562 jboolean ret_val = Payee_eq(&a_conv, &b_conv);
39566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payee_1write(JNIEnv *env, jclass clz, int64_t obj) {
39568 obj_conv.inner = (void*)(obj & (~1));
39569 obj_conv.is_owned = false;
39570 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39571 LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
39572 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39573 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39574 CVec_u8Z_free(ret_var);
39578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39579 LDKu8slice ser_ref;
39580 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39581 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39582 LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
39583 *ret_conv = Payee_read(ser_ref);
39584 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39585 return (uintptr_t)ret_conv;
39588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray pubkey) {
39589 LDKPublicKey pubkey_ref;
39590 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
39591 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
39592 LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
39593 uintptr_t ret_ref = 0;
39594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39597 ret_ref = (uintptr_t)ret_var.inner;
39598 if (ret_var.is_owned) {
39604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray pubkey) {
39605 LDKPublicKey pubkey_ref;
39606 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
39607 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
39608 LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
39609 uintptr_t ret_ref = 0;
39610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39613 ret_ref = (uintptr_t)ret_var.inner;
39614 if (ret_var.is_owned) {
39620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39621 LDKRouteHint this_obj_conv;
39622 this_obj_conv.inner = (void*)(this_obj & (~1));
39623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39625 RouteHint_free(this_obj_conv);
39628 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
39629 LDKRouteHint this_ptr_conv;
39630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39631 this_ptr_conv.is_owned = false;
39632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39633 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
39634 int64_tArray ret_arr = NULL;
39635 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
39636 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
39637 for (size_t o = 0; o < ret_var.datalen; o++) {
39638 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
39639 uintptr_t ret_conv_14_ref = 0;
39640 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39641 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
39643 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
39644 if (ret_conv_14_var.is_owned) {
39645 ret_conv_14_ref |= 1;
39647 ret_arr_ptr[o] = ret_conv_14_ref;
39649 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
39650 FREE(ret_var.data);
39654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
39655 LDKRouteHint this_ptr_conv;
39656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39657 this_ptr_conv.is_owned = false;
39658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39659 LDKCVec_RouteHintHopZ val_constr;
39660 val_constr.datalen = (*env)->GetArrayLength(env, val);
39661 if (val_constr.datalen > 0)
39662 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
39664 val_constr.data = NULL;
39665 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
39666 for (size_t o = 0; o < val_constr.datalen; o++) {
39667 int64_t val_conv_14 = val_vals[o];
39668 LDKRouteHintHop val_conv_14_conv;
39669 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
39670 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
39671 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
39672 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
39673 val_constr.data[o] = val_conv_14_conv;
39675 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
39676 RouteHint_set_a(&this_ptr_conv, val_constr);
39679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
39680 LDKCVec_RouteHintHopZ a_arg_constr;
39681 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
39682 if (a_arg_constr.datalen > 0)
39683 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
39685 a_arg_constr.data = NULL;
39686 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
39687 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
39688 int64_t a_arg_conv_14 = a_arg_vals[o];
39689 LDKRouteHintHop a_arg_conv_14_conv;
39690 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
39691 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
39692 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
39693 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
39694 a_arg_constr.data[o] = a_arg_conv_14_conv;
39696 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
39697 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
39698 uintptr_t ret_ref = 0;
39699 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39700 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39701 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39702 ret_ref = (uintptr_t)ret_var.inner;
39703 if (ret_var.is_owned) {
39709 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
39710 LDKRouteHint ret_var = RouteHint_clone(arg);
39711 uintptr_t ret_ref = 0;
39712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39715 ret_ref = (uintptr_t)ret_var.inner;
39716 if (ret_var.is_owned) {
39721 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39722 LDKRouteHint arg_conv;
39723 arg_conv.inner = (void*)(arg & (~1));
39724 arg_conv.is_owned = false;
39725 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39726 intptr_t ret_val = RouteHint_clone_ptr(&arg_conv);
39730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39731 LDKRouteHint orig_conv;
39732 orig_conv.inner = (void*)(orig & (~1));
39733 orig_conv.is_owned = false;
39734 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39735 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
39736 uintptr_t ret_ref = 0;
39737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39740 ret_ref = (uintptr_t)ret_var.inner;
39741 if (ret_var.is_owned) {
39747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
39748 LDKRouteHint o_conv;
39749 o_conv.inner = (void*)(o & (~1));
39750 o_conv.is_owned = false;
39751 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39752 int64_t ret_val = RouteHint_hash(&o_conv);
39756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
39757 LDKRouteHint a_conv;
39758 a_conv.inner = (void*)(a & (~1));
39759 a_conv.is_owned = false;
39760 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39761 LDKRouteHint b_conv;
39762 b_conv.inner = (void*)(b & (~1));
39763 b_conv.is_owned = false;
39764 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39765 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
39769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
39770 LDKRouteHint obj_conv;
39771 obj_conv.inner = (void*)(obj & (~1));
39772 obj_conv.is_owned = false;
39773 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39774 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
39775 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39776 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39777 CVec_u8Z_free(ret_var);
39781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39782 LDKu8slice ser_ref;
39783 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39784 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39785 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
39786 *ret_conv = RouteHint_read(ser_ref);
39787 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39788 return (uintptr_t)ret_conv;
39791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39792 LDKRouteHintHop this_obj_conv;
39793 this_obj_conv.inner = (void*)(this_obj & (~1));
39794 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39795 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39796 RouteHintHop_free(this_obj_conv);
39799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39800 LDKRouteHintHop this_ptr_conv;
39801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39802 this_ptr_conv.is_owned = false;
39803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39804 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39805 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
39809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39810 LDKRouteHintHop this_ptr_conv;
39811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39812 this_ptr_conv.is_owned = false;
39813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39814 LDKPublicKey val_ref;
39815 CHECK((*env)->GetArrayLength(env, val) == 33);
39816 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
39817 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
39820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
39821 LDKRouteHintHop this_ptr_conv;
39822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39823 this_ptr_conv.is_owned = false;
39824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39825 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
39829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39830 LDKRouteHintHop this_ptr_conv;
39831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39832 this_ptr_conv.is_owned = false;
39833 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39834 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
39837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
39838 LDKRouteHintHop this_ptr_conv;
39839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39840 this_ptr_conv.is_owned = false;
39841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39842 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
39843 uintptr_t ret_ref = 0;
39844 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39845 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39847 ret_ref = (uintptr_t)ret_var.inner;
39848 if (ret_var.is_owned) {
39854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39855 LDKRouteHintHop this_ptr_conv;
39856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39857 this_ptr_conv.is_owned = false;
39858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39859 LDKRoutingFees val_conv;
39860 val_conv.inner = (void*)(val & (~1));
39861 val_conv.is_owned = (val & 1) || (val == 0);
39862 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39863 val_conv = RoutingFees_clone(&val_conv);
39864 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
39867 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39868 LDKRouteHintHop this_ptr_conv;
39869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39870 this_ptr_conv.is_owned = false;
39871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39872 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
39876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39877 LDKRouteHintHop this_ptr_conv;
39878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39879 this_ptr_conv.is_owned = false;
39880 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39881 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
39884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39885 LDKRouteHintHop this_ptr_conv;
39886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39887 this_ptr_conv.is_owned = false;
39888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39889 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39890 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
39891 uintptr_t ret_ref = (uintptr_t)ret_copy;
39895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39896 LDKRouteHintHop this_ptr_conv;
39897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39898 this_ptr_conv.is_owned = false;
39899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39900 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39901 CHECK_ACCESS(val_ptr);
39902 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39903 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39904 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
39907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39908 LDKRouteHintHop this_ptr_conv;
39909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39910 this_ptr_conv.is_owned = false;
39911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39912 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39913 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
39914 uintptr_t ret_ref = (uintptr_t)ret_copy;
39918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39919 LDKRouteHintHop this_ptr_conv;
39920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39921 this_ptr_conv.is_owned = false;
39922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39923 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39924 CHECK_ACCESS(val_ptr);
39925 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39926 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39927 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
39930 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) {
39931 LDKPublicKey src_node_id_arg_ref;
39932 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
39933 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
39934 LDKRoutingFees fees_arg_conv;
39935 fees_arg_conv.inner = (void*)(fees_arg & (~1));
39936 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
39937 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
39938 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
39939 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
39940 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
39941 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
39942 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
39943 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
39944 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
39945 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
39946 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
39947 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);
39948 uintptr_t ret_ref = 0;
39949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39952 ret_ref = (uintptr_t)ret_var.inner;
39953 if (ret_var.is_owned) {
39959 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
39960 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
39961 uintptr_t ret_ref = 0;
39962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39963 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39964 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39965 ret_ref = (uintptr_t)ret_var.inner;
39966 if (ret_var.is_owned) {
39971 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39972 LDKRouteHintHop arg_conv;
39973 arg_conv.inner = (void*)(arg & (~1));
39974 arg_conv.is_owned = false;
39975 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39976 intptr_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
39980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39981 LDKRouteHintHop orig_conv;
39982 orig_conv.inner = (void*)(orig & (~1));
39983 orig_conv.is_owned = false;
39984 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39985 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
39986 uintptr_t ret_ref = 0;
39987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39990 ret_ref = (uintptr_t)ret_var.inner;
39991 if (ret_var.is_owned) {
39997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
39998 LDKRouteHintHop o_conv;
39999 o_conv.inner = (void*)(o & (~1));
40000 o_conv.is_owned = false;
40001 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40002 int64_t ret_val = RouteHintHop_hash(&o_conv);
40006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40007 LDKRouteHintHop a_conv;
40008 a_conv.inner = (void*)(a & (~1));
40009 a_conv.is_owned = false;
40010 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40011 LDKRouteHintHop b_conv;
40012 b_conv.inner = (void*)(b & (~1));
40013 b_conv.is_owned = false;
40014 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40015 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
40019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
40020 LDKRouteHintHop obj_conv;
40021 obj_conv.inner = (void*)(obj & (~1));
40022 obj_conv.is_owned = false;
40023 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40024 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
40025 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40026 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40027 CVec_u8Z_free(ret_var);
40031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40032 LDKu8slice ser_ref;
40033 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40034 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40035 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
40036 *ret_conv = RouteHintHop_read(ser_ref);
40037 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40038 return (uintptr_t)ret_conv;
40041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) {
40042 LDKPublicKey our_node_pubkey_ref;
40043 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
40044 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
40045 LDKRouteParameters params_conv;
40046 params_conv.inner = (void*)(params & (~1));
40047 params_conv.is_owned = false;
40048 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
40049 LDKNetworkGraph network_conv;
40050 network_conv.inner = (void*)(network & (~1));
40051 network_conv.is_owned = false;
40052 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
40053 LDKCVec_ChannelDetailsZ first_hops_constr;
40054 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
40055 if (first_hops != NULL) {
40056 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
40057 if (first_hops_constr.datalen > 0)
40058 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
40060 first_hops_constr.data = NULL;
40061 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
40062 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
40063 int64_t first_hops_conv_16 = first_hops_vals[q];
40064 LDKChannelDetails first_hops_conv_16_conv;
40065 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
40066 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
40067 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
40068 first_hops_constr.data[q] = first_hops_conv_16_conv;
40070 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
40071 first_hops_ptr = &first_hops_constr;
40073 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
40074 CHECK_ACCESS(logger_ptr);
40075 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40076 if (logger_conv.free == LDKLogger_JCalls_free) {
40077 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40078 LDKLogger_JCalls_cloned(&logger_conv);
40080 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
40081 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
40082 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
40083 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
40084 *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
40085 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
40086 return (uintptr_t)ret_conv;
40089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40090 if ((this_ptr & 1) != 0) return;
40091 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40092 CHECK_ACCESS(this_ptr_ptr);
40093 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
40094 FREE((void*)this_ptr);
40095 Score_free(this_ptr_conv);
40098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40099 if ((this_ptr & 1) != 0) return;
40100 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40101 CHECK_ACCESS(this_ptr_ptr);
40102 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
40103 FREE((void*)this_ptr);
40104 LockableScore_free(this_ptr_conv);
40107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40108 LDKMultiThreadedLockableScore this_obj_conv;
40109 this_obj_conv.inner = (void*)(this_obj & (~1));
40110 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40112 MultiThreadedLockableScore_free(this_obj_conv);
40115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
40116 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
40117 CHECK_ACCESS(score_ptr);
40118 LDKScore score_conv = *(LDKScore*)(score_ptr);
40119 if (score_conv.free == LDKScore_JCalls_free) {
40120 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40121 LDKScore_JCalls_cloned(&score_conv);
40123 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
40124 uintptr_t ret_ref = 0;
40125 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40126 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40127 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40128 ret_ref = (uintptr_t)ret_var.inner;
40129 if (ret_var.is_owned) {
40135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40136 LDKScorer this_obj_conv;
40137 this_obj_conv.inner = (void*)(this_obj & (~1));
40138 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40140 Scorer_free(this_obj_conv);
40143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40144 LDKScoringParameters this_obj_conv;
40145 this_obj_conv.inner = (void*)(this_obj & (~1));
40146 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40147 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40148 ScoringParameters_free(this_obj_conv);
40151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40152 LDKScoringParameters this_ptr_conv;
40153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40154 this_ptr_conv.is_owned = false;
40155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40156 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
40160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40161 LDKScoringParameters this_ptr_conv;
40162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40163 this_ptr_conv.is_owned = false;
40164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40165 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
40168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40169 LDKScoringParameters this_ptr_conv;
40170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40171 this_ptr_conv.is_owned = false;
40172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40173 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
40177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40178 LDKScoringParameters this_ptr_conv;
40179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40180 this_ptr_conv.is_owned = false;
40181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40182 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
40185 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
40186 LDKScoringParameters this_ptr_conv;
40187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40188 this_ptr_conv.is_owned = false;
40189 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40190 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
40194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40195 LDKScoringParameters this_ptr_conv;
40196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40197 this_ptr_conv.is_owned = false;
40198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40199 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
40202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
40203 LDKScoringParameters this_ptr_conv;
40204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40205 this_ptr_conv.is_owned = false;
40206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40207 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
40211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40212 LDKScoringParameters this_ptr_conv;
40213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40214 this_ptr_conv.is_owned = false;
40215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40216 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
40219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
40220 LDKScoringParameters this_ptr_conv;
40221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40222 this_ptr_conv.is_owned = false;
40223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40224 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
40228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40229 LDKScoringParameters this_ptr_conv;
40230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40231 this_ptr_conv.is_owned = false;
40232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40233 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
40236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) {
40237 LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg);
40238 uintptr_t ret_ref = 0;
40239 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40240 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40241 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40242 ret_ref = (uintptr_t)ret_var.inner;
40243 if (ret_var.is_owned) {
40249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
40250 LDKScoringParameters obj_conv;
40251 obj_conv.inner = (void*)(obj & (~1));
40252 obj_conv.is_owned = false;
40253 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40254 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
40255 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40256 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40257 CVec_u8Z_free(ret_var);
40261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40262 LDKu8slice ser_ref;
40263 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40264 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40265 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
40266 *ret_conv = ScoringParameters_read(ser_ref);
40267 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40268 return (uintptr_t)ret_conv;
40271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) {
40272 LDKScoringParameters params_conv;
40273 params_conv.inner = (void*)(params & (~1));
40274 params_conv.is_owned = (params & 1) || (params == 0);
40275 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
40276 // Warning: we need a move here but no clone is available for LDKScoringParameters
40277 LDKScorer ret_var = Scorer_new(params_conv);
40278 uintptr_t ret_ref = 0;
40279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40282 ret_ref = (uintptr_t)ret_var.inner;
40283 if (ret_var.is_owned) {
40289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
40290 LDKScorer ret_var = Scorer_default();
40291 uintptr_t ret_ref = 0;
40292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40295 ret_ref = (uintptr_t)ret_var.inner;
40296 if (ret_var.is_owned) {
40302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) {
40303 LDKScoringParameters ret_var = ScoringParameters_default();
40304 uintptr_t ret_ref = 0;
40305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40308 ret_ref = (uintptr_t)ret_var.inner;
40309 if (ret_var.is_owned) {
40315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
40316 LDKScorer this_arg_conv;
40317 this_arg_conv.inner = (void*)(this_arg & (~1));
40318 this_arg_conv.is_owned = false;
40319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40320 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
40321 *ret_ret = Scorer_as_Score(&this_arg_conv);
40322 return (uintptr_t)ret_ret;
40325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
40326 LDKScorer obj_conv;
40327 obj_conv.inner = (void*)(obj & (~1));
40328 obj_conv.is_owned = false;
40329 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40330 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
40331 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40332 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40333 CVec_u8Z_free(ret_var);
40337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40338 LDKu8slice ser_ref;
40339 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40340 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40341 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
40342 *ret_conv = Scorer_read(ser_ref);
40343 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40344 return (uintptr_t)ret_conv;
40347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40348 LDKFilesystemPersister this_obj_conv;
40349 this_obj_conv.inner = (void*)(this_obj & (~1));
40350 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40351 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40352 FilesystemPersister_free(this_obj_conv);
40355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
40356 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
40357 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
40358 uintptr_t ret_ref = 0;
40359 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40360 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40361 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40362 ret_ref = (uintptr_t)ret_var.inner;
40363 if (ret_var.is_owned) {
40369 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
40370 LDKFilesystemPersister this_arg_conv;
40371 this_arg_conv.inner = (void*)(this_arg & (~1));
40372 this_arg_conv.is_owned = false;
40373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40374 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
40375 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
40380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
40381 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
40382 LDKChannelManager manager_conv;
40383 manager_conv.inner = (void*)(manager & (~1));
40384 manager_conv.is_owned = false;
40385 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
40386 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
40387 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
40388 return (uintptr_t)ret_conv;
40391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
40392 LDKFilesystemPersister this_arg_conv;
40393 this_arg_conv.inner = (void*)(this_arg & (~1));
40394 this_arg_conv.is_owned = false;
40395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40396 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
40397 CHECK_ACCESS(keys_manager_ptr);
40398 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
40399 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
40400 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40401 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
40403 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
40404 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
40405 return (uintptr_t)ret_conv;
40408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
40409 LDKFilesystemPersister this_arg_conv;
40410 this_arg_conv.inner = (void*)(this_arg & (~1));
40411 this_arg_conv.is_owned = false;
40412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40413 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
40414 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
40415 return (uintptr_t)ret_ret;
40418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40419 LDKBackgroundProcessor this_obj_conv;
40420 this_obj_conv.inner = (void*)(this_obj & (~1));
40421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40423 BackgroundProcessor_free(this_obj_conv);
40426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40427 if ((this_ptr & 1) != 0) return;
40428 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40429 CHECK_ACCESS(this_ptr_ptr);
40430 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
40431 FREE((void*)this_ptr);
40432 ChannelManagerPersister_free(this_ptr_conv);
40435 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) {
40436 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
40437 CHECK_ACCESS(persister_ptr);
40438 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
40439 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
40440 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40441 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
40443 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
40444 CHECK_ACCESS(event_handler_ptr);
40445 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
40446 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
40447 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40448 LDKEventHandler_JCalls_cloned(&event_handler_conv);
40450 LDKChainMonitor chain_monitor_conv;
40451 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
40452 chain_monitor_conv.is_owned = false;
40453 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
40454 LDKChannelManager channel_manager_conv;
40455 channel_manager_conv.inner = (void*)(channel_manager & (~1));
40456 channel_manager_conv.is_owned = false;
40457 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
40458 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
40459 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
40460 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
40461 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
40462 LDKPeerManager peer_manager_conv;
40463 peer_manager_conv.inner = (void*)(peer_manager & (~1));
40464 peer_manager_conv.is_owned = false;
40465 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
40466 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
40467 CHECK_ACCESS(logger_ptr);
40468 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40469 if (logger_conv.free == LDKLogger_JCalls_free) {
40470 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40471 LDKLogger_JCalls_cloned(&logger_conv);
40473 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);
40474 uintptr_t ret_ref = 0;
40475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40478 ret_ref = (uintptr_t)ret_var.inner;
40479 if (ret_var.is_owned) {
40485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
40486 LDKBackgroundProcessor this_arg_conv;
40487 this_arg_conv.inner = (void*)(this_arg & (~1));
40488 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40490 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
40491 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
40492 *ret_conv = BackgroundProcessor_join(this_arg_conv);
40493 return (uintptr_t)ret_conv;
40496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
40497 LDKBackgroundProcessor this_arg_conv;
40498 this_arg_conv.inner = (void*)(this_arg & (~1));
40499 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
40500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40501 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
40502 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
40503 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
40504 return (uintptr_t)ret_conv;
40507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
40511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40512 LDKInvoice this_obj_conv;
40513 this_obj_conv.inner = (void*)(this_obj & (~1));
40514 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40516 Invoice_free(this_obj_conv);
40519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40521 a_conv.inner = (void*)(a & (~1));
40522 a_conv.is_owned = false;
40523 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40525 b_conv.inner = (void*)(b & (~1));
40526 b_conv.is_owned = false;
40527 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40528 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
40532 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
40533 LDKInvoice ret_var = Invoice_clone(arg);
40534 uintptr_t ret_ref = 0;
40535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40538 ret_ref = (uintptr_t)ret_var.inner;
40539 if (ret_var.is_owned) {
40544 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40545 LDKInvoice arg_conv;
40546 arg_conv.inner = (void*)(arg & (~1));
40547 arg_conv.is_owned = false;
40548 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40549 intptr_t ret_val = Invoice_clone_ptr(&arg_conv);
40553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40554 LDKInvoice orig_conv;
40555 orig_conv.inner = (void*)(orig & (~1));
40556 orig_conv.is_owned = false;
40557 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40558 LDKInvoice ret_var = Invoice_clone(&orig_conv);
40559 uintptr_t ret_ref = 0;
40560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40563 ret_ref = (uintptr_t)ret_var.inner;
40564 if (ret_var.is_owned) {
40570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40571 LDKSignedRawInvoice this_obj_conv;
40572 this_obj_conv.inner = (void*)(this_obj & (~1));
40573 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40575 SignedRawInvoice_free(this_obj_conv);
40578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40579 LDKSignedRawInvoice a_conv;
40580 a_conv.inner = (void*)(a & (~1));
40581 a_conv.is_owned = false;
40582 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40583 LDKSignedRawInvoice b_conv;
40584 b_conv.inner = (void*)(b & (~1));
40585 b_conv.is_owned = false;
40586 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40587 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
40591 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
40592 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
40593 uintptr_t ret_ref = 0;
40594 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40595 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40596 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40597 ret_ref = (uintptr_t)ret_var.inner;
40598 if (ret_var.is_owned) {
40603 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40604 LDKSignedRawInvoice arg_conv;
40605 arg_conv.inner = (void*)(arg & (~1));
40606 arg_conv.is_owned = false;
40607 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40608 intptr_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
40612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40613 LDKSignedRawInvoice orig_conv;
40614 orig_conv.inner = (void*)(orig & (~1));
40615 orig_conv.is_owned = false;
40616 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40617 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
40618 uintptr_t ret_ref = 0;
40619 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40620 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40622 ret_ref = (uintptr_t)ret_var.inner;
40623 if (ret_var.is_owned) {
40629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40630 LDKRawInvoice this_obj_conv;
40631 this_obj_conv.inner = (void*)(this_obj & (~1));
40632 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40634 RawInvoice_free(this_obj_conv);
40637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
40638 LDKRawInvoice this_ptr_conv;
40639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40640 this_ptr_conv.is_owned = false;
40641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40642 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
40643 uintptr_t ret_ref = 0;
40644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40647 ret_ref = (uintptr_t)ret_var.inner;
40648 if (ret_var.is_owned) {
40654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40655 LDKRawInvoice this_ptr_conv;
40656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40657 this_ptr_conv.is_owned = false;
40658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40659 LDKRawDataPart val_conv;
40660 val_conv.inner = (void*)(val & (~1));
40661 val_conv.is_owned = (val & 1) || (val == 0);
40662 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40663 val_conv = RawDataPart_clone(&val_conv);
40664 RawInvoice_set_data(&this_ptr_conv, val_conv);
40667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40668 LDKRawInvoice a_conv;
40669 a_conv.inner = (void*)(a & (~1));
40670 a_conv.is_owned = false;
40671 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40672 LDKRawInvoice b_conv;
40673 b_conv.inner = (void*)(b & (~1));
40674 b_conv.is_owned = false;
40675 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40676 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
40680 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
40681 LDKRawInvoice ret_var = RawInvoice_clone(arg);
40682 uintptr_t ret_ref = 0;
40683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40686 ret_ref = (uintptr_t)ret_var.inner;
40687 if (ret_var.is_owned) {
40692 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40693 LDKRawInvoice arg_conv;
40694 arg_conv.inner = (void*)(arg & (~1));
40695 arg_conv.is_owned = false;
40696 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40697 intptr_t ret_val = RawInvoice_clone_ptr(&arg_conv);
40701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40702 LDKRawInvoice orig_conv;
40703 orig_conv.inner = (void*)(orig & (~1));
40704 orig_conv.is_owned = false;
40705 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40706 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
40707 uintptr_t ret_ref = 0;
40708 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40709 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40710 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40711 ret_ref = (uintptr_t)ret_var.inner;
40712 if (ret_var.is_owned) {
40718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40719 LDKRawDataPart this_obj_conv;
40720 this_obj_conv.inner = (void*)(this_obj & (~1));
40721 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40722 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40723 RawDataPart_free(this_obj_conv);
40726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
40727 LDKRawDataPart this_ptr_conv;
40728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40729 this_ptr_conv.is_owned = false;
40730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40731 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
40732 uintptr_t ret_ref = 0;
40733 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40734 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40735 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40736 ret_ref = (uintptr_t)ret_var.inner;
40737 if (ret_var.is_owned) {
40743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40744 LDKRawDataPart this_ptr_conv;
40745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40746 this_ptr_conv.is_owned = false;
40747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40748 LDKPositiveTimestamp val_conv;
40749 val_conv.inner = (void*)(val & (~1));
40750 val_conv.is_owned = (val & 1) || (val == 0);
40751 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40752 val_conv = PositiveTimestamp_clone(&val_conv);
40753 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
40756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40757 LDKRawDataPart a_conv;
40758 a_conv.inner = (void*)(a & (~1));
40759 a_conv.is_owned = false;
40760 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40761 LDKRawDataPart b_conv;
40762 b_conv.inner = (void*)(b & (~1));
40763 b_conv.is_owned = false;
40764 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40765 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
40769 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
40770 LDKRawDataPart ret_var = RawDataPart_clone(arg);
40771 uintptr_t ret_ref = 0;
40772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40775 ret_ref = (uintptr_t)ret_var.inner;
40776 if (ret_var.is_owned) {
40781 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40782 LDKRawDataPart arg_conv;
40783 arg_conv.inner = (void*)(arg & (~1));
40784 arg_conv.is_owned = false;
40785 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40786 intptr_t ret_val = RawDataPart_clone_ptr(&arg_conv);
40790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40791 LDKRawDataPart orig_conv;
40792 orig_conv.inner = (void*)(orig & (~1));
40793 orig_conv.is_owned = false;
40794 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40795 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
40796 uintptr_t ret_ref = 0;
40797 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40798 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40800 ret_ref = (uintptr_t)ret_var.inner;
40801 if (ret_var.is_owned) {
40807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40808 LDKPositiveTimestamp this_obj_conv;
40809 this_obj_conv.inner = (void*)(this_obj & (~1));
40810 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40811 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40812 PositiveTimestamp_free(this_obj_conv);
40815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40816 LDKPositiveTimestamp a_conv;
40817 a_conv.inner = (void*)(a & (~1));
40818 a_conv.is_owned = false;
40819 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40820 LDKPositiveTimestamp b_conv;
40821 b_conv.inner = (void*)(b & (~1));
40822 b_conv.is_owned = false;
40823 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40824 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
40828 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
40829 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
40830 uintptr_t ret_ref = 0;
40831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40834 ret_ref = (uintptr_t)ret_var.inner;
40835 if (ret_var.is_owned) {
40840 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40841 LDKPositiveTimestamp arg_conv;
40842 arg_conv.inner = (void*)(arg & (~1));
40843 arg_conv.is_owned = false;
40844 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40845 intptr_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
40849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40850 LDKPositiveTimestamp orig_conv;
40851 orig_conv.inner = (void*)(orig & (~1));
40852 orig_conv.is_owned = false;
40853 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40854 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
40855 uintptr_t ret_ref = 0;
40856 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40857 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40859 ret_ref = (uintptr_t)ret_var.inner;
40860 if (ret_var.is_owned) {
40866 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40867 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
40868 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
40872 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
40873 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
40877 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
40878 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
40882 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
40883 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
40887 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
40888 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
40892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40893 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
40894 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
40895 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
40899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
40900 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
40901 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
40905 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40906 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
40907 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
40911 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
40912 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
40916 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
40917 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
40921 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
40922 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
40926 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
40927 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
40931 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
40932 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
40936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
40937 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
40938 int64_t ret_val = Currency_hash(o_conv);
40942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40943 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
40944 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
40945 jboolean ret_val = Currency_eq(a_conv, b_conv);
40949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40950 LDKSha256 this_obj_conv;
40951 this_obj_conv.inner = (void*)(this_obj & (~1));
40952 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40953 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40954 Sha256_free(this_obj_conv);
40957 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
40958 LDKSha256 ret_var = Sha256_clone(arg);
40959 uintptr_t ret_ref = 0;
40960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40963 ret_ref = (uintptr_t)ret_var.inner;
40964 if (ret_var.is_owned) {
40969 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40970 LDKSha256 arg_conv;
40971 arg_conv.inner = (void*)(arg & (~1));
40972 arg_conv.is_owned = false;
40973 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40974 intptr_t ret_val = Sha256_clone_ptr(&arg_conv);
40978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40979 LDKSha256 orig_conv;
40980 orig_conv.inner = (void*)(orig & (~1));
40981 orig_conv.is_owned = false;
40982 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40983 LDKSha256 ret_var = Sha256_clone(&orig_conv);
40984 uintptr_t ret_ref = 0;
40985 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40986 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40987 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40988 ret_ref = (uintptr_t)ret_var.inner;
40989 if (ret_var.is_owned) {
40995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
40997 o_conv.inner = (void*)(o & (~1));
40998 o_conv.is_owned = false;
40999 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41000 int64_t ret_val = Sha256_hash(&o_conv);
41004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41006 a_conv.inner = (void*)(a & (~1));
41007 a_conv.is_owned = false;
41008 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41010 b_conv.inner = (void*)(b & (~1));
41011 b_conv.is_owned = false;
41012 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41013 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
41017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41018 LDKDescription this_obj_conv;
41019 this_obj_conv.inner = (void*)(this_obj & (~1));
41020 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41022 Description_free(this_obj_conv);
41025 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
41026 LDKDescription ret_var = Description_clone(arg);
41027 uintptr_t ret_ref = 0;
41028 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41029 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41030 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41031 ret_ref = (uintptr_t)ret_var.inner;
41032 if (ret_var.is_owned) {
41037 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41038 LDKDescription arg_conv;
41039 arg_conv.inner = (void*)(arg & (~1));
41040 arg_conv.is_owned = false;
41041 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41042 intptr_t ret_val = Description_clone_ptr(&arg_conv);
41046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41047 LDKDescription orig_conv;
41048 orig_conv.inner = (void*)(orig & (~1));
41049 orig_conv.is_owned = false;
41050 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41051 LDKDescription ret_var = Description_clone(&orig_conv);
41052 uintptr_t ret_ref = 0;
41053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41056 ret_ref = (uintptr_t)ret_var.inner;
41057 if (ret_var.is_owned) {
41063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
41064 LDKDescription o_conv;
41065 o_conv.inner = (void*)(o & (~1));
41066 o_conv.is_owned = false;
41067 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41068 int64_t ret_val = Description_hash(&o_conv);
41072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41073 LDKDescription a_conv;
41074 a_conv.inner = (void*)(a & (~1));
41075 a_conv.is_owned = false;
41076 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41077 LDKDescription b_conv;
41078 b_conv.inner = (void*)(b & (~1));
41079 b_conv.is_owned = false;
41080 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41081 jboolean ret_val = Description_eq(&a_conv, &b_conv);
41085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41086 LDKPayeePubKey this_obj_conv;
41087 this_obj_conv.inner = (void*)(this_obj & (~1));
41088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41090 PayeePubKey_free(this_obj_conv);
41093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41094 LDKPayeePubKey this_ptr_conv;
41095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41096 this_ptr_conv.is_owned = false;
41097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41098 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41099 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
41103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41104 LDKPayeePubKey this_ptr_conv;
41105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41106 this_ptr_conv.is_owned = false;
41107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41108 LDKPublicKey val_ref;
41109 CHECK((*env)->GetArrayLength(env, val) == 33);
41110 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41111 PayeePubKey_set_a(&this_ptr_conv, val_ref);
41114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
41115 LDKPublicKey a_arg_ref;
41116 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
41117 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
41118 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
41119 uintptr_t ret_ref = 0;
41120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41123 ret_ref = (uintptr_t)ret_var.inner;
41124 if (ret_var.is_owned) {
41130 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
41131 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
41132 uintptr_t ret_ref = 0;
41133 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41134 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41136 ret_ref = (uintptr_t)ret_var.inner;
41137 if (ret_var.is_owned) {
41142 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41143 LDKPayeePubKey arg_conv;
41144 arg_conv.inner = (void*)(arg & (~1));
41145 arg_conv.is_owned = false;
41146 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41147 intptr_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
41151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41152 LDKPayeePubKey orig_conv;
41153 orig_conv.inner = (void*)(orig & (~1));
41154 orig_conv.is_owned = false;
41155 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41156 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
41157 uintptr_t ret_ref = 0;
41158 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41159 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41160 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41161 ret_ref = (uintptr_t)ret_var.inner;
41162 if (ret_var.is_owned) {
41168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
41169 LDKPayeePubKey o_conv;
41170 o_conv.inner = (void*)(o & (~1));
41171 o_conv.is_owned = false;
41172 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41173 int64_t ret_val = PayeePubKey_hash(&o_conv);
41177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41178 LDKPayeePubKey a_conv;
41179 a_conv.inner = (void*)(a & (~1));
41180 a_conv.is_owned = false;
41181 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41182 LDKPayeePubKey b_conv;
41183 b_conv.inner = (void*)(b & (~1));
41184 b_conv.is_owned = false;
41185 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41186 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
41190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41191 LDKExpiryTime this_obj_conv;
41192 this_obj_conv.inner = (void*)(this_obj & (~1));
41193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41195 ExpiryTime_free(this_obj_conv);
41198 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
41199 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
41200 uintptr_t ret_ref = 0;
41201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41204 ret_ref = (uintptr_t)ret_var.inner;
41205 if (ret_var.is_owned) {
41210 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41211 LDKExpiryTime arg_conv;
41212 arg_conv.inner = (void*)(arg & (~1));
41213 arg_conv.is_owned = false;
41214 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41215 intptr_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
41219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41220 LDKExpiryTime orig_conv;
41221 orig_conv.inner = (void*)(orig & (~1));
41222 orig_conv.is_owned = false;
41223 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41224 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
41225 uintptr_t ret_ref = 0;
41226 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41227 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41228 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41229 ret_ref = (uintptr_t)ret_var.inner;
41230 if (ret_var.is_owned) {
41236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
41237 LDKExpiryTime o_conv;
41238 o_conv.inner = (void*)(o & (~1));
41239 o_conv.is_owned = false;
41240 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41241 int64_t ret_val = ExpiryTime_hash(&o_conv);
41245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41246 LDKExpiryTime a_conv;
41247 a_conv.inner = (void*)(a & (~1));
41248 a_conv.is_owned = false;
41249 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41250 LDKExpiryTime b_conv;
41251 b_conv.inner = (void*)(b & (~1));
41252 b_conv.is_owned = false;
41253 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41254 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
41258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41259 LDKMinFinalCltvExpiry this_obj_conv;
41260 this_obj_conv.inner = (void*)(this_obj & (~1));
41261 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41263 MinFinalCltvExpiry_free(this_obj_conv);
41266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41267 LDKMinFinalCltvExpiry this_ptr_conv;
41268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41269 this_ptr_conv.is_owned = false;
41270 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41271 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
41275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41276 LDKMinFinalCltvExpiry this_ptr_conv;
41277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41278 this_ptr_conv.is_owned = false;
41279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41280 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
41283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
41284 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
41285 uintptr_t ret_ref = 0;
41286 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41287 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41288 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41289 ret_ref = (uintptr_t)ret_var.inner;
41290 if (ret_var.is_owned) {
41296 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
41297 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
41298 uintptr_t ret_ref = 0;
41299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41302 ret_ref = (uintptr_t)ret_var.inner;
41303 if (ret_var.is_owned) {
41308 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41309 LDKMinFinalCltvExpiry arg_conv;
41310 arg_conv.inner = (void*)(arg & (~1));
41311 arg_conv.is_owned = false;
41312 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41313 intptr_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
41317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41318 LDKMinFinalCltvExpiry orig_conv;
41319 orig_conv.inner = (void*)(orig & (~1));
41320 orig_conv.is_owned = false;
41321 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41322 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
41323 uintptr_t ret_ref = 0;
41324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41327 ret_ref = (uintptr_t)ret_var.inner;
41328 if (ret_var.is_owned) {
41334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
41335 LDKMinFinalCltvExpiry o_conv;
41336 o_conv.inner = (void*)(o & (~1));
41337 o_conv.is_owned = false;
41338 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41339 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
41343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41344 LDKMinFinalCltvExpiry a_conv;
41345 a_conv.inner = (void*)(a & (~1));
41346 a_conv.is_owned = false;
41347 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41348 LDKMinFinalCltvExpiry b_conv;
41349 b_conv.inner = (void*)(b & (~1));
41350 b_conv.is_owned = false;
41351 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41352 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
41356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41357 if ((this_ptr & 1) != 0) return;
41358 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
41359 CHECK_ACCESS(this_ptr_ptr);
41360 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
41361 FREE((void*)this_ptr);
41362 Fallback_free(this_ptr_conv);
41365 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
41366 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
41367 *ret_copy = Fallback_clone(arg);
41368 uintptr_t ret_ref = (uintptr_t)ret_copy;
41371 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41372 LDKFallback* arg_conv = (LDKFallback*)arg;
41373 intptr_t ret_val = Fallback_clone_ptr(arg_conv);
41377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41378 LDKFallback* orig_conv = (LDKFallback*)orig;
41379 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
41380 *ret_copy = Fallback_clone(orig_conv);
41381 uintptr_t ret_ref = (uintptr_t)ret_copy;
41385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
41387 LDKCVec_u8Z program_ref;
41388 program_ref.datalen = (*env)->GetArrayLength(env, program);
41389 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
41390 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
41391 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
41392 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
41393 uintptr_t ret_ref = (uintptr_t)ret_copy;
41397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
41398 LDKTwentyBytes a_ref;
41399 CHECK((*env)->GetArrayLength(env, a) == 20);
41400 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
41401 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
41402 *ret_copy = Fallback_pub_key_hash(a_ref);
41403 uintptr_t ret_ref = (uintptr_t)ret_copy;
41407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
41408 LDKTwentyBytes a_ref;
41409 CHECK((*env)->GetArrayLength(env, a) == 20);
41410 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
41411 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
41412 *ret_copy = Fallback_script_hash(a_ref);
41413 uintptr_t ret_ref = (uintptr_t)ret_copy;
41417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
41418 LDKFallback* o_conv = (LDKFallback*)o;
41419 int64_t ret_val = Fallback_hash(o_conv);
41423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41424 LDKFallback* a_conv = (LDKFallback*)a;
41425 LDKFallback* b_conv = (LDKFallback*)b;
41426 jboolean ret_val = Fallback_eq(a_conv, b_conv);
41430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41431 LDKInvoiceSignature this_obj_conv;
41432 this_obj_conv.inner = (void*)(this_obj & (~1));
41433 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41435 InvoiceSignature_free(this_obj_conv);
41438 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
41439 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
41440 uintptr_t ret_ref = 0;
41441 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41442 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41443 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41444 ret_ref = (uintptr_t)ret_var.inner;
41445 if (ret_var.is_owned) {
41450 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41451 LDKInvoiceSignature arg_conv;
41452 arg_conv.inner = (void*)(arg & (~1));
41453 arg_conv.is_owned = false;
41454 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41455 intptr_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
41459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41460 LDKInvoiceSignature orig_conv;
41461 orig_conv.inner = (void*)(orig & (~1));
41462 orig_conv.is_owned = false;
41463 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41464 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
41465 uintptr_t ret_ref = 0;
41466 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41467 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41468 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41469 ret_ref = (uintptr_t)ret_var.inner;
41470 if (ret_var.is_owned) {
41476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41477 LDKInvoiceSignature a_conv;
41478 a_conv.inner = (void*)(a & (~1));
41479 a_conv.is_owned = false;
41480 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41481 LDKInvoiceSignature b_conv;
41482 b_conv.inner = (void*)(b & (~1));
41483 b_conv.is_owned = false;
41484 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41485 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
41489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41490 LDKPrivateRoute this_obj_conv;
41491 this_obj_conv.inner = (void*)(this_obj & (~1));
41492 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41494 PrivateRoute_free(this_obj_conv);
41497 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
41498 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
41499 uintptr_t ret_ref = 0;
41500 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41501 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41502 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41503 ret_ref = (uintptr_t)ret_var.inner;
41504 if (ret_var.is_owned) {
41509 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41510 LDKPrivateRoute arg_conv;
41511 arg_conv.inner = (void*)(arg & (~1));
41512 arg_conv.is_owned = false;
41513 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41514 intptr_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
41518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41519 LDKPrivateRoute orig_conv;
41520 orig_conv.inner = (void*)(orig & (~1));
41521 orig_conv.is_owned = false;
41522 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41523 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
41524 uintptr_t ret_ref = 0;
41525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41528 ret_ref = (uintptr_t)ret_var.inner;
41529 if (ret_var.is_owned) {
41535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
41536 LDKPrivateRoute o_conv;
41537 o_conv.inner = (void*)(o & (~1));
41538 o_conv.is_owned = false;
41539 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41540 int64_t ret_val = PrivateRoute_hash(&o_conv);
41544 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41545 LDKPrivateRoute a_conv;
41546 a_conv.inner = (void*)(a & (~1));
41547 a_conv.is_owned = false;
41548 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41549 LDKPrivateRoute b_conv;
41550 b_conv.inner = (void*)(b & (~1));
41551 b_conv.is_owned = false;
41552 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41553 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
41557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
41558 LDKSignedRawInvoice this_arg_conv;
41559 this_arg_conv.inner = (void*)(this_arg & (~1));
41560 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
41561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41562 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
41563 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
41564 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
41565 return ((uintptr_t)ret_conv);
41568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
41569 LDKSignedRawInvoice this_arg_conv;
41570 this_arg_conv.inner = (void*)(this_arg & (~1));
41571 this_arg_conv.is_owned = false;
41572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41573 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
41574 uintptr_t ret_ref = 0;
41575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41578 ret_ref = (uintptr_t)ret_var.inner;
41579 if (ret_var.is_owned) {
41585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
41586 LDKSignedRawInvoice this_arg_conv;
41587 this_arg_conv.inner = (void*)(this_arg & (~1));
41588 this_arg_conv.is_owned = false;
41589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41590 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41591 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
41595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
41596 LDKSignedRawInvoice this_arg_conv;
41597 this_arg_conv.inner = (void*)(this_arg & (~1));
41598 this_arg_conv.is_owned = false;
41599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41600 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
41601 uintptr_t ret_ref = 0;
41602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41605 ret_ref = (uintptr_t)ret_var.inner;
41606 if (ret_var.is_owned) {
41612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41613 LDKSignedRawInvoice this_arg_conv;
41614 this_arg_conv.inner = (void*)(this_arg & (~1));
41615 this_arg_conv.is_owned = false;
41616 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41617 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
41618 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
41619 return (uintptr_t)ret_conv;
41622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
41623 LDKSignedRawInvoice this_arg_conv;
41624 this_arg_conv.inner = (void*)(this_arg & (~1));
41625 this_arg_conv.is_owned = false;
41626 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41627 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
41631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
41632 LDKRawInvoice this_arg_conv;
41633 this_arg_conv.inner = (void*)(this_arg & (~1));
41634 this_arg_conv.is_owned = false;
41635 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41636 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41637 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
41641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
41642 LDKRawInvoice this_arg_conv;
41643 this_arg_conv.inner = (void*)(this_arg & (~1));
41644 this_arg_conv.is_owned = false;
41645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41646 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
41647 uintptr_t ret_ref = 0;
41648 if ((uintptr_t)ret_var.inner > 4096) {
41649 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41650 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41652 ret_ref = (uintptr_t)ret_var.inner;
41653 if (ret_var.is_owned) {
41660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
41661 LDKRawInvoice this_arg_conv;
41662 this_arg_conv.inner = (void*)(this_arg & (~1));
41663 this_arg_conv.is_owned = false;
41664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41665 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
41666 uintptr_t ret_ref = 0;
41667 if ((uintptr_t)ret_var.inner > 4096) {
41668 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41669 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41671 ret_ref = (uintptr_t)ret_var.inner;
41672 if (ret_var.is_owned) {
41679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41680 LDKRawInvoice this_arg_conv;
41681 this_arg_conv.inner = (void*)(this_arg & (~1));
41682 this_arg_conv.is_owned = false;
41683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41684 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
41685 uintptr_t ret_ref = 0;
41686 if ((uintptr_t)ret_var.inner > 4096) {
41687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41690 ret_ref = (uintptr_t)ret_var.inner;
41691 if (ret_var.is_owned) {
41698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
41699 LDKRawInvoice this_arg_conv;
41700 this_arg_conv.inner = (void*)(this_arg & (~1));
41701 this_arg_conv.is_owned = false;
41702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41703 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
41704 uintptr_t ret_ref = 0;
41705 if ((uintptr_t)ret_var.inner > 4096) {
41706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41709 ret_ref = (uintptr_t)ret_var.inner;
41710 if (ret_var.is_owned) {
41717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
41718 LDKRawInvoice this_arg_conv;
41719 this_arg_conv.inner = (void*)(this_arg & (~1));
41720 this_arg_conv.is_owned = false;
41721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41722 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
41723 uintptr_t ret_ref = 0;
41724 if ((uintptr_t)ret_var.inner > 4096) {
41725 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41726 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41728 ret_ref = (uintptr_t)ret_var.inner;
41729 if (ret_var.is_owned) {
41736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
41737 LDKRawInvoice this_arg_conv;
41738 this_arg_conv.inner = (void*)(this_arg & (~1));
41739 this_arg_conv.is_owned = false;
41740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41741 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
41742 uintptr_t ret_ref = 0;
41743 if ((uintptr_t)ret_var.inner > 4096) {
41744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41747 ret_ref = (uintptr_t)ret_var.inner;
41748 if (ret_var.is_owned) {
41755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41756 LDKRawInvoice this_arg_conv;
41757 this_arg_conv.inner = (void*)(this_arg & (~1));
41758 this_arg_conv.is_owned = false;
41759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41760 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41761 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
41765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41766 LDKRawInvoice this_arg_conv;
41767 this_arg_conv.inner = (void*)(this_arg & (~1));
41768 this_arg_conv.is_owned = false;
41769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41770 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
41771 uintptr_t ret_ref = 0;
41772 if ((uintptr_t)ret_var.inner > 4096) {
41773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41776 ret_ref = (uintptr_t)ret_var.inner;
41777 if (ret_var.is_owned) {
41784 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
41785 LDKRawInvoice this_arg_conv;
41786 this_arg_conv.inner = (void*)(this_arg & (~1));
41787 this_arg_conv.is_owned = false;
41788 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41789 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
41790 int64_tArray ret_arr = NULL;
41791 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41792 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41793 for (size_t o = 0; o < ret_var.datalen; o++) {
41794 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
41795 uintptr_t ret_conv_14_ref = 0;
41796 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41797 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
41799 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
41800 if (ret_conv_14_var.is_owned) {
41801 ret_conv_14_ref |= 1;
41803 ret_arr_ptr[o] = ret_conv_14_ref;
41805 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41806 FREE(ret_var.data);
41810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
41811 LDKRawInvoice this_arg_conv;
41812 this_arg_conv.inner = (void*)(this_arg & (~1));
41813 this_arg_conv.is_owned = false;
41814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41815 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41816 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
41817 uintptr_t ret_ref = (uintptr_t)ret_copy;
41821 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
41822 LDKRawInvoice this_arg_conv;
41823 this_arg_conv.inner = (void*)(this_arg & (~1));
41824 this_arg_conv.is_owned = false;
41825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41826 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
41830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
41831 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
41832 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
41833 return (uintptr_t)ret_conv;
41836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
41837 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
41838 *ret_conv = PositiveTimestamp_from_system_time(time);
41839 return (uintptr_t)ret_conv;
41842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
41843 LDKPositiveTimestamp this_arg_conv;
41844 this_arg_conv.inner = (void*)(this_arg & (~1));
41845 this_arg_conv.is_owned = false;
41846 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41847 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
41851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
41852 LDKPositiveTimestamp this_arg_conv;
41853 this_arg_conv.inner = (void*)(this_arg & (~1));
41854 this_arg_conv.is_owned = false;
41855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41856 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
41860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
41861 LDKInvoice this_arg_conv;
41862 this_arg_conv.inner = (void*)(this_arg & (~1));
41863 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
41864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41865 this_arg_conv = Invoice_clone(&this_arg_conv);
41866 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
41867 uintptr_t ret_ref = 0;
41868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41871 ret_ref = (uintptr_t)ret_var.inner;
41872 if (ret_var.is_owned) {
41878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
41879 LDKInvoice this_arg_conv;
41880 this_arg_conv.inner = (void*)(this_arg & (~1));
41881 this_arg_conv.is_owned = false;
41882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41883 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
41884 *ret_conv = Invoice_check_signature(&this_arg_conv);
41885 return (uintptr_t)ret_conv;
41888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
41889 LDKSignedRawInvoice signed_invoice_conv;
41890 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
41891 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
41892 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
41893 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
41894 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
41895 *ret_conv = Invoice_from_signed(signed_invoice_conv);
41896 return (uintptr_t)ret_conv;
41899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
41900 LDKInvoice this_arg_conv;
41901 this_arg_conv.inner = (void*)(this_arg & (~1));
41902 this_arg_conv.is_owned = false;
41903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41904 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
41908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
41909 LDKInvoice this_arg_conv;
41910 this_arg_conv.inner = (void*)(this_arg & (~1));
41911 this_arg_conv.is_owned = false;
41912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41913 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
41918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41919 LDKInvoice this_arg_conv;
41920 this_arg_conv.inner = (void*)(this_arg & (~1));
41921 this_arg_conv.is_owned = false;
41922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41923 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41924 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
41928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
41929 LDKInvoice this_arg_conv;
41930 this_arg_conv.inner = (void*)(this_arg & (~1));
41931 this_arg_conv.is_owned = false;
41932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41933 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
41934 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
41938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
41939 LDKInvoice this_arg_conv;
41940 this_arg_conv.inner = (void*)(this_arg & (~1));
41941 this_arg_conv.is_owned = false;
41942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41943 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
41944 uintptr_t ret_ref = 0;
41945 if ((uintptr_t)ret_var.inner > 4096) {
41946 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41947 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41948 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41949 ret_ref = (uintptr_t)ret_var.inner;
41950 if (ret_var.is_owned) {
41957 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
41958 LDKInvoice this_arg_conv;
41959 this_arg_conv.inner = (void*)(this_arg & (~1));
41960 this_arg_conv.is_owned = false;
41961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41962 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41963 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
41967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
41968 LDKInvoice this_arg_conv;
41969 this_arg_conv.inner = (void*)(this_arg & (~1));
41970 this_arg_conv.is_owned = false;
41971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41972 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
41976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
41977 LDKInvoice this_arg_conv;
41978 this_arg_conv.inner = (void*)(this_arg & (~1));
41979 this_arg_conv.is_owned = false;
41980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41981 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
41985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
41986 LDKInvoice this_arg_conv;
41987 this_arg_conv.inner = (void*)(this_arg & (~1));
41988 this_arg_conv.is_owned = false;
41989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41990 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
41994 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
41995 LDKInvoice this_arg_conv;
41996 this_arg_conv.inner = (void*)(this_arg & (~1));
41997 this_arg_conv.is_owned = false;
41998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41999 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
42000 int64_tArray ret_arr = NULL;
42001 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42002 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42003 for (size_t o = 0; o < ret_var.datalen; o++) {
42004 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
42005 uintptr_t ret_conv_14_ref = 0;
42006 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42007 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42008 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
42009 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
42010 if (ret_conv_14_var.is_owned) {
42011 ret_conv_14_ref |= 1;
42013 ret_arr_ptr[o] = ret_conv_14_ref;
42015 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42016 FREE(ret_var.data);
42020 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
42021 LDKInvoice this_arg_conv;
42022 this_arg_conv.inner = (void*)(this_arg & (~1));
42023 this_arg_conv.is_owned = false;
42024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42025 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
42026 int64_tArray ret_arr = NULL;
42027 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42028 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42029 for (size_t l = 0; l < ret_var.datalen; l++) {
42030 LDKRouteHint ret_conv_11_var = ret_var.data[l];
42031 uintptr_t ret_conv_11_ref = 0;
42032 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42033 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
42035 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
42036 if (ret_conv_11_var.is_owned) {
42037 ret_conv_11_ref |= 1;
42039 ret_arr_ptr[l] = ret_conv_11_ref;
42041 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42042 FREE(ret_var.data);
42046 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
42047 LDKInvoice this_arg_conv;
42048 this_arg_conv.inner = (void*)(this_arg & (~1));
42049 this_arg_conv.is_owned = false;
42050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42051 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
42055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
42056 LDKInvoice this_arg_conv;
42057 this_arg_conv.inner = (void*)(this_arg & (~1));
42058 this_arg_conv.is_owned = false;
42059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42060 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42061 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
42062 uintptr_t ret_ref = (uintptr_t)ret_copy;
42066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
42067 LDKStr description_conv = java_to_owned_str(env, description);
42068 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
42069 *ret_conv = Description_new(description_conv);
42070 return (uintptr_t)ret_conv;
42073 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
42074 LDKDescription this_arg_conv;
42075 this_arg_conv.inner = (void*)(this_arg & (~1));
42076 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
42077 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42078 this_arg_conv = Description_clone(&this_arg_conv);
42079 LDKStr ret_str = Description_into_inner(this_arg_conv);
42080 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
42086 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
42087 *ret_conv = ExpiryTime_from_seconds(seconds);
42088 return (uintptr_t)ret_conv;
42091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
42092 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
42093 *ret_conv = ExpiryTime_from_duration(duration);
42094 return (uintptr_t)ret_conv;
42097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
42098 LDKExpiryTime this_arg_conv;
42099 this_arg_conv.inner = (void*)(this_arg & (~1));
42100 this_arg_conv.is_owned = false;
42101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42102 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
42106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
42107 LDKExpiryTime this_arg_conv;
42108 this_arg_conv.inner = (void*)(this_arg & (~1));
42109 this_arg_conv.is_owned = false;
42110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42111 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
42115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
42116 LDKRouteHint hops_conv;
42117 hops_conv.inner = (void*)(hops & (~1));
42118 hops_conv.is_owned = (hops & 1) || (hops == 0);
42119 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
42120 hops_conv = RouteHint_clone(&hops_conv);
42121 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
42122 *ret_conv = PrivateRoute_new(hops_conv);
42123 return (uintptr_t)ret_conv;
42126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
42127 LDKPrivateRoute this_arg_conv;
42128 this_arg_conv.inner = (void*)(this_arg & (~1));
42129 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
42130 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42131 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
42132 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
42133 uintptr_t ret_ref = 0;
42134 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42135 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42136 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42137 ret_ref = (uintptr_t)ret_var.inner;
42138 if (ret_var.is_owned) {
42144 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42145 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
42146 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
42150 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
42151 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
42155 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
42156 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
42160 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
42161 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
42165 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
42166 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
42170 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
42171 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
42175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42176 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
42177 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
42178 jboolean ret_val = CreationError_eq(a_conv, b_conv);
42182 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42183 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
42184 LDKStr ret_str = CreationError_to_str(o_conv);
42185 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42190 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42191 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
42192 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
42196 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
42197 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
42201 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
42202 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
42206 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
42207 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
42211 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
42212 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
42216 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
42217 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
42221 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
42222 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
42226 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
42227 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
42231 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
42232 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
42236 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
42237 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
42241 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
42242 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
42246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42247 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
42248 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
42249 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
42253 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42254 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
42255 LDKStr ret_str = SemanticError_to_str(o_conv);
42256 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42262 if ((this_ptr & 1) != 0) return;
42263 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42264 CHECK_ACCESS(this_ptr_ptr);
42265 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
42266 FREE((void*)this_ptr);
42267 SignOrCreationError_free(this_ptr_conv);
42270 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
42271 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
42272 *ret_copy = SignOrCreationError_clone(arg);
42273 uintptr_t ret_ref = (uintptr_t)ret_copy;
42276 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42277 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
42278 intptr_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
42282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42283 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
42284 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
42285 *ret_copy = SignOrCreationError_clone(orig_conv);
42286 uintptr_t ret_ref = (uintptr_t)ret_copy;
42290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
42291 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
42292 *ret_copy = SignOrCreationError_sign_error();
42293 uintptr_t ret_ref = (uintptr_t)ret_copy;
42297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
42298 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
42299 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
42300 *ret_copy = SignOrCreationError_creation_error(a_conv);
42301 uintptr_t ret_ref = (uintptr_t)ret_copy;
42305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42306 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
42307 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
42308 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
42312 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42313 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
42314 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
42315 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42321 LDKInvoicePayer this_obj_conv;
42322 this_obj_conv.inner = (void*)(this_obj & (~1));
42323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42325 InvoicePayer_free(this_obj_conv);
42328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42329 if ((this_ptr & 1) != 0) return;
42330 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42331 CHECK_ACCESS(this_ptr_ptr);
42332 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
42333 FREE((void*)this_ptr);
42334 Payer_free(this_ptr_conv);
42337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42338 if ((this_ptr & 1) != 0) return;
42339 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42340 CHECK_ACCESS(this_ptr_ptr);
42341 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
42342 FREE((void*)this_ptr);
42343 Router_free(this_ptr_conv);
42346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42347 LDKRetryAttempts this_obj_conv;
42348 this_obj_conv.inner = (void*)(this_obj & (~1));
42349 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42351 RetryAttempts_free(this_obj_conv);
42354 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
42355 LDKRetryAttempts this_ptr_conv;
42356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42357 this_ptr_conv.is_owned = false;
42358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42359 intptr_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
42363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, intptr_t val) {
42364 LDKRetryAttempts this_ptr_conv;
42365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42366 this_ptr_conv.is_owned = false;
42367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42368 RetryAttempts_set_a(&this_ptr_conv, val);
42371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, intptr_t a_arg) {
42372 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
42373 uintptr_t ret_ref = 0;
42374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42377 ret_ref = (uintptr_t)ret_var.inner;
42378 if (ret_var.is_owned) {
42384 static inline uintptr_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
42385 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
42386 uintptr_t ret_ref = 0;
42387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42390 ret_ref = (uintptr_t)ret_var.inner;
42391 if (ret_var.is_owned) {
42396 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42397 LDKRetryAttempts arg_conv;
42398 arg_conv.inner = (void*)(arg & (~1));
42399 arg_conv.is_owned = false;
42400 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42401 intptr_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
42405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42406 LDKRetryAttempts orig_conv;
42407 orig_conv.inner = (void*)(orig & (~1));
42408 orig_conv.is_owned = false;
42409 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42410 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
42411 uintptr_t ret_ref = 0;
42412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42415 ret_ref = (uintptr_t)ret_var.inner;
42416 if (ret_var.is_owned) {
42422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42423 LDKRetryAttempts a_conv;
42424 a_conv.inner = (void*)(a & (~1));
42425 a_conv.is_owned = false;
42426 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42427 LDKRetryAttempts b_conv;
42428 b_conv.inner = (void*)(b & (~1));
42429 b_conv.is_owned = false;
42430 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42431 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
42435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) {
42436 LDKRetryAttempts o_conv;
42437 o_conv.inner = (void*)(o & (~1));
42438 o_conv.is_owned = false;
42439 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42440 int64_t ret_val = RetryAttempts_hash(&o_conv);
42444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42445 if ((this_ptr & 1) != 0) return;
42446 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42447 CHECK_ACCESS(this_ptr_ptr);
42448 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
42449 FREE((void*)this_ptr);
42450 PaymentError_free(this_ptr_conv);
42453 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
42454 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
42455 *ret_copy = PaymentError_clone(arg);
42456 uintptr_t ret_ref = (uintptr_t)ret_copy;
42459 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42460 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
42461 intptr_t ret_val = PaymentError_clone_ptr(arg_conv);
42465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42466 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
42467 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
42468 *ret_copy = PaymentError_clone(orig_conv);
42469 uintptr_t ret_ref = (uintptr_t)ret_copy;
42473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
42474 LDKStr a_conv = java_to_owned_str(env, a);
42475 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
42476 *ret_copy = PaymentError_invoice(a_conv);
42477 uintptr_t ret_ref = (uintptr_t)ret_copy;
42481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
42482 LDKLightningError a_conv;
42483 a_conv.inner = (void*)(a & (~1));
42484 a_conv.is_owned = (a & 1) || (a == 0);
42485 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42486 a_conv = LightningError_clone(&a_conv);
42487 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
42488 *ret_copy = PaymentError_routing(a_conv);
42489 uintptr_t ret_ref = (uintptr_t)ret_copy;
42493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
42494 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
42495 CHECK_ACCESS(a_ptr);
42496 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
42497 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
42498 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
42499 *ret_copy = PaymentError_sending(a_conv);
42500 uintptr_t ret_ref = (uintptr_t)ret_copy;
42504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *env, jclass clz, int64_t payer, int64_t router, int64_t scorer, int64_t logger, int64_t event_handler, int64_t retry_attempts) {
42505 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
42506 CHECK_ACCESS(payer_ptr);
42507 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
42508 if (payer_conv.free == LDKPayer_JCalls_free) {
42509 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42510 LDKPayer_JCalls_cloned(&payer_conv);
42512 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
42513 CHECK_ACCESS(router_ptr);
42514 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
42515 if (router_conv.free == LDKRouter_JCalls_free) {
42516 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42517 LDKRouter_JCalls_cloned(&router_conv);
42519 LDKMultiThreadedLockableScore scorer_conv;
42520 scorer_conv.inner = (void*)(scorer & (~1));
42521 scorer_conv.is_owned = false;
42522 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
42523 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42524 CHECK_ACCESS(logger_ptr);
42525 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42526 if (logger_conv.free == LDKLogger_JCalls_free) {
42527 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42528 LDKLogger_JCalls_cloned(&logger_conv);
42530 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
42531 CHECK_ACCESS(event_handler_ptr);
42532 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
42533 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
42534 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42535 LDKEventHandler_JCalls_cloned(&event_handler_conv);
42537 LDKRetryAttempts retry_attempts_conv;
42538 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
42539 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
42540 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
42541 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
42542 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
42543 uintptr_t ret_ref = 0;
42544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42547 ret_ref = (uintptr_t)ret_var.inner;
42548 if (ret_var.is_owned) {
42554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
42555 LDKInvoicePayer this_arg_conv;
42556 this_arg_conv.inner = (void*)(this_arg & (~1));
42557 this_arg_conv.is_owned = false;
42558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42559 LDKInvoice invoice_conv;
42560 invoice_conv.inner = (void*)(invoice & (~1));
42561 invoice_conv.is_owned = false;
42562 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
42563 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
42564 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
42565 return (uintptr_t)ret_conv;
42568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice, int64_t amount_msats) {
42569 LDKInvoicePayer this_arg_conv;
42570 this_arg_conv.inner = (void*)(this_arg & (~1));
42571 this_arg_conv.is_owned = false;
42572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42573 LDKInvoice invoice_conv;
42574 invoice_conv.inner = (void*)(invoice & (~1));
42575 invoice_conv.is_owned = false;
42576 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
42577 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
42578 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
42579 return (uintptr_t)ret_conv;
42582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) {
42583 LDKInvoicePayer this_arg_conv;
42584 this_arg_conv.inner = (void*)(this_arg & (~1));
42585 this_arg_conv.is_owned = false;
42586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42587 LDKPublicKey pubkey_ref;
42588 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
42589 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
42590 LDKThirtyTwoBytes payment_preimage_ref;
42591 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
42592 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
42593 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
42594 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
42595 return (uintptr_t)ret_conv;
42598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
42599 LDKInvoicePayer this_arg_conv;
42600 this_arg_conv.inner = (void*)(this_arg & (~1));
42601 this_arg_conv.is_owned = false;
42602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42603 unsigned char payment_hash_arr[32];
42604 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
42605 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
42606 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
42607 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
42610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
42611 LDKInvoicePayer this_arg_conv;
42612 this_arg_conv.inner = (void*)(this_arg & (~1));
42613 this_arg_conv.is_owned = false;
42614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42615 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
42616 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
42617 return (uintptr_t)ret_ret;
42620 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) {
42621 LDKChannelManager channelmanager_conv;
42622 channelmanager_conv.inner = (void*)(channelmanager & (~1));
42623 channelmanager_conv.is_owned = false;
42624 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
42625 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
42626 CHECK_ACCESS(keys_manager_ptr);
42627 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
42628 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
42629 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42630 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
42632 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
42633 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
42634 CHECK_ACCESS(amt_msat_ptr);
42635 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
42636 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
42637 LDKStr description_conv = java_to_owned_str(env, description);
42638 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
42639 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
42640 return (uintptr_t)ret_conv;
42643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42644 LDKDefaultRouter this_obj_conv;
42645 this_obj_conv.inner = (void*)(this_obj & (~1));
42646 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42647 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42648 DefaultRouter_free(this_obj_conv);
42651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
42652 LDKNetworkGraph network_graph_conv;
42653 network_graph_conv.inner = (void*)(network_graph & (~1));
42654 network_graph_conv.is_owned = false;
42655 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42656 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42657 CHECK_ACCESS(logger_ptr);
42658 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42659 if (logger_conv.free == LDKLogger_JCalls_free) {
42660 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42661 LDKLogger_JCalls_cloned(&logger_conv);
42663 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
42664 uintptr_t ret_ref = 0;
42665 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42666 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42668 ret_ref = (uintptr_t)ret_var.inner;
42669 if (ret_var.is_owned) {
42675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
42676 LDKDefaultRouter this_arg_conv;
42677 this_arg_conv.inner = (void*)(this_arg & (~1));
42678 this_arg_conv.is_owned = false;
42679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42680 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
42681 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
42682 return (uintptr_t)ret_ret;
42685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
42686 LDKChannelManager this_arg_conv;
42687 this_arg_conv.inner = (void*)(this_arg & (~1));
42688 this_arg_conv.is_owned = false;
42689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42690 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
42691 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
42692 return (uintptr_t)ret_ret;
42695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
42696 LDKStr s_conv = java_to_owned_str(env, s);
42697 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
42698 *ret_conv = SiPrefix_from_str(s_conv);
42699 return (uintptr_t)ret_conv;
42702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
42703 LDKStr s_conv = java_to_owned_str(env, s);
42704 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
42705 *ret_conv = Invoice_from_str(s_conv);
42706 return (uintptr_t)ret_conv;
42709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
42710 LDKStr s_conv = java_to_owned_str(env, s);
42711 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
42712 *ret_conv = SignedRawInvoice_from_str(s_conv);
42713 return (uintptr_t)ret_conv;
42716 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42718 o_conv.inner = (void*)(o & (~1));
42719 o_conv.is_owned = false;
42720 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42721 LDKStr ret_str = Invoice_to_str(&o_conv);
42722 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42727 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42728 LDKSignedRawInvoice o_conv;
42729 o_conv.inner = (void*)(o & (~1));
42730 o_conv.is_owned = false;
42731 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42732 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
42733 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42738 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42739 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
42740 LDKStr ret_str = Currency_to_str(o_conv);
42741 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42746 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
42747 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
42748 LDKStr ret_str = SiPrefix_to_str(o_conv);
42749 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);